Skip to content

Instantly share code, notes, and snippets.

View xero's full-sized avatar
💭
🌃 💾

xero harrison xero

💭
🌃 💾
View GitHub Profile
@xero
xero / winmerge.sh
Created April 24, 2012 15:29
using winmerge with git diff - replaces unix style null files with a newly created empty windows temp file
#!/bin/sh
# using winmerge with git
# replaces unix style null files with a newly created empty windows temp file
file1=$1
if [ "$file1" == '/dev/null' ] || [ "$file1" == '\\.\nul' ] || [ ! -e "$file1" ]
then
file1="/tmp/gitnull"
`echo "">$file1`
fi
@xero
xero / .gitconfig
Created April 24, 2012 16:58
custom git log graph alias for .gitconfig
#fyi %x20 is a space.
[alias]
graph = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"
@xero
xero / dox.sh
Created August 30, 2012 19:40
working on automating my documentation generation. this script pulls out all the php files from a git repo, parses the names, and feeds them into doxphp and pipes that into doxphp2sphinx. which will make rst files from the inline phpdoc comments. the seco
#!/bin/sh
@echo "Making docs"
git ls-files | grep php | while read line; do filename=$(basename $line); newfile=docs/$filename; echo $newfile; doxphp
< $line | doxphp2sphinx > ${newfile/%.php/.rst}; done
@echo "deleting empty files"
rm -f $(find . -empty)
@xero
xero / python-logo-ascii.txt
Created August 31, 2012 16:02
python logo ascii art
..:77I777777777777777777777I. .
..?77777777777777777777777777777$+..
. ~7777777I7777777777777777777777777$~..
.7I7777...7777777777777777777777777$7+.
.?7777.. ..77777777777777777777777$$7.
.77777 777777777777777777777$$$$$I
.77777.. ...7777777777777777777$$$$$$$$
.7777777 .77$777777777777777777$$$$$$$$
.77777777777777777777777777777$$$$$$$$$$
.77777777777777777777777777$$$$$$$$$$$$$
@xero
xero / git-logo-ascii.txt
Created September 4, 2012 20:17
GIT logo ascii art
xxx
xxx
xxxxxxxxxxxxx
xxxxxxxxxxxxx
xxx
xxx
xxxxxxxxxxxxx
xxxxxxxxxxxxx
@xero
xero / git-pretty-options.txt
Created October 1, 2012 19:59
git pretty format options
git pretty format options
-------------------------
- '%x20': space
- '%H': commit hash
- '%h': abbreviated commit hash
- '%T': tree hash
- '%t': abbreviated tree hash
- '%P': parent hashes
- '%p': abbreviated parent hashes
- '%an': author name
@xero
xero / gitlivelog.sh
Created October 1, 2012 21:15
git graph live log
#!/bin/sh
while true;
do
clear
git log \
--graph \
--all \
--color \
--date=short \
-40 \
@xero
xero / git-ascii.sh
Created January 3, 2013 20:15
git ascii splash screen. name the file git-ascii.sh, and add it on it's own line to ~/.bashrc this will auto-run the splash screen every time your git terminal starts up.
#!/bin/sh
clear
echo -e " "
echo -e " \e[00;32m xxx "
echo -e " \e[00;32m xxx \e[01;33m welcome to GIT"
echo -e " \e[00;32m xxxxxxxxxxxxx \e[01;33m the information manager from hell"
echo -e " \e[00;32m xxxxxxxxxxxxx "
echo -e " \e[00;32m xxx "
echo -e " \e[00;32m xxx "
echo -e " \e[00;32m \e[01;37m" $(git --version)
@xero
xero / dbbackup.sh
Created January 17, 2013 20:05
this shell script will take an .sql backup file and install it to a given database. it will prompt you for username, password, database, and sql file. i set my default file location to ~/Downloads/ because that's where i always have my backups. edit as necessary.
#!/bin/sh
echo -e "\e[01;33m[username]\e[00m"
read user
echo -e "\e[01;33m[password]\e[00m"
read pass
echo -e "\e[01;33m[database]\e[00m"
read db
echo -e "\e[01;33m[sql file]\e[00m"
read file
mysql> mysql -u $user -p $pass $db < ~/Downloads/$file
@xero
xero / css-injection.html
Last active October 22, 2021 08:03
css style injection via jQuery. basically calling body/head append with a style tag and your own css will add a new tag and your styles to the bottom of the page/head and override any existing ones. why is this useful? imagine embedding a single js file into the page and defining your own styles (think widget for a client), or loading css via aj…
<!DOCTYPE html>
<html>
<head>
<title>css injection | xero.nu</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style type="text/css">
body{
font: normal 12pt "Times New Roman", serif;
background: #ccc;
color: #000066;