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 bash | |
(echo 'NAZWA WALUTY|PRZELICZNIK|KOD WALUTY|KURS ŚREDNI'; curl -s --compressed "http://www.nbp.pl/kursy/xml/`curl -s --compressed 'http://www.nbp.pl/kursy/xml/dir.txt' | tr -d '\r' | grep '^a' | sort -k1.6n | tail -1`.xml" | sed -e '/<\?xml.*?\?>/d' | iconv -f CP1250 | xml2 | grep -E 'nazwa_waluty|przelicznik|kod_waluty|kurs_sredni' | cut -d= -f 2- | sed -e 'N;N;N;s/\n/|/g' | sort -t '|' -k 3) | column -tx -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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import htmlentitydefs | |
import re | |
entity_re = re.compile(r'&(%s|#(\d{1,5}|[xX]([\da-fA-F]{1,4})));' % '|'.join( | |
htmlentitydefs.name2codepoint.keys())) |
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
alias xml_pretty='xmllint --format - | pygmentize -f terminal256 -l xml -O "encoding=utf-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
(echo pip; pip freeze | awk 'BEGIN{FS="=="}{print $1}') | xargs sudo pip install -U |
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 operator | |
import json | |
class JSONHEncoder(json.JSONEncoder): | |
def iterencode(self, o, *args, **kwargs): | |
if type(o) in (list, tuple) and len(o) and type(o[0]) is dict: | |
d = o[0] | |
keys = d.keys() | |
values = operator.itemgetter(*keys) |
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
INFO vagrant: `vagrant` invoked: ["up"] | |
DEBUG vagrant: Creating Vagrant environment | |
INFO environment: Environment initialized (#<Vagrant::Environment:0x1014f9988>) | |
INFO environment: - cwd: /Volumes/home/elus/Projects/archives/olympus | |
INFO environment: Home path: /Volumes/home/elus/.vagrant.d | |
DEBUG vagrant: Loading environment | |
INFO environment: Loading configuration... | |
DEBUG loader: Set :default = "/opt/local/lib/ruby/gems/1.8/gems/vagrant-0.9.2/config/default.rb" | |
DEBUG loader: Populating proc cache for "/opt/local/lib/ruby/gems/1.8/gems/vagrant-0.9.2/config/default.rb" |
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
$ time find /opt/local/share/emacs/23.4/lisp/ -type f -name \*.gz -exec zgrep --color=yes -H -n -e "conf-mode" {} \; | |
real 0m12.239s | |
user 0m7.327s | |
sys 0m6.804s | |
$ time find /opt/local/share/emacs/23.4/lisp/ -type f -name \*.gz -exec zgrep --color=yes -H -n -e "conf-mode" {} + | |
real 0m8.574s | |
user 0m4.950s | |
sys 0m5.995s |
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 <stdio.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <stdbool.h> | |
#include <math.h> | |
void die(const char *message) | |
{ | |
if (errno) { |
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
function uuid4() { | |
var r = Math.random, | |
p = "0000000", | |
n = 0x100000000, | |
a = (r() * n >>> 0).toString(16), | |
b = ((r() * n & 0xffff4fff | 0x4000) >>> 0).toString(16), | |
c = ((r() * n & 0xbfffffff | 0x80000000 ) >>> 0).toString(16), | |
d = (r() * n >>> 0).toString(16); | |
if (a.length < 8) { | |
a = (p + a).slice(-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
http://callumacrae.github.com/regex-tuesday/challenge1.html?find=%2F%5Cb(%5CS%2B)(%5Cs)(%5C1)%5Cb%2Fgi&replace=%241%242%3Cstrong%3E%243%3C%2Fstrong%3E | |
# TODO: complete hsl(a) | |
http://callumacrae.github.com/regex-tuesday/challenge2.html?find=%2F%5E(%3F%3A%23(%5B%5Cda-f%5D%7B1%2C2%7D)%5C1%5C1%7Crgb%5C(%5Cs*0*%3F(%5Cd%2B(%3F%3A%5C.%5Cd%2B)%3F%25%3F)%2C%5Cs*0*%5C2%2C%5Cs*0*%5C2%5Cs*%5C)%7Crgba%5C(%5Cs*0*%3F(%5Cd%2B(%3F%3A%5C.%5Cd%2B)%3F)%2C%5Cs*0*%5C3%2C%5Cs*0*%5C3%5C%2C%5Cs*%5C0*(%3F%3A0(%3F%3A%5C.%5Cd%2B)%3F%7C1)%5Cs*%5C)%7Crgba%5C(%5Cs*0*%3F(%5Cd%2B%25)%2C%5Cs*0*%5C4%2C%5Cs*0*%5C4%5C%2C%5Cs*%5C0*(%5Cd%2B%25)%5Cs*%5C))%24%2Fi | |
http://callumacrae.github.com/regex-tuesday/challenge3.html?find=%2F%5E(1%5Cd%7B3%7D%7C20(0%5Cd%7C1%5B0-2%5D))%5C%2F(0%5B1-9%5D%7C1%5B0-2%5D)%5C%2F(0%5B1-9%5D%7C%5B12%5D%5Cd%7C30)%20(%5B01%5D%5Cd%7C2%5B0-3%5D)(%3A%5B0-5%5D%5Cd)%7B1%2C2%7D%24%2F |
OlderNewer