This file contains hidden or 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 | |
username= | |
curl -s https://api.github.com/users/$username/repos | jq -r '.[].git_url' | while read git_url | |
do | |
repo_name=$(basename $git_url .git) | |
echo Backing up $repo_name | |
git clone -q $git_url 2> /dev/null || ( | |
cd $repo_name |
This file contains hidden or 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 - | |
PROGRAM="${0##*/}" | |
IFS="." | |
for i in $(cat /proc/uptime) | |
do | |
UPTIME=$i | |
break | |
done |
This file contains hidden or 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
proc x {} { set y "x" } | |
# let's try it... | |
# | |
# % x | |
# x | |
# % [x] | |
# x | |
# % [[x]] | |
# x |
This file contains hidden or 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
# | |
# approximate the value of e using the power series expansion (with GUI) | |
# | |
# see http://www.tkdocs.com/tutorial/firstexample.html | |
# | |
package require Tk | |
This file contains hidden or 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
# | |
# convert an integer to its Gray-code representation | |
# | |
Add-Type -TypeDefinition @' | |
public class shift { | |
public static int lshift(int x, int count) { return x << count; } | |
public static int rshift(int x, int count) { return x >> count; } | |
} | |
'@ |
This file contains hidden or 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
-- | |
-- delete rows in tranches | |
-- | |
-- inspired by the discussion at http://kr.forums.oracle.com/forums/thread.jspa?threadID=365130 | |
-- | |
set serveroutput on | |
DECLARE | |
ln_DelSize NUMBER := 500; |
This file contains hidden or 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
(* factorial *) | |
(* my first Standard ML ``program'' *) | |
(* see the excellent tutorial at *) | |
(* http://www.soc.napier.ac.uk/course-notes/sml/manual.html *) | |
fun factorial(1) = 1 | |
| factorial(n) = n * factorial(n-1); |
This file contains hidden or 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 std.stdio; | |
ulong | |
factorial(int n) | |
{ | |
if(n < 2) | |
return 1; | |
else | |
return n * factorial(n - 1); | |
} |
This file contains hidden or 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
/* | |
* a naive implementation of Insertion Sort in C. | |
*/ | |
void | |
insertion_sort(int *array, int array_len) | |
{ | |
int i; | |
for (i = 1; i < array_len; i++) { |
This file contains hidden or 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
; | |
; Tail-recursive factorial in Scheme. | |
; | |
(define (factorial n) | |
(if (= n 1) | |
1 | |
(* n (factorial(- n 1))))) |