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 | |
OPENSSL_VERSION="1.0.1g" | |
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz | |
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz | |
mv openssl-$OPENSSL_VERSION openssl_i386 | |
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz | |
mv openssl-$OPENSSL_VERSION openssl_x86_64 | |
cd openssl_i386 |
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
# only ask for my SSH key passphrase once! | |
# use existing ssh-agent if possible | |
if [ -f ${HOME}/.ssh-agent ]; then | |
. ${HOME}/.ssh-agent > /dev/null | |
fi | |
if [ -z "$SSH_AGENT_PID" -o -z "`/usr/bin/ps -a|/usr/bin/egrep \"^[ ]+$SSH_AGENT_PID\"`" ]; then | |
/usr/bin/ssh-agent > ${HOME}/.ssh-agent | |
. ${HOME}/.ssh-agent > /dev/null | |
fi |
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
!macro ProcessEnvPrependPath UN | |
;; ref: http://stackoverflow.com/a/32384667/1292238 | |
!ifndef ERROR_ENVVAR_NOT_FOUND | |
!define ERROR_ENVVAR_NOT_FOUND 203 | |
!endif | |
!if "${NSIS_PTR_SIZE}" <= 4 | |
!include LogicLib.nsh | |
Function ${UN}ProcessEnvPrependPath ; IN:Path OUT:N/A | |
System::Store S | |
Pop $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
!macro ProcessEnvPrependPath UN | |
;; ref: http://stackoverflow.com/a/32384667/1292238 | |
!ifndef ERROR_ENVVAR_NOT_FOUND | |
!define ERROR_ENVVAR_NOT_FOUND 203 | |
!endif | |
!if "${NSIS_PTR_SIZE}" <= 4 | |
!include LogicLib.nsh | |
Function ${UN}ProcessEnvPrependPath ; IN:Path OUT:N/A | |
System::Store S | |
Pop $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/sh | |
# Replace more than one consecutive spaces with tab in files on both Linux and Mac OS X. | |
# You need to install gnu-sed on Mac OS X for this to work. | |
# Usage: spaces2tab.sh [file ...] | |
# See also: http://azaleasays.com/2014/03/07/os-x-sed-does-not-recognize-tab-character/ | |
if [ "$(uname -s)" == "Darwin" ] # If the system is Mac OS X | |
then |
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 | |
column= type= infile= outfile= | |
while getopts c:i:o: opt; do | |
case $opt in | |
c) | |
column=$OPTARG | |
;; | |
i) | |
infile=$OPTARG |
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
;; Requisites: Emacs >= 24 | |
;; INSTALL PACKAGES | |
;; -------------------------------------- | |
(prefer-coding-system 'utf-8) | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) | |
(package-initialize) |
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 collections | |
def dfs(G, s, path=[]): | |
global explored | |
explored.add(s) | |
path.append(s) | |
for v in G[s]: | |
if v not in path: | |
path = dfs(G, v, path) | |
return path |
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
def sieveEratosthenes(limit): | |
'''Return all primes below the limit''' | |
numbers = range(3,limit,2) | |
primes = [2] | |
while True: | |
prime = numbers.pop(0) | |
primes.append(prime) | |
for n in range(prime**2, limit, 2*prime): | |
try: | |
numbers.remove(n) |
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/python | |
import sys | |
def fac(n): | |
'''n!''' | |
if n==0 or n==1: | |
return 1 | |
else: | |
return n*fac(n-1) |
NewerOlder