Skip to content

Instantly share code, notes, and snippets.

View mrpollo's full-sized avatar
Journey before destination

Ramon Roche mrpollo

Journey before destination
View GitHub Profile
@mrpollo
mrpollo / Javascript GeoLocation
Created March 14, 2012 19:44
Get the coordinates of your geolocation coordinates
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
console.log(position);
}, function (msg) {
console.log(arguments);
});
} else {
console.log('not supported');
}
@mrpollo
mrpollo / Haskell problems installing devil
Created April 14, 2012 00:27
problems installing codec image devil for haskell
rroche at Ramon-Roches-MacBook-Pro in /usr/local on master*
$ cabal install codec-image-devil -v
Reading available packages...
Resolving dependencies...
In order, the following would be installed:
Codec-Image-DevIL-0.2.3 (new package)
Extracting
/Users/rroche/.cabal/packages/hackage.haskell.org/Codec-Image-DevIL/0.2.3/Codec-Image-DevIL-0.2.3.tar.gz
to
/var/folders/bc/y8v6nssd4gvct81rjlr2_2d80000gn/T/Codec-Image-DevIL-0.2.36673...
var pxy = Proxy.create({get: function(receiver, name){
return name.split("").reverse().join("");
}});
verify(pxy);
@mrpollo
mrpollo / python unicode helpers
Created May 9, 2012 22:44
python unicode helpers
def smart_unicode(s, encoding='utf-8', errors='strict'):
if type(s) in (unicode, int, long, float, types.NoneType):
return unicode(s)
elif type(s) is str or hasattr(s, '__unicode__'):
return unicode(s, encoding, errors)
else:
return unicode(str(s), encoding, errors)
def smart_str(s, encoding='utf-8', errors='strict', from_encoding='utf-8'):
if type(s) in (int, long, float, types.NoneType):
@mrpollo
mrpollo / UnicodeError
Created May 10, 2012 16:29
python unicode from latin charmap UnicodeError
Teresa de Jesús Galicia Gómez
Teresa de Jesús Galicia Gómez
EMMANUEL PEÑA GOMEZ PORTUGAL
Traceback (most recent call last):
File "regex.py", line 12, in <module>
print b.encode('cp1252').decode('utf-8').encode('cp1252').decode('utf-8')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/cp1252.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode character u'\x91' in position 12: character maps to <undefined>
@mrpollo
mrpollo / brew install proctools fail
Created September 4, 2012 06:49
brew install -v proctools 2>&1 | pbcopy
==> Downloading http://downloads.sourceforge.net/project/proctools/proctools/0.4pre1/proctools-0.4pre1.tar.gz
Already downloaded: /Library/Caches/Homebrew/proctools-0.4pre1.tar.gz
/usr/bin/tar xf /Library/Caches/Homebrew/proctools-0.4pre1.tar.gz
==> Downloading patches
/usr/bin/curl -qf#LA Homebrew 0.9.3 (Ruby 1.8.7-357; Mac OS X 10.7.4) https://trac.macports.org/export/89276/trunk/dports/sysutils/proctools/files/patch-pfind-Makefile.diff -o 000-homebrew.diff https://trac.macports.org/export/89276/trunk/dports/sysutils/proctools/files/patch-pfind-pfind.c.diff -o 001-homebrew.diff https://trac.macports.org/export/89276/trunk/dports/sysutils/proctools/files/patch-pgrep-Makefile.diff -o 002-homebrew.diff https://trac.macports.org/export/89276/trunk/dports/sysutils/proctools/files/patch-pkill-Makefile.diff -o 003-homebrew.diff https://trac.macports.org/export/89276/trunk/dports/sysutils/proctools/files/patch-proctools-fmt.c.diff -o 004-homebrew.diff https://trac.macports.org/export/89276/trunk/dports/sysutils/pro
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libntfs-3g.80.dylib /usr/local/lib/libntfs.9.0.0.dylib /usr/local/lib/libublio.1.dylib
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
HOMEBREW_VERSION: 0.9.3
HEAD: 25aa338cc7769fb03196197f7e9eb02f59ad6b80
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.7.4-x86_64
Xcode: 4.4.1
CLT: 1.0.0.9000000000.1.1249367152
GCC-4.0: N/A
GCC-4.2: build 5666
$ mplayer http://dboonstra5.bulkget.cshls.lldns.net/bulkget/dboonstra5/dboonstra5.m3u8
MPlayer UNKNOWN-4.2.1 (C) 2000-2012 MPlayer Team
Playing http://dboonstra5.bulkget.cshls.lldns.net/bulkget/dboonstra5/dboonstra5.m3u8.
Resolving dboonstra5.bulkget.cshls.lldns.net for AF_INET6...
Couldn't resolve name for AF_INET6: dboonstra5.bulkget.cshls.lldns.net
Resolving dboonstra5.bulkget.cshls.lldns.net for AF_INET...
Connecting to server dboonstra5.bulkget.cshls.lldns.net[68.142.79.69]: 80...
@mrpollo
mrpollo / HTML5 Converter
Created September 26, 2012 21:16
Convert to video HTML5
#!/bin/bash
ffmpeg=/usr/local/bin/ffmpeg
for f in *.mp4
do
echo "Converting $f into webm"
$ffmpeg -i "$f" -b 1500k -vcodec libvpx -acodec libvorbis -ab 55000 -f webm -g 30 -s 1280x720 "$f".webm
echo "Converting $f into ogv"
$ffmpeg -i "$f" -b 1500k -vcodec libtheora -acodec libvorbis -ab 55000 -g 30 -s 1280x720 "$f".ogv
echo "Converting $f into mp4"
$ffmpeg -i "$f" -b 1500k -vcodec libx264 -vpre slow -vpre baseline -g 30 -s 1280x720 "$f".1280_720.mp4