Skip to content

Instantly share code, notes, and snippets.

View jossef's full-sized avatar
🌶️

Jossef Harush Kadouri jossef

🌶️
View GitHub Profile
@jossef
jossef / 7seg.ino
Last active August 27, 2015 14:52
Arduino 7seg 8 digits countdown
#include "LedControl.h"
LedControl lc = LedControl(7, 6, 5, 1);
void setup() {
lc.shutdown(0, false);
lc.clearDisplay(0);
lc.setIntensity(0, 15);
}
void printDashes() {
http://stackoverflow.com/questions/23627796/closing-a-form-view/23632367#23632367
<Application x:Class="WpfApplication2.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
</Application.Resources>
</Application>
@jossef
jossef / SassMeister-input.sass
Created July 17, 2014 13:12
Generated by SassMeister.com.
// ----
// Sass (v3.3.10)
// Compass (v1.0.0.alpha.20)
// ----
=draggable($is-draggable)
@if $is-draggable
cursor: move
@else
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
import datetime
import csv
import StringIO
import urlparse
@jossef
jossef / arduino-upload.py
Last active August 29, 2015 14:12
Arduino firmware upload script using `Eclipse Arduino IDE` and `inotool`
#!/usr/bin/python
import os
import shutil
import subprocess
import tempfile
def get_hex_files():
for root, dirs, files in os.walk(os.getcwd()):
@jossef
jossef / md5_image_renamer.py
Last active August 29, 2015 14:12
python jpg files MD5 renamer
#!/bin/sh/ python
import os
import shutil
import hashlib
output_dir = '.'
for dirpath, dnames, fnames in os.walk("."):
for f in fnames:
full_path = os.path.join(dirpath, f)
@jossef
jossef / thumbnailer.py
Created January 3, 2015 09:25
python jpg thumbnail creator
import os
from PIL import Image
output_dir = '.\\output'
thumbnail_size = (200,200)
if not os.path.exists(output_dir):
os.makedirs(output_dir)
for dirpath, dnames, fnames in os.walk(".\\input"):
@jossef
jossef / gist:ab356497e0c78de2fc33
Created February 5, 2015 13:11
python subprocess with timeout
def call(command, timeout=60):
process = None
def target():
global process
process = subprocess.Popen(command)
process.communicate()
thread = threading.Thread(target=target)
thread.start()
@jossef
jossef / enums.py
Created February 19, 2015 09:55
C#/Java style Enum with names in Python 2.7+
from abc import ABCMeta, abstractmethod
import inspect
class BaseEnum(object):
__metaclass__ = ABCMeta
def __init__(self):
self._names = dict()
self._names_reversed = dict()