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
tar zcvf web_bkup_`date +%d%m%y_%H%M`.tar.gz web/* |
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
' Print out everything in request.form | |
for each item in request.Form | |
response.Write item & ": '" & request.Form(item) & "'<br>" | |
next | |
response.flush | |
'--------------------------------------------------------------------------------- | |
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
---- Enable Ad hoc Queries ---- | |
sp_configure 'show advanced options', 1 | |
reconfigure | |
sp_configure 'Ad Hoc Distributed Queries', 1 | |
reconfigure | |
-------------------- DATE RELATED -------------------- | |
---- Replace GETDATE() with your fieldname if needed. |
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
# Benchmarks for popping from a list | |
# If you want to always pop the first element of a list, then don't use pop(0) | |
# Instead reverse the list once and use pop. | |
python -m timeit "a=range(1000000)" "a.reverse()" "while a: a.pop()" | |
python -m timeit "a=range(1000000)" "while a: a.pop(0)" |
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
pstops 1:-0 input_file.ps output_file.ps |
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
int **int_matrix_alloc(int n, int m){ | |
int *a, **aa, i; | |
a = (int *)calloc(n * m, sizeof(int)); | |
aa = (int **)calloc(n, sizeof(int *)); | |
for(i=0;i<n;i++){ | |
aa[i] = &a[i * m]; | |
} | |
return aa; | |
} |
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 random | |
def compare_with_ties(a, b): | |
diff = cmp(a, b) | |
return diff if diff else random.choice([-1, 1]) | |
a = {'a': 1, 'b': 2, 'c': 1, 'd': 2, 'e': 1} | |
print "Initial dictionary:\n", str(a.items()) |
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
tell application "BBEdit" | |
tell window 1 | |
set currentLine to endLine of selection | |
set nextLine to currentLine + 1 | |
-- Delete starting after the last non-whitespace character in the current line | |
set findDeleteStart to find "\\s*$" options {search mode:grep} ¬ | |
searching in line currentLine | |
if found of findDeleteStart then | |
set firstCharacter to characterOffset of found object of findDeleteStart |
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
from multiprocessing import Pool, cpu_count | |
import random | |
import time | |
import sys | |
import os | |
import re | |
MEMINFO = "/proc/meminfo" |
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
# Benchmarking two methods of computing nCr. | |
# ncr1(1000, 5) 2.25343108177 | |
# ncr2(1000, 5) 2.01950907707 | |
# ncr1(1000, 500) 2.98434901237 | |
# ncr2(1000, 500) 3.22741794586 | |
# ncr1(1000000, 10) 3.69585800171 | |
# ncr2(1000000, 10) 4.68463897705 |
OlderNewer