Skip to content

Instantly share code, notes, and snippets.

@ruthenium
ruthenium / mkicns.sh
Created February 2, 2016 01:39 — forked from dardo82/mkicns.sh
Make ICNS from PNG
#!/bin/zsh
#mkicns.sh
FN=${1##*/}
DN=${1%/**}
BN=${FN%.*}
IS=iconset
ID=$BN.$IS
@ruthenium
ruthenium / README.md
Created May 6, 2016 22:51 — forked from magnetikonline/README.md
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@ruthenium
ruthenium / 2007_07_25-djvu2pdf.sh
Created May 10, 2016 19:40 — forked from yakovsh/2007_07_25-djvu2pdf.sh
Converting from DJVU to PDF
#!/bin/sh
#
# Here is the software that is needed for the conversion to take place:
# 1. DjVuLibre .
# 2. LibTiff .
#
# NOTE: The ddjvu utility has an option to convert specific layers. One common mistake is to convert only the mask layer
# or the foreground layer . Technically speaking, the mask layer is the one that should have the actual text but in
# practice I have seen that the the DjVu encoder occasionally puts portions of the text in the background layer. Thus,
# if you only take the foreground or mask layers, you will lose those bits in the background. If your specific files
@ruthenium
ruthenium / gist:f31b46c454dd3d7d6dfcbd1262002590
Created August 16, 2016 15:25 — forked from shirshir/gist:8400570
Recursive .zip excluding .git and .DS_Store
zip -r files.zip ./directory -x "*.git*" -x "*.DS_Store"
@ruthenium
ruthenium / comand.txt
Created August 16, 2016 15:26 — forked from davidperezgar/comand.txt
remove .DS_Store from zip in Mac
zip -d archive.zip "*/*.DS_Store"
@ruthenium
ruthenium / extensionize.sh
Created August 16, 2016 15:26 — forked from Tanner/extensionize.sh
Creates a zip file without .git, .gitignore, or .DS_Store
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: ${0} directory"
exit 1
fi
if [ -d ${1} ]; then
DIR_NAME=$(basename ${1})
@ruthenium
ruthenium / gist:64c0df5234ac0425215f19d88167cff6
Created August 16, 2016 15:26 — forked from StephenPunwasi/gist:95cd8d77b0a1a956b07cda99ef098af6
Exclude OS X .DS_Store and Git files when zipping.
zip -r [filename.zip] [foldername] -x "*.DS_Store" -x *.git*
@ruthenium
ruthenium / gist:4bbb2610606b8678830c5d4aa776b5f7
Last active August 28, 2016 15:11 — forked from ninux/gist:5713741
Merge PDFs with Ghostscript
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf
# found at https://bbs.archlinux.org/viewtopic.php?id=65036
# some automation (merge all in current directory):
find . -type f -print0 | xargs -0 gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="/path/finished.pdf"
@ruthenium
ruthenium / find and xargs
Created August 28, 2016 22:46 — forked from denitram/find and xargs
find & xargs
# Find tutorial;
# http://www.grymoire.com/Unix/Find.html
# find files modified less than 5 days ago
$ find . -type f -mtime -5 -print | xargs ls -l
# find files (with spaces in name) modified less than 5 days ago
$ find . -type f -mtime -5 -print0 | xargs -0 ls -l
# find & remove directories older than 200 days
@ruthenium
ruthenium / Hopfield-mini.hs
Created September 5, 2016 20:52 — forked from nh2/Hopfield-mini.hs
Hopfield networks - minimal Haskell implementation
import Data.Vector ((!))
import qualified Data.Vector as V
import Data.Vector.Generic.Mutable (write)
step ws state = case updatable of [] -> state
(i,_):_ -> V.modify (\v -> write v i (o i)) state
where
n = V.length state
w i j = ws ! i ! j