Skip to content

Instantly share code, notes, and snippets.

View photo_gallery_in_27_lines.py
View example
$ echo '{"a":{"b":"quoted \" } {{{"}}{"c":{"d":2}}{"e":{"f":3}}' | go run firstobject.go
{"a":{"b":"quoted \" } {{{"}}
@llimllib
llimllib / mssql_to_csv.bash
Last active May 21, 2022
This is a script to convert every table in a Microsoft SQL Server database backup (.bak file) to a .csv file
View mssql_to_csv.bash
#!/usr/bin/env bash
# import an MS SQL .bak backup file to an MS SQL database, then export all
# tables to csv. run this script as `import.sh <filename>`. It expects to be
# run in the same directory as the backup file.
# this is only tested on my mac (OS X Catalina). I tried to stick to posix, but
# It will probably require some tweaking for you. I hope it gives a general
# sense of what you need to do at the very least.
View installvoid.sh
# https://voidlinux.org/usage/xbps/ is a handy site for docs that isn't linked
# from the docs page, for whatever reason. Gives good xbps-* examples
# install non-free repository:
sudo xbps-install void-repo-nonfree
# update the system; all installs failed before this:
sudo xbps-install -Su
# xbps is hard to type. Add these aliases to your bashrc if xbps-install is
View gist:c0f82d23d6f44501733b21cdd2e9f8d7
default 20:39:37.686798-0400 Finder bundle 0x4ff8 is launch-disabled and needs to be set trusted
default 20:39:37.688071-0400 lsd *** Registration warnings for <private>:
default 20:39:37.688087-0400 lsd Missing iTunes metadata
error 20:39:37.693434-0400 lsd LSStringLocalizer development region English not found in localizations available for bundle <private>
default 20:39:37.694953-0400 lsd Non-fatal error enumerating at <private>, continuing: Error Domain=NSCocoaErrorDomain Code=260 "The file “PlugIns” couldn’t be opened because there is no such file." UserInfo={NSURL=PlugIns/ -- file:///Applications/Firefox.app/Contents/, NSFilePath=/Applications/Firefox.app/Contents/PlugIns, NSUnderlyingError=0x1267223d0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
default 20:39:37.695065-0400 lsd - 45683955: Checking whether application is managed at file:///Applications/Firefox.app//org.mozilla.firefox
default 20:39:37.695185-0400 lsd (null):5:4:1:0:_LSServerRegisterItemInfo begin
default 20
View install.sh
#!/usr/bin/env bash
# many settings from https://raw.githubusercontent.com/mathiasbynens/dotfiles/master/.macos
# many settings from https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
# instructions on finding the default you've changed: https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/
# previous install notes at:
# https://gist.github.com/llimllib/ee591266e05bd880629a4e7511a61bb3
# https://gist.github.com/llimllib/e864a92da94ceb1ef0da2e06fd1f8d70
# https://gist.github.com/llimllib/aa4420cac617774ee2a54d8603d862e4
fancy_echo() {
@llimllib
llimllib / Makefile
Last active Mar 20, 2022
The simplest possible use of esbuild to import a package and run a function in the browser
View Makefile
build:
./node_modules/.bin/esbuild index.js --bundle --outfile=out.js
View allowed_answers.txt
cigar
rebut
sissy
humph
awake
blush
focal
evade
naval
serve
View bezier.js
var Bezier=function(t){function n(i){if(r[i])return r[i].exports;var e=r[i]={exports:{},id:i,loaded:!1};return t[i].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){"use strict";t.exports=r(1)},function(t,n,r){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};!function(){function n(t,n,r,i,e){"undefined"==typeof e&&(e=.5);var o=h.projectionratio(e,t),s=1-o,u={x:o*n.x+s*i.x,y:o*n.y+s*i.y},a=h.abcratio(e,t),f={x:r.x+(r.x-u.x)/a,y:r.y+(r.y-u.y)/a};return{A:f,B:r,C:u}}var e=Math.abs,o=Math.min,s=Math.max,u=Math.acos,a=Math.sqrt,f=Math.PI,c={x:0,y:0,z:0},h=r(2),x=r(3),y=function(t){var n=t&&t.forEach?t:[].slice.call(arguments),r=!1;if("object"===i(n[0])){r=n.length;var o=[];n.forEach(function(t){["x","y","z"].forEach(function(n){"undefined"!=typeof t[n]&&o.push(t[n])})}),n=o}var s=!1,u=n.length;if(r){if(r>4)
@llimllib
llimllib / amenu.py
Created Dec 28, 2021
The simplest menu implementation I could come up with in rich
View amenu.py
from rich.console import Console
from rich.style import Style
from rich.table import Table
from getchar import getchar
SELECTED = Style(bgcolor="white")
def print_table(console, table, rows=[], selected=0):
for i, row in enumerate(rows):