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
prompt-color() { printf '\\[\e[38;5;%sm\\]%s\\[\e[m\\]' "$1" "$2"; } | |
PS1="$(printf '%s' \ | |
'\n' \ | |
`prompt-color 226 '\u'` \ | |
'@' \ | |
`prompt-color 208 '\h'` \ | |
':' \ | |
`prompt-color 207 '\w'` \ | |
'\n' \ | |
`prompt-color '$(( $?==0 ? 82 : 196 ))' '$?'` \ |
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 | |
same='-' #unchanged | |
up='△' #exists in first line, but not in second | |
down='▽' #exists in second line, but not in first | |
reset='' | |
reset=$'\e[0m' | |
same=$reset | |
up=$reset$'\e[1m\e[7m' |
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
function blameDiff() { | |
file="$1" | |
rev1="$2" | |
rev2="$3" | |
#default to HEAD if omitted | |
if [ -n "$rev1" ] | |
then | |
title1="(revision $rev1)" | |
else |
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 | |
#prints out, among other things; | |
# string "org.kde.screensaver" | |
#transform it to 'org.kde.screensaver' | |
service=$(\ | |
dbus-send \ | |
--session \ | |
--dest=org.freedesktop.DBus \ | |
--type=method_call \ |
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
zipinfo -1 A.zip | while read filename | |
do | |
unzip -p A.zip "$filename" | zip -9 A.zip - | |
zip --delete A.zip "$filename" | |
printf "@ -\n@=$filename\n" | zipnote -w A.zip | |
done |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
import argparse | |
import ctypes | |
import os | |
#requires version 3.5 of praw | |
import praw | |
import platform | |
import re |
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 | |
method="$1" | |
name="$2" | |
archives="$(dirname "${BASH_SOURCE[0]}")" | |
live=`pwd` | |
release="$archives/$name.zip" | |
backup="$archives/${name}_BAK.zip" | |
log="$live/released.txt" |
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
$dirs='.' | |
Get-ChildItem -Path 'dedupe' | Remove-Item -Recurse | |
$dirs = $dirs | %{ ($_ | Get-Item).FullName } | |
$matchDirs = '^(' + (($dirs | %{ [Regex]::Escape($_) }) -join '|') + ')' | |
$preferences = ( | |
('Act \d{4}( No \d+| \(\d{4} No[. ]\d+\))? - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$', 'Act,( \d{4},?)?( No \d+| \(\d{4} No[. ]\d+\))? - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' ), | |
('Act \d{4} No \d+ - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' , 'Act( No \d+)? - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' ), | |
('Act \d{4} No \d+ - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' , 'Act,? \d{4},? No\.\d+ - \d{1,2}\.\d{1,2}\.\d{4}\.pdf$' ), |
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
function resetEnv { | |
Set-Item ` | |
-Path (('Env:', $args[0]) -join '') ` | |
-Value (( | |
[System.Environment]::GetEnvironmentVariable($args[0], "Machine"), | |
[System.Environment]::GetEnvironmentVariable($args[0], "User") | |
) -match '.' -join ';') | |
} |
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
#at top of script | |
if (! | |
#current role | |
(New-Object Security.Principal.WindowsPrincipal( | |
[Security.Principal.WindowsIdentity]::GetCurrent() | |
#is admin? | |
)).IsInRole( | |
[Security.Principal.WindowsBuiltInRole]::Administrator | |
) | |
) { |
OlderNewer