Skip to content

Instantly share code, notes, and snippets.

from __future__ import print_function
import re
def create_leg(osi_symbol, ratio):
regex = re.compile("(?<symbol>\w+)\s*(?<year>\d{2})(?<month>\d{2})(?<day>\d{2})(?<call_put>[CP])(?<dollars>\d+)(?<cents>\d{2})")
m = regex.match(osi_symbol)
if not m:
raise ValueError("Huh? Is this right OSI symbol: " + osi_symbol)
@itsff
itsff / filip-dox.json
Last active October 25, 2020 21:11
ErgoDox Layout
{"version":1,"notes":"","documentation":"\"This file is a QMK Configurator export. You can import this at <https://config.qmk.fm>. It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: <https://docs.qmk.fm/#/newbs>\n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n","keyboard":"hotdox","keymap":"filip-dox","layout":"LAYOUT_ergodox","layers":[["LCTL_T(KC_GRV)","KC_1","KC_2","KC_3","KC_4","KC_5","LSFT(KC_INS)","KC_TAB","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_INS","KC_RALT","KC_A","KC_S","KC_D","KC_F","KC_G","KC_LSFT","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_DEL","KC_RALT","TG(1)","MO(2)","MO(1)","KC_LCTL","RALT_T(KC_APP)","KC_LGUI","KC_HOME","KC_SPC","KC_BSPC","KC_END","KC_6","KC_7","KC_8","KC_9","KC_0","KC_MINS","KC_EQL","KC_LBRC","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_BSLS","KC_H","KC_J","KC_K","KC_L","LT(2,KC_SCLN)","LGUI_T(KC_QUOT)","KC_RBRC","K
@itsff
itsff / .gitconfig
Created April 3, 2019 03:20
My gitconfig file
[user]
name = Filip Frącz
email = filip@seedcx.com
username = filip
[core]
editor = emacsclient --tty --create-frame
#editor = vim
[filter "lfs"]
@itsff
itsff / biz_day.py
Created February 3, 2019 05:08
Finding next business day in Python
from datetime import datetime, timedelta
def find_next_biz_day(days_away=1,
start=None,
is_holiday=lambda d: False):
"""
Finds a business day that is N days away
:param days_away: Days away (positive or negative)
:param start: Starting date (today if None)
@itsff
itsff / filip.cpp.cfg
Last active June 20, 2018 20:51
Filip's Canonical Coding Style - config files for uncrustify
# Uncrustify 0.64
#
# Usage:
# uncrustify -c /path/to/filip.cpp.cfg --replace --no-backup /path/to/cpp/or/h/file
#
#
# Filip's Canonical Coding Style (C++)
#
@itsff
itsff / SAStoken.cs
Created July 12, 2017 18:40 — forked from sedouard/SAStoken.cs
Generates a SAS Token for Azure REST Api Calls (Particularly for Service Bus Services like Event Hub & Queues)
/// <summary>
/// Code for generating of SAS token for authorization with Service Bus
///
/// This handy function can be found on this helpful blog post:
/// http://developers.de/blogs/damir_dobric/archive/2013/10/17/how-to-create-shared-access-signature-for-service-bus.aspx
/// </summary>
/// <param name="resourceUri"></param>
/// <param name="keyName"></param>
/// <param name="key"></param>
/// <returns></returns>
@itsff
itsff / process_hollowing.c
Created March 8, 2017 21:30
A pretty neat exploit called Process Hollowing. You start a process suspended, then replace its content with the content of another.
#include <stdio.h>
#include <Windows.h>
#include <winternl.h>
#pragma comment(lib,"ntdll.lib")
EXTERN_C NTSTATUS NTAPI NtTerminateProcess(HANDLE,NTSTATUS);
EXTERN_C NTSTATUS NTAPI NtReadVirtualMemory(HANDLE,PVOID,PVOID,ULONG,PULONG);
EXTERN_C NTSTATUS NTAPI NtWriteVirtualMemory(HANDLE,PVOID,PVOID,ULONG,PULONG);
EXTERN_C NTSTATUS NTAPI NtGetContextThread(HANDLE,PCONTEXT);
@itsff
itsff / jni_string.hpp
Last active September 30, 2016 21:23
RAII JNI string
#include <jni.h>
class jni_string
{
public:
jni_string (JNIEnv *env,
jstring javaString)
: _env(env)
, _javaString(javaString)
{
@itsff
itsff / reverse_scroll.ps1
Created September 2, 2016 20:09
Reverse mouse wheel scroll direction on Windows
# Copied from: http://superuser.com/a/364353
# Change registry settings
# Reverse mouse wheel scroll FlipFlopWheel = 1
# Normal mouse wheel scroll FlipFlopWheel = 0
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
@itsff
itsff / README.markdown
Created February 19, 2016 22:10 — forked from alloy/README.markdown
Learn the LLVM C++ API by example.

The easiest way to start using the LLVM C++ API by example is to have LLVM generate the API usage for a given code sample. In this example it will emit the code required to rebuild the test.c sample by using LLVM:

$ clang -c -emit-llvm test.c -o test.ll
$ llc -march=cpp test.ll -o test.cpp