[READ-ONLY] Mirror of https://github.com/Schniz/dotfiles. my dotfiles
0

Configure Feed

Select the types of activity you want to include in your feed.

some nice utilities

Gal Schlezinger (Jul 27, 2021, 8:53 PM +0300) 16df7eca 401702a5

+100
+13
bin/db_auth
··· 1 + #!/bin/bash 2 + 3 + if [[ -x "databases.dontcommit.json.js" ]]; then 4 + JSON=$(./databases.dontcommit.json.js) 5 + elif [[ -x "databases.dontcommit.json" ]]; then 6 + JSON=$(./databases.dontcommit.json) 7 + elif [[ -f "databases.dontcommit.json" ]]; then 8 + JSON=$(cat databases.dontcommit.json) 9 + else 10 + JSON='{}' 11 + fi 12 + 13 + echo "$JSON" | jq -r ".$1"
+3
bin/docker-rmi-interactive
··· 1 + #!/bin/sh 2 + 3 + docker images | grep -v "REPOSITORY" | fzf -m | awk '{print $3}' | xargs docker rmi
+84
bin/meme
··· 1 + #!/usr/bin/env PUPPETEER_PRODUCT=chrome deno run -A --unstable 2 + // vim: ft=javascript 3 + 4 + import puppeteer from "https://deno.land/x/puppeteer@5.5.1/mod.ts"; 5 + import * as cmd from "https://cdn.skypack.dev/pin/cmd-ts@v0.6.8-TMjenIC770NjcBfpYzAs/mode=imports/optimized/cmd-ts.js"; 6 + import { HttpUrl } from "https://cdn.skypack.dev/cmd-ts/dist/esm/batteries/url.js"; 7 + 8 + const html = (strings, ...values) => String.raw(strings, ...values); 9 + const command = cmd.command({ 10 + name: "hello", 11 + args: { 12 + top: cmd.positional({ displayName: "top text" }), 13 + image: cmd.positional({ type: HttpUrl, displayName: "image" }), 14 + bottom: cmd.restPositionals({ displayName: "bottom text" }), 15 + textAlign: cmd.option({ 16 + long: "text-align", 17 + type: { 18 + ...cmd.oneOf(["auto", "center"]), 19 + defaultValue: () => "auto", 20 + defaultValueIsSerializable: true, 21 + }, 22 + }), 23 + fontWeight: cmd.option({ 24 + long: "font-weight", 25 + type: { 26 + ...cmd.oneOf(["normal", "bold"]), 27 + defaultValue: () => "normal", 28 + defaultValueIsSerializable: true, 29 + }, 30 + }), 31 + }, 32 + async handler(args) { 33 + const browser = await puppeteer.launch({ 34 + executablePath: 35 + "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", 36 + }); 37 + const page = await browser.newPage(); 38 + await Deno.writeTextFile( 39 + "/tmp/meme.html", 40 + html` 41 + <div 42 + id="meme" 43 + style="display: inline-block; text-align: ${args.textAlign}; font-family: Arial;" 44 + > 45 + <span 46 + dir="auto" 47 + style="display: block; font-weight: ${args.fontWeight}; font-size: 29px;" 48 + > 49 + ${args.top.replace(/\n/g, "<br>")} 50 + </span> 51 + <img src="${args.image}" style="max-width: 100vw" /> 52 + <span 53 + dir="auto" 54 + style="display: block; font-weight: ${args.fontWeight}; font-size: 29px;" 55 + > 56 + ${args.bottom.join(" ")} 57 + </span> 58 + </div> 59 + ` 60 + ); 61 + 62 + await page.goto("file:///tmp/meme.html", { waitUntil: "networkidle0" }); 63 + const meme = await page.$("#meme"); 64 + const boundingBox = await meme.boundingBox(); 65 + await page.setViewport({ 66 + height: Math.round(boundingBox.height), 67 + width: Math.round(boundingBox.width), 68 + deviceScaleFactor: 1, 69 + }); 70 + await page.screenshot({ 71 + path: "file.png", 72 + clip: await meme.boundingBox(), 73 + }); 74 + await page.close(); 75 + await browser.close(); 76 + }, 77 + }); 78 + 79 + cmd.run(command, Deno.args); 80 + 81 + // cmd.run(cmd.binary(command), ["", "", ...Deno.args]); 82 + 83 + /** 84 + */