This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Echo number of GIT commits per year. | |
git log --pretty='format:%cd' --date=format:'%Y' | uniq -c | awk '{print "Year: "$2", commits: "$1}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
import os | |
import subprocess | |
from sys import stderr | |
FORCED_GIT_GUI_PATH=None | |
# Do NOT modify anything below. | |
UNPATCHED_NEEDLE = 'pave_toplevel .' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sets the color of next text output to be a random color based on hostname's md5 hash. | |
# (If the terminal supports true colour (RGB) colors.) | |
set_host_based_color() { | |
HOSTHASH=$(hostname | md5sum) | |
printf "\x1b[38;2;%d;%d;%dm" 0x${HOSTHASH:0:2} 0x${HOSTHASH:2:2} 0x${HOSTHASH:4:2} | |
} | |
# Example usage: | |
# PS1="[\$(set_host_based_color)\$(hostname)\033[0m]: " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# smuuf.bashrc | |
# Prompt formatting | |
# 10:20:49 /etc | |
# [smuuf@smuuf-xubuntu]$ | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
} | |
NC="$(tput sgr0)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the name of archive taken from https://downloads.python.org/pypy/ | |
PYPY_VER="pypy3.9-v7.3.11-linux64" | |
PYPY_VER_NUM=`echo ${PYPY_VER} | grep -oP "v(\d\.?)+" | sed -r 's/[v.]//g'` | |
cd ~ | |
mkdir pypy | |
wget https://downloads.python.org/pypy/$PYPY_VER.tar.bz2 && tar -xvjf $PYPY_VER.tar.bz2 | |
rm $PYPY_VER.tar.bz2 | |
mv $PYPY_VER pypy/ | |
sudo ln -s ~/pypy/$PYPY_VER/bin/pypy3 /usr/bin/pypy3-$PYPY_VER_NUM; chmod +x /usr/bin/pypy3-$PYPY_VER_NUM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: | |
# ./a2manage.sh a2dismod proxy.* | |
# ./a2manage.sh a2enmod proxy proxy_fcgi ssl | |
MODS_A_CONF_PATH="/etc/apache2/*.conf" | |
MODS_B_CONF_PATH="/etc/apache2/conf.d/*.conf" | |
function a2enmod { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PREVIOUS="(@@.*function|class)" NEEDLE="getTraced" \ | |
bash -c 'git diff | awk "(/$PREVIOUS/ && !/$NEEDLE/) {capture=1; buffer = \$0; next} capture==1 {buffer = buffer \$0 \"\n\"} (\$capture && /$NEEDLE/) {printf(\"%s\", buffer); capture=0}"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import logging | |
import re as module_re | |
import re2 as module_re2 | |
USAGE_PROBABILITY = 0.5 | |
USE_ONLY_PYRE2 = True | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// PHP highlights for https://github.com/fabiospampinato/vscode-highlight | |
"highlight.regexes": { | |
"(NOTE:)\s": { | |
"regexFlags": "g", | |
"filterLanguageRegex": "php", | |
"decorations": [ | |
{ | |
"color": "#CFC8A6", | |
"backgroundColor": "#CFC8A40", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function psleep { | |
S="$1" | |
O="$S" | |
while [ $S -gt 0 ]; do | |
echo -ne "\r$S s (from $O) " | |
sleep 1 | |
((S--)) | |
done |
NewerOlder