Skip to content

Instantly share code, notes, and snippets.

View milkypostman's full-sized avatar
🏠
zzz

Donald Curtis milkypostman

🏠
zzz
View GitHub Profile
@milkypostman
milkypostman / csv2txt
Created December 17, 2010 18:21
Converter for CSV files to output them as text.
#!/usr/bin/python
"""
Simple converter for CSV files. There are two builtin pre-defined formats.
Usage: csv2txt [options]
Options:
-h, --help show this help message and exit
-c COLS Columns to print (given in the order to be printed)
@milkypostman
milkypostman / OSX Enabled 'cd'
Created December 29, 2010 17:51
Functions to include in .profile to enable OSX style aliases in the terminal.
function resolvealias {
echo $(osascript << EOS
tell application "Finder"
set theItem to (POSIX file "${1}") as alias
if the kind of theItem is "alias" then
get the posix path of ((original item of theItem) as text)
end if
end tell
EOS
)
cabbrev cd <C-R>=getcmdpos()==1 && getcmdtype()==":" ? feedkeys("FufDir<c-v><cr>") : "cd "<CR>
##
# put this in ~/Library/Scripts and launchbar should find it.
#
#
do shell script "/System/Library/PrivateFrameworks/DotMacSyncManager.framework/Versions/Current/Resources/dotmacsyncclient --sync &> /dev/null &"
@milkypostman
milkypostman / el-get bug
Created March 27, 2011 22:06
Bug with el-get
Debugger entered--Lisp error: (void-variable el-get-cvs)
symbol-value(el-get-cvs)
(let ((command (symbol-value vname))) (unless (and (file-exists-p command) (file-executable-p command)) (error (concat "The variable `%s' points to \"%s\", " "which is not an executable file name on your system.") name command)) command)
(cond ((fboundp fname) (funcall fname)) ((bound-and-true-p vname) (let ((command (symbol-value vname))) (unless (and (file-exists-p command) (file-executable-p command)) (error (concat "The variable `%s' points to \"%s\", " "which is not an executable file name on your system.") name command)) command)) (t (let ((command (executable-find name))) (unless command (error "The command named '%s' can not be found with `executable-find'" name)) command)))
(let ((fname (intern (format "el-get-%s-executable" name))) (vname (intern (format "el-get-%s" name)))) (cond ((fboundp fname) (funcall fname)) ((bound-and-true-p vname) (let ((command (symbol-value vname))) (unless (and (file-exists-p comman
filth :: Integer -> Bool
filth i = (==) 0 (mod i 200000000)
main = mapM_ putStrLn (map show (filter filth [1..2000000000]))
(defn good [n i]
(= 0 (mod i (/ n 10))))
(defn lots [n]
(filter (partial good n) (range n)))
(defn lots2 [n]
(let [ndenom (int (/ n 10))]
(filter #(zero? (mod % ndenom)) (range n)))
)
(dorun (map println (lots2 2000000000)))
printElements :: [String] -> IO()
printElements [] = return ()
printElements (x:xs) = do putStrLn x
printElements xs
filth :: Integer -> Bool
filth i = (==) 0 (mod i 200000000)
public class Perc {
public static void main(String[] args) {
int m = 2000000000;
int blah = m / 10;
for (int i = 0; i < m; i++) {
if (i % blah == 0) {
System.out.printf("%d: %f %%\n", i, i/((float)m)*100);
}
}