Skip to content

Instantly share code, notes, and snippets.

View sim642's full-sized avatar

Simmo Saan sim642

View GitHub Profile
@sim642
sim642 / nio-refactor.diff
Last active May 9, 2016 11:43
diff of refactoring Java NIO into shy, produced by shy, after importing git repository to shy
--- /src/main/java/ee/shy/cli/command/AddCommand.java
+++ /src/main/java/ee/shy/cli/command/AddCommand.java
@@ -2,21 +2,21 @@
import ee.shy.cli.Command;
import ee.shy.cli.HelptextBuilder;
import ee.shy.core.Repository;
-import java.io.File;
import java.io.IOException;
@sim642
sim642 / simLCD.cpp
Created April 10, 2016 17:09
Arduino library for Nokia 5110 screen with complete buffer support
#include "simLCD.h"
simLCD::simLCD()
{
clear();
}
simLCD& simLCD::setSCLK(int pin)
{
pinSCLK = pin;
@sim642
sim642 / boost-windows.md
Last active February 7, 2024 16:43
Installing boost libraries for GCC (MinGW) on Windows

Installing boost libraries for GCC (MinGW) on Windows

Folder setup

  1. Extract downloaded boost source, e.g. C:\Program Files\boost_1_59_0.
  2. Create a folder for Boost.Build installation, e.g. C:\Program Files\boost-build.
  3. Create a folder within for building, i.e. C:\Program Files\boost_1_59_0\build.
  4. Create a folder for installation, e.g. C:\Program Files\boost.

GCC setup

  1. Open Command Prompt.
@sim642
sim642 / _tutorial.md
Last active September 3, 2015 09:31
Parandatud ID kaardi Linuxi paigaldusskript
  1. Lae alla parandatud skript altpoolt (või kopeeri faili install-esteid-ubuntu.sh)
  2. Ava terminal samas kaustas, kus skript paikeb (nt failihalduris paremkliki alt)
  3. Anna käivitusõigused: chmod +x install-esteid-ubuntu.sh
  4. Käivita: ./install-esteid-ubuntu.sh
  5. Jälgi skripti käske
@sim642
sim642 / ssh.md
Created August 28, 2015 19:35
Huvitavaid ssh seadistusi
@sim642
sim642 / cmd_pass2.trigger
Last active August 29, 2015 14:27
WeeChat password hiding triggers "fixed" for multiple args
/trigger addreplace cmd_pass2 modifier "6000|input_text_display;6000|history_add;6000|irc_command_auth" "" "/.*/${tg_string}/tg_modifier X^((/(msg|m|quote) +nickserv +(id|identify|register|ghost +[^ ]+|release +[^ ]+|regain +[^ ]+) +)|/oper +[^ ]+ +|/quote +pass +|/set +[^ ]*password[^ ]* +|/secure +(passphrase|decrypt|set +[^ ]+) +)(.*)|.*X${re:+}Xtg_modifier /[^\ ]/*/tg_modifier X^((/(msg|m|quote) +nickserv +(id|identify|register|ghost +[^ ]+|release +[^ ]+|regain +[^ ]+) +)|/oper +[^ ]+ +|/quote +pass +|/set +[^ ]*password[^ ]* +|/secure +(passphrase|decrypt|set +[^ ]+) +)(.*)X${re:1}${tg_modifier}X"
@sim642
sim642 / lcminv.py
Created July 5, 2015 15:32
lcminv problem - find all numbers b such that lcm(a, b) == l
from fractions import gcd
def lcm(a, b):
"""Least common multiple"""
return a * b // gcd(a, b)
def factor(n):
"""Factor natural number into primes and their powers"""
factors = {}
@sim642
sim642 / DI.m3u
Created July 5, 2015 12:52
Digitally Imported premium streams
#EXTM3U
#EXTINF:-1,Digitally Imported - Ambient
http://pub1.diforfree.org:8000/di_ambient_hi
#EXTINF:-1,Digitally Imported - Big Room House
http://pub1.diforfree.org:8000/di_bigroomhouse_hi
#EXTINF:-1,Digitally Imported - Breaks
http://pub1.diforfree.org:8000/di_breaks_hi
@sim642
sim642 / base256.py
Last active August 29, 2015 14:24
Integer to base 256 byte string and vice versa
def int2bytes(n):
str = ''
while n:
str = chr(n % 256) + str
n = n // 256
return str if len(str) > 0 else '\0'
def bytes2int(str):
@sim642
sim642 / force_nick.py
Last active August 29, 2015 14:24
force_nick: Force nick change on channels which disallow it
import weechat
import sys
import re
weechat.register("force_nick", "sim642", "0.1", "TODO", "Force nick change on channels which disallow it", "", "")
#weechat.prnt("", "Hi, this is script")
#weechat.prnt("", str(sys.version_info))
servers = {}