Skip to content

Instantly share code, notes, and snippets.

# Info:
#
# To run this script, install urwid (http://urwid.org/) via your favourite
# package manager.
import math
import urwid
#include <stdio.h>
unsigned long add(unsigned long a, unsigned long b)
{
unsigned long xor = a ^ b;
unsigned long and = a & b;
while (and) {
a = xor;
b = and << 1;
@Garmelon
Garmelon / ugly_sudokusolver.py
Last active April 9, 2017 07:48
A sudoku solver created while I was very tired.
# usage: just import this file and use the solve_sudoku function with your own sudokus
# this ↓ is how a sudoku is structured: a list with 81 fields (read row-by-row or column-by-column)
TEST_SUDOKU = [
None, None, None, 8, 1, 3, 5, 4, None,
2, None, 1, None, 4, 5, None, 6, 3,
None, 4, None, None, None, None, None, None, None,
None, None, None, None, 2, None, None, None, 9,
None, None, 9, None, None, None, 2, None, None,
7, None, None, None, 3, 4, None, None, None,
None, None, None, None, None, None, None, 9, None,
import ssl
import threading
import time
import websocket
from websocket import WebSocketException as WSException
SSLOPT = {"cert_reqs": ssl.CERT_NONE}
ws = None
def run():
@Garmelon
Garmelon / git-cheat-list.md
Created February 17, 2017 19:23
Git cheat list

Git cheat list

  • name of the current banch and nothing else (for automation)

    git rev-parse --abbrev-ref HEAD
    
  • all commits that your branch have that are not yet in master

    git log master..<HERE_COMES_YOUR_BRANCH_NAME>
    
@Garmelon
Garmelon / bf.py
Created January 23, 2017 19:14
speed bf interpreter (14 minutes)
# 18:56
# 19:10
import sys
def do_loops(code):
loopstack = []
loops = {}
for i, char in enumerate(code):
if char == "[":