Skip to content

Instantly share code, notes, and snippets.

@ffoxin
ffoxin / sqtm
Last active August 29, 2015 13:55
#include <algorithm>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <thread>
#include <vector>
using namespace std;
inline size_t calc(const size_t n, const size_t i, const size_t j)
{
@ffoxin
ffoxin / dir_snapshot
Created February 7, 2014 10:35
Create a snapshot of directory (including subdirs) for latest comparison
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib
import os
def print_dir(path, size=False, md5=False):
"""
:type path: str
@ffoxin
ffoxin / dl_list.cpp
Created March 18, 2014 12:33
Double linked list implementation. Just for fun.
#include <iostream>
namespace mystl
{
#ifndef NULL
# define NULL ((void *)0)
#endif
template<typename T>
class List
@ffoxin
ffoxin / exifier.py
Last active August 29, 2015 14:01
Fix EXIF info of photos taken by Pantech P9070 (Burst) camera
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Vital Kolas'
__version__ = '0.1.1'
__date__ = '2014-05-16'
import os
import pexif
@ffoxin
ffoxin / KTY81_110.txt
Last active August 29, 2015 14:03
wpc60
-55 0.99 475 490 505 3.02
-50 0.98 500 515 530 2.92
-40 0.96 552 567 582 2.74
-30 0.93 609 624 638 2.55
-20 0.91 669 684 698 2.35
-10 0.88 733 747 761 2.14
0 0.85 802 815 828 1.91
10 0.83 874 886 898 1.67
20 0.8 950 961 972 1.41
25 0.79 990 1000 1010 1.27
@ffoxin
ffoxin / mvd_main.py
Created August 6, 2014 11:11
mvd.gov.by
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Vital Kolas'
__date__ = '2014-08-06'
import json
import urllib.request
@ffoxin
ffoxin / skype.txt
Created November 24, 2015 20:16
Skype on ubuntu x64
Additional packages:
gtk2-engines-murrine:i386
libatk-adaptor:i386
libgail-common:i386
libcanberra-gtk-module:i386
@ffoxin
ffoxin / bin2hex.py
Last active January 3, 2016 20:59
Replace binary numbers (ex. 0b00110101) with its hex representation (ex. 0x35). Useful for adopting arduino Sketch project sources for common IDE.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os import listdir
from os.path import isfile, join
import re
def bin2hex(dir_path, extensions):
bin_match = re.compile('0b[01]{8}')
@ffoxin
ffoxin / hola.c
Created January 20, 2014 12:21
str_cpy function for "5 minute challege" by hola.org Requirements: http://thecodeil.com/
char* str_cpy(char** dest, const char* source)
{
unsigned int dest_size = *dest ? strlen(*dest) : 0;
unsigned int source_size = strlen(source) + 1;
/* check if source is a part of dest - no need to reallocate memory */
if (((unsigned int)(source - *dest)) < dest_size)
return memmove(*dest, source, source_size);
/* reallocate since source is possibly larger than dest */
@ffoxin
ffoxin / mobius.py
Created January 21, 2014 10:13
Möbius function visualization using mathplotlib
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Vital Kolas'
__version__ = '0.0.1'
from pylab import *
from collections import Counter
if __name__ == '__main__':