Skip to content

Instantly share code, notes, and snippets.

View ydm's full-sized avatar

Йордан Миладинов ydm

  • Sofia, Bulgaria
View GitHub Profile
@ydm
ydm / looper.py
Last active August 29, 2015 14:05
PyQt4 + UI Looper
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import Queue
import functools
import itertools
import sys
import threading
import time
@ydm
ydm / south2django17.bash
Last active August 29, 2015 14:07
Automates the process of converting south applications to Django 1.7. Use at your own risk
#!/bin/bash
# Usage:
# south2django17 PROJECT_ROOT_WHERE_ALL_THE_APPS_ARE
# This script will:
# 1. Backup all South migration files to /tmp
# 2. Delete these files
# 3. Run manage.py makemigrations
# 4. Run manage.py migrate
# http://is.gd/fbtuPF
@ydm
ydm / proxy.lua
Last active August 29, 2015 14:12
Proxy object that wraps another object and delegates everything
local Proxy = {}
function Proxy:new(wrapped)
local instance = { __wrapped = wrapped }
setmetatable(instance, self)
return instance
end
function Proxy.__index(instance, attrname)
local attr = instance.__wrapped[attrname]
@ydm
ydm / trycatch.cpp
Created March 16, 2015 16:34
Try / catch always creates copy of thrown object
#include <cstdint>
#include <functional>
#include <iostream>
#include <map>
#include <string>
class Humanizator
{
public:
#include <functional>
#include <iostream>
#include <typeinfo>
using namespace std;
class Fuck
{
public:
Fuck() {}
//
// Append element to the end of array.
//
proc append(string $ary[], string $elem)
{
$ary[size($ary)] = $elem;
}
//
@ydm
ydm / cocos2dx_android_mk.py
Created September 5, 2015 17:30
Prepares Android.mk for building a cocos2d-x application. Script should be placed inside the proj.android directory.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
TEMPLATE = r'''LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# -*- coding: utf-8 -*-
import cmath
import math
import matplotlib.pyplot as plt
def linear(a, z, n=100):
yield z
@ydm
ydm / table.py
Last active September 20, 2015 19:42
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from collections import deque
from collections import namedtuple
from pprint import pprint
Item = namedtuple('Item', 'value weight')
@ydm
ydm / binary2float.py
Last active October 21, 2015 13:40
Prints the value of a binary representation of a binary32 float number
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# namespace
# {
# void printBinary(const float value)
# {
# char s[33];