Skip to content

Instantly share code, notes, and snippets.

View 20after4's full-sized avatar
🎶
rockin' out

Mukunda Modell 20after4

🎶
rockin' out
View GitHub Profile
@20after4
20after4 / canned_queries_from_files.py
Last active September 24, 2023 01:13
datasette plugin hook to load "canned queries" from files in a sql subdirectory within the datasette "config_dir"
# Copyright 2021-2023 Mukunda Modell
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the “Software”), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial
# portions of the Software.
@20after4
20after4 / imports-js.regex
Created July 26, 2022 01:42
regex to append .js to end end of all ecmascript module imports
search pattern:
((from ['"]\..*)[^.](\w\w))(['"])
replacement string:
$1.js$4
#!/bin/bash
set -e
for i in $( cat ~/gitfat.list ); do
scapdir=`dirname $i`
echo "cd $scapdir"
pushd $scapdir
git status
cat scap.cfg
sed -i.bak '/git_fat: True/a git_binary_manager: git-fat' scap.cfg
git add scap.cfg
@20after4
20after4 / beta
Created October 4, 2016 17:18
beta shell script and bash completion
#!/bin/bash
HOST="$1"
shift
ssh $@ deployment-$HOST.deployment-prep.eqiad.wmflabs
from . import graph
from . import op
class Phabricator(Deployment):
class source(GitRepo):
load_submodules = True
class conf(ConfigFile):
@20after4
20after4 / hashed_passwords.py
Last active October 12, 2015 23:54
compare hashed passwords in python
import hashlib
def compare_sha256(password, hashed_password):
m = hashlib.sha256()
m.update(password)
result = m.hexdigest()
return hashed_password == result
@20after4
20after4 / hiera.yaml
Created October 28, 2012 15:06 — forked from beddari/gist:2197910
hiera example
---
:hierarchy:
- %{env}/%{variant}_%{role}_%{group}_%{location}
- %{env}/%{variant}_%{role}_%{group}
- %{env}/%{variant}_%{role}
- %{env}/%{variant}
- %{env}
:backends:
- yaml
:yaml:
@20after4
20after4 / gist:1587443
Created January 10, 2012 06:35
Bash prompt that indicates current git branch
# This depends on git bash completion:
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
BLACK="\[$(tput setaf 0)\\"
RED="\[$(tput setaf 1)\]"
GREEN="\[$(tput setaf 2)\]"
LIME="\[$(tput setaf 190)\]"
YELLOW="\[$(tput setaf 3)\]"
POWDER_BLUE="\[$(tput setaf 153)\]"
@20after4
20after4 / iterm-bash_profile.sh
Created August 27, 2011 22:45
.bash_profile for iTerm2 tabs colored by tty
if [ "iTerm.app" == "$TERM_PROGRAM" ] ; then
# set up an array of RGB values
tabcolors[0]="244,0,200"
tabcolors[1]="0,200,244"
tabcolors[2]="68,250,132"
tabcolors[3]="250,68,132"
tabcolors[4]="250,132,68"
tabcolors[5]="220,200,100"
TTYNUM=`ps -p $$ -o tty= | cut -c 5,6,7`
@20after4
20after4 / fruity.ksf
Created November 3, 2010 22:52
komodo color scheme
Version = 4
Booleans = {'caretLineVisible': True, 'preferFixed': 1, 'useSelFore': False}
CommonStyles = {'attribute name': {'fore': 8904824},
'attribute value': {'fore': 13676752},
'bracebad': {'back': 13209, 'bold': 1, 'fore': 13434879},
'bracehighlight': {'bold': 1, 'fore': 10197815},
'classes': {'fore': 16764108},
'comments': {'bold': False, 'fore': 8953467, 'italic': False, 'size': 16},