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 datetime | |
from collections import Counter | |
In [61]: days = [datetime.date(day=1, month=1, year = year).isoweekday() for year in range(1582,2014)] | |
In [62]: print days | |
[5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, 1, 2, 3, 5, 6, 7, 1, 3, 4, 5, 6, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 6, 7, 2, 3, 4, 5, 7, |
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 | |
# This script switches from and to apple keyboard (apple keyboard has ctrl,alt,meta layout and I want to have ctrl, meta, alt layout) | |
import subprocess | |
from gi.repository import Gio | |
SWITCH_ALT_WIN = 'altwin:swap_lalt_lwin' # kxb option to switch left win and alt, have a look in /usr/share/X11/xkb/rules/base.lst | |
gsettings = Gio.Settings.new('org.gnome.desktop.input-sources') | |
current_settings = gsettings['xkb-options'] |
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 make_groups(str){ | |
// makes an array of strings, for example aabb -> [[2,'a'], [2,'b']] | |
var boundaries = []; | |
var groups = []; | |
var current_letter = null | |
for (var i = 0, len = str.length; i < len; i++) { | |
if (str[i] !== current_letter){ | |
current_letter = str[i]; |
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
wget https://sslimgs.xkcd.com/comics/now/{00..23}h{00,15,30,45}m.png | |
convert -delay 20 -loop 0 *.png wheee.gif |
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
# -*- coding: utf-8 -*- | |
# <nbformat>3.0</nbformat> | |
# <codecell> | |
matrix=[[1,2,3,4,5], | |
[6,7,8,9,10], | |
[11,12,13,14,15], | |
[16,17,18,19,20], | |
[21,22,23,24,25] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 facebook | |
import os | |
import sh | |
from slugify import slugify | |
oauth_access_token = '' | |
root = '/debatovani.cz/albums' | |
graph = facebook.GraphAPI(oauth_access_token) |
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 datetime | |
import json | |
import time | |
import requests | |
API_KEY = '' | |
from_date = datetime.datetime(2014, 4, 4, 0, 0) | |
end_date = datetime.datetime(2014, 4, 7, 0, 0) |
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
def convert_dict_to_update(dictionary, roots=None, return_dict=None): | |
""" | |
Returns a new dict that can be used in Document.update(**dict), | |
this is used for updating MongoEngine documents with dictionary | |
serialized from json. | |
>>> data = {'email' : 'email@example.com'} | |
>>> convert_dict_to_update(data) | |
{'set__email': 'email@example.com'} |
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
map.defineObject('bl_up', { | |
'type': 'dynamic', | |
'symbol': '.', | |
'color': 'yellow', | |
'interval': 100, | |
'projectile': true, | |
'behavior': function (me) { | |
me.move('up'); | |
} | |
}); |
OlderNewer