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
OPEN=$(word 1, $(wildcard /usr/bin/xdg-open /usr/bin/open /bin/echo)) |
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
(defconst elixir--cabo-prettify-symbols-alist | |
'( | |
("->" . ?➙) ; → ➜➽➤ | |
("::" . ?∷) | |
("<-" . ?⬅) ; ← | |
("<<" . ?⟪ ) ; «≪ | |
("=>" . ?⇒) | |
(">>" . ?⟫ ) ; »≫ | |
("do" . ?⫷) |
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 "System Preferences" | |
activate | |
set the current pane to pane id "com.apple.preference.universalaccess" | |
tell application "System Events" | |
tell process "System Preferences" | |
tell window "Accessibility" | |
tell checkbox named "Use grayscale" | |
click | |
end tell | |
end tell |
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/env ruby | |
MULT = { "" => 1, | |
"B" => 1, | |
"K" => 1024, | |
"M" => 1024*1024, | |
"G" => 1024*1024*1024, | |
"T" => 1024*1024*1024*1024, | |
} | |
def hrtonum(s) |
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
# IPv6 address regular expression done right | |
# cabo@tzi.org 2010-02-11 | |
# from a NANOG thread: | |
# (corrected version of) http://gist.github.com/294476 | |
# Use the tests in that gist if you actually want to change this | |
ORIGINAL_IPV6_REGEX = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f |
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
#!/opt/local/bin/ruby1.9 | |
require 'digest/md5' | |
require 'shellwords' | |
# argument processing -- goes through Dir[], so can use '**/*' etc. | |
ARGV[0] ||= '.' | |
filenames = ARGV.map do |dirn| | |
Dir[if File.directory?(dirn) | |
"#{dirn}/*" | |
else | |
dirn |
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
#!/opt/local/bin/ruby1.9 | |
require 'zip/zipfilesystem' | |
require 'nokogiri' | |
MS_S = "http://schemas.openxmlformats.org/" | |
MS_W = MS_S + "wordprocessingml/2006/main" | |
MS_W_OD = MS_S + "officeDocument/2006/relationships/officeDocument" | |
ARGV.each do |fn| | |
Zip::ZipFile.open(fn) do |zf| |
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
# convert a filename into an array suitable for sorting | |
def filename_to_sortable(fn) | |
# convert numeric parts of the string given into actual numbers. | |
# Keep a string (third element) to disambiguate | |
fn.scan(/(\D*)(\d*)/).map{ |alpha, numeric| [alpha, numeric.to_i, numeric]} | |
end | |
# sort filenames in a "natural" way, keeping numeric parts ascending numerically | |
def sort_filenames(a) | |
a.sort_by{ |fn| filename_to_sortable(fn) } |
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
#!/opt/local/bin/ruby1.9 | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
txt = open("http://www.studentenwerk.bremen.de/files/main_info/essen/plaene/uniessen.php").read | |
txt.gsub!(/<</, "«") | |
txt.gsub!(/>>>/, ">»") | |
txt.gsub!(/>>/, "»") | |
doc = Nokogiri::HTML(txt) |
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
; Upon drag-and-drop to a frame (OSX window): Find the file in the frame, | |
; with shift: insert filename(s), space-separated; | |
; with control: insert filename(s) as lines, repeating the beginning of the line; | |
; with meta: insert file contents | |
; note that the emacs window must be activated (CMD-TAB) for the modifiers to register | |
(define-key global-map [M-ns-drag-file] 'ns-insert-file) | |
(define-key global-map [S-ns-drag-file] 'ns-insert-filename) | |
(define-key global-map [C-ns-drag-file] 'ns-insert-filename-as-lines) | |
(define-key global-map [ns-drag-file] 'ns-find-file-in-frame) |
OlderNewer