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/php | |
<?php | |
// make sure that they are in a shell | |
if (empty($_SERVER['SHELL'])) { | |
die('Shells only please'); | |
} | |
$configFile = $_SERVER['HOME'] . '/.clockd'; | |
main($argv); |
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 <Foundation/Foundation.h> | |
#import <CommonCrypto/CommonDigest.h> | |
#define kDefaultHashBufferSize 0x1000 | |
@class FileHasher; | |
typedef void (^FileHasherCallback) (FileHasher * hasher, | |
BOOL finished, | |
NSUInteger bytesCompleted); |
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 | |
# | |
# Quickly get a PID for a given process name. | |
# | |
if [ $# -lt 1 ]; then | |
echo 'Usage: pidof <command name>' >&2 | |
exit 1 | |
fi | |
lines=`ps aux -c | grep "$1" | sed -e 's/^[^0-9]*\([0-9]*\).*/\1/g'` |
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
printf "Enter initial balance: " | |
balance=gets.chomp.to_f | |
printf "Enter interest %%: " | |
interest=gets.chomp.to_f | |
printf "Enter weekly income: " | |
weekly=gets.chomp.to_f | |
printf "Enter number of weeks[10]: " | |
weeksStr=gets.chomp | |
weeks=0 | |
if weeksStr == '' |
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 | |
# | |
# Simply pass in your plex library database file and have some fun! | |
# NOTE: your DB file is probably called "com.plexapp.plugins.library.db" | |
# | |
if [ $# != 1 ]; then | |
echo "plexdblist - lists the media items in a plex DB file." | |
echo "Usage: plexdblist <database>" | |
exit 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
module BinaryPile ( | |
binarySplit | |
) where | |
import Data.List | |
sortClosest :: (Num a, Ord a) => a -> [a] -> [a] | |
sortClosest _ [] = [] | |
sortClosest x (y:ys) = (sortClosest x closer) ++ [y] ++ (sortClosest x farther) | |
where diff = abs $ y - x |
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
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
const struct { | |
long long real; | |
long long imag; | |
} factors[] = { | |
{1, 0}, | |
{-1, 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
%{ | |
Solves the following problem: | |
Eight people are seated at a circular table. Each person gets up and sits | |
down again - either in the same chair or in the chair immediately to the | |
left or right of the one they were in. How many different ways can the | |
eight people be reseated? | |
%} | |
function count = possibilityCount(positions, index) | |
if index > 8 |
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 Data.Maybe | |
data FunctionParameters = FunctionParameters [Int] deriving (Show) | |
main :: IO () | |
main = do | |
let params = allFunctionParameters [] | |
putStrLn $ show $ workingParams params 0 | |
workingParams :: [FunctionParameters] -> Integer -> (Maybe FunctionParameters, Integer) |
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
/** | |
* This program makes it easy to compute (in exponential time) | |
* what the odds are that you will either roll 10 heads or | |
* 10 of the same (but possibly tails) face in a row after n rolls. | |
*/ | |
function BinDist(fn) { | |
this.fn = fn; | |
} |