Skip to content

Instantly share code, notes, and snippets.

View gist:435950
# colors for ls, etc.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/'
}
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\u@\h \[\033[01;34m\]\w\[\033[01;35m\]$(parse_git_branch)\[\033[01;34m\] \$ \[\033[00m\]'
else
PS1='\[\033[01;37m\]\w\[\033[00;35m\]$(parse_git_branch)\[\033[00m\] \$ '
fi
View remove_surrounding_p_tag.js
function remove_surrounding_p_tag(s) {
//converts '<p>xyz</p>' to 'xyz', good for showdown
return s.replace(/^<p>|<\/p>$/g,"");
}
View reset.css
html,body,div,span,
applet,object,iframe,
h1,h2,h3,h4,h5,h6,p,blockquote,pre,
a,abbr,acronym,address,big,cite,code,
del,dfn,em,font,img,ins,kbd,q,s,samp,
small,strike,strong,sub,sup,tt,var,
dd,dl,dt,li,ol,ul,
fieldset,form,label,legend,
table,caption,tbody,tfoot,thead,tr,th,td {
margin: 0;
View installing connect on ubuntu 10.04 (after installing node with nvm)
$ cd
$ git clone http://github.com/senchalabs/connect.git
$ cd connect/
$ sudo make install
cp -f docs/index.1 /usr/local/share/man/man1/connect.1
cp: cannot create regular file `/usr/local/share/man/man1/connect.1': No such file or directory
make: *** [install-docs] Error 1
$ sudo mkdir -p /usr/local/share/man/man1/
$ sudo make install
cp -f docs/index.1 /usr/local/share/man/man1/connect.1
View startup.sh
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
View test disk performance
#!/bin/bash
echo testing write performance
sync; date; time dd if=/dev/zero of=1000m bs=1024k count=5000; date
echo testing read performance
sync; date; time dd if=1000m of=/dev/null bs=1024k; date
rm 1000m
View example.sh
#! /bin/sh
# Script to provide answer for question:
# http://stackoverflow.com/questions/5149872/how-to-git-remote-add-and-track-a-branch-in-the-same-filesystem
echo create origin
mkdir origin
cd origin/
git init --bare
cd ..
@miebach
miebach / tree
Created Mar 31, 2011
Unix Tree / Linux Tree by Dem Pilafian - http://www.centerkey.com/tree/
View tree
#!/bin/sh
# Unix Tree / Linux Tree by Dem Pilafian
# http://www.centerkey.com/tree/
# mirrored on https://gist.github.com/896397
#######################################################
# UNIX TREE #
# Version: 2.3 #
# File: ~/apps/tree/tree.sh #
# #
# Displays Structure of Directory Hierarchy #
@miebach
miebach / README
Created Jul 2, 2011
"cygwin here" registry patch, CygwinHere0.1.3 see http://software.ellerton.net/cygwin/
View README
Note: Use the first reg-file if the cygwin dir is c:\ and the other on if cygwin is installed to c:\cygwin\ - otherwise adjust the path in the file.
See also https://gist.github.com/1641943 for unattended cygwin update and package install
----
README
NAME:
Cygwin Here