Skip to content

Instantly share code, notes, and snippets.

View lukmdo's full-sized avatar
:octocat:
loading...

Lukasz Dobrzanski lukmdo

:octocat:
loading...
View GitHub Profile
@lukmdo
lukmdo / apple shortcuts.md
Created December 6, 2012 17:07
apple shortcuts
Spaces = ```Fn + F8```
Screenshots
-----------
* the whole screen, press ```⌘-⇧-3```
* part of the screen, press ```⌘-⇧-4``` and select the area you want
* to the Clipboard instead of saving as a file press:
* ```^-⌘-⇧-3``` to copy the entire screen
* ```^-⌘-⇧-4``` to copy the selected area
* for curent window, press ```⌘-⇧-4``` then ```Spacebar```
@lukmdo
lukmdo / asciify.py
Created November 14, 2012 15:42
Convert unicode to ASCII
#!/usr/bin/python3
"""
>>> some_unicode = u'èṽèṙẏbody ♥ utf8'
>>>
>>> some_unicode.encode('ascii', errors='replace')
b'?????body ? utf8'
>>>
>>> import unicodedata
>>> unicodedata.normalize('NFKD', some_unicode).encode(
@lukmdo
lukmdo / gist:3882501
Created October 13, 2012 00:18
apple keyboard keys
@lukmdo
lukmdo / gist:3844575
Created October 6, 2012 10:35
erlang rpc
[{N, rpc:call(N, os, cmd, ['date'])} || N <- nodes()].
@lukmdo
lukmdo / gist:3327354
Created August 11, 2012 21:10
timeit.timeit for python2.5
import timeit
try:
timeit.timeit
except AttributeError:
# adding "Convenience function..." from py >= 2.7
timeit.timeit = lambda stmt="pass", setup="pass", timer=timeit.default_timer, number=timeit.default_number: \
timeit.Timer(stmt, setup, timer).timeit(number)
$.fn.persistantPopover = function() {
var popoverTimeout;
function delay() {
popoverTimeout = setTimeout(function() {
$('.popover').hide();
}, 100);
}
return this.each(function() {
@lukmdo
lukmdo / siteUptimeMonitor.js
Created July 29, 2012 12:09
google apps script=js
var ONE_S = 1000,
ONE_M = 60*ONE_S,
ONE_H = 60*ONE_M,
RUN_EVERY = 5*ONE_M,
SLEEP_TIME = 30*ONE_M,
CHECK_URL = 'http://www.SITE.com',
NOTIFY_MAIL = '[email protected]',
NOTIFY_CALENDAR = '[email protected]';
@lukmdo
lukmdo / catc.sh
Created July 14, 2012 19:16
show \t \n \r in file but as-is (kinda hexdump -c)
hexdump -v -e '"%_c"' FILE_PATH | gsed -e 's/\\n/\\n\n/g'
@lukmdo
lukmdo / gist:2989438
Created June 25, 2012 16:00
django template 0.96 fime formatter (bet curent does it straight away)
{% ifequal today eachData.modification_timestamp.date %}
{{ eachData.modification_timestamp|date:"P" }}
{% else %}
{{ eachData.modification_timestamp|date:"jS F P" }}
{% endifequal %}