Skip to content

Instantly share code, notes, and snippets.

View Visgean's full-sized avatar

martin Visgean

View GitHub Profile
#!/usr/bin/python
# -*- coding: utf-8 -*-
ERROR_CODES = {
11607: {'long': 'A successful transaction has already been completed for this token.',
'short': 'Duplicate Request'},
12302: {'long': 'This transaction already has a PayPal dispute filed',
'short': 'Dispute Refund Not Allowed'},
81243: {'long': 'RefundType : Invalid parameter',
map.defineObject('bl_up', {
'type': 'dynamic',
'symbol': '.',
'color': 'yellow',
'interval': 100,
'projectile': true,
'behavior': function (me) {
me.move('up');
}
});
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'}
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)
@Visgean
Visgean / wall_scrap.py
Created May 15, 2014 22:07
Scrapping stories from Facebook wall
API_RECURSION_LIMIT = 5
def get_stories(object_id):
token = facebook.get_app_access_token(APP_ID, APP_SECRET)
graph = facebook.GraphAPI(token)
def get_interesting_stories(until=None, since=None, recursion_level=0):
"""Recursive function that digs all the interesting stories till the recursion level is reached"""
api_parameters = {
'id': '{page_id}/feed'.format(page_id=object_id),
@Visgean
Visgean / download_images.py
Created April 24, 2014 15:04
Download all the sweet debatovani.cz photos.
import facebook
import os
import sh
from slugify import slugify
oauth_access_token = ''
root = '/debatovani.cz/albums'
graph = facebook.GraphAPI(oauth_access_token)
gsettings set org.gnome.desktop.background picture-uri file:///home/visgean/.trianglify_background.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- 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]
wget https://sslimgs.xkcd.com/comics/now/{00..23}h{00,15,30,45}m.png
convert -delay 20 -loop 0 *.png wheee.gif