Skip to content

Instantly share code, notes, and snippets.

@lotsofcode
lotsofcode / spider-seperated-urls.sh
Created September 26, 2011 15:49
Spider response header for comma separated urls
#!/bin/bash
THEROOTURL="http://www.domain.com"
THEPATHS="foo,bar,rar.htm,car.txt"
IFS=","
for THEPATH in $THEPATHS; do
echo "------------------------------------------------------------";
echo "$THEROOTURL/$THEPATH";
wget $THEROOTURL/$THEPATH --spider 2>&1 | grep "HTTP"
#!/bin/bash
hash make 2>&- || { echo >&2 "I require make but it's not installed. Aborting."; exit 1; }
hash autoreconf 2>&- || { echo >&2 "I require aureconf but it's not installed. Aborting."; exit 1; }
hash unzip 2>&- || { echo >&2 "I require unzip but it's not installed. Aborting."; exit 1; }
hash svn 2>&- || { echo >&2 "I require svn but it's not installed. Aborting."; exit 1; }
function errorcheck(){
if [ "$?" -gt 0 ]; then
@lotsofcode
lotsofcode / .bashrc
Created December 13, 2011 20:10 — forked from endtwist/.bashrc
Bash config
PS1="\[\e[0:32m\]\w \[\e[0;39m\]\$ "
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
PS1="\[\e[0:32m\]\w"'$(__git_ps1 " \[\e[1;30m\](%s)")'"\[\e[0;39m\]\$ "
fi
export CLICOLOR=1
export ll='ls -al'
@lotsofcode
lotsofcode / check-scrollbar-scrolled.jquery.js
Created January 11, 2012 12:54
jquery plugin: check if a scrollbar has been scrolled 50% of overall height
$.fn.scrollCheck = function(options) {
var has_read_textarea = false;
textarea = $(this);
textarea.scroll(function() {
if ((textarea.scrollTop() + textarea.height()) >= (textarea[0].scrollHeight/2)) {
has_read_textarea = true;
}
});
var textarea_timeout = window.setInterval(function() {
if (has_read_textarea !== false) {
@lotsofcode
lotsofcode / .git_ps1
Created February 14, 2012 17:51
Git ps1
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE:
@lotsofcode
lotsofcode / hack.sh
Created March 31, 2012 11:28 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@lotsofcode
lotsofcode / gist:2293887
Created April 3, 2012 17:26
Find unique commits by author
git log --pretty=format:'%s' --author=Luke | grep -v "Merge branch" | sort -u
@lotsofcode
lotsofcode / concat.sql
Created April 3, 2012 20:26
mysql commands
SELECT CONCAT('Mr. ', forename, ' ', surname, ' - ', jobTitle) FROM table;
@lotsofcode
lotsofcode / .gitconfig
Created April 5, 2012 12:19
Git config file
# @use --global flag to assign to home ~/.gitconfig instead of local ~/.git/config file
# For example
# Disable filemode changes.
# $ git config core.filemode false
# Disable filemode changes globally.
# $ git config --global core.filemode false
@lotsofcode
lotsofcode / gist:2344460
Created April 9, 2012 16:06
Simple copying and replacing and outputting to a new file
sed 's/STRING_1/STRING_2/' input.file >> output.file