Skip to content

Instantly share code, notes, and snippets.

View blacktaxi's full-sized avatar
🇺🇦
russia is a terrorist state, russians are a terrorist nation

Serhii Yavnyi blacktaxi

🇺🇦
russia is a terrorist state, russians are a terrorist nation
View GitHub Profile
@blacktaxi
blacktaxi / RxMouseTracking.cs
Last active December 12, 2015 10:48
Tracking whether mouse pointer is inside a rectangle with .NET Rx.
private void Form1_Load(object sender, EventArgs e)
{
// get an observable for mouse move event
var mouseMove = Observable.FromEventPattern<MouseEventHandler, MouseEventArgs>(
x => this.MouseMove += x, x => this.MouseMove -= x);
// our rectangle
var rect = new Rectangle(50, 50, 50, 50);
// create event stream transformation
@blacktaxi
blacktaxi / hslint.py
Created February 27, 2013 11:08
Haskell lint script for Emacs.
#!python
'''Haskell lint script for Emacs.
Translated from this: https://gist.github.com/1241073
'''
from __future__ import print_function
import sys
import subprocess
import re
@blacktaxi
blacktaxi / reboot-wifi.ps1
Created March 26, 2013 11:45
Wi-Fi adapter restart script. Change "6205" to your adapter name.
echo "Restarting Wi-Fi adapter..."
$a = get-wmiobject -class Win32_NetworkAdapter | Where-Object {$_.Name -like "*6205*"}
echo "Disabling..."
$a.Disable()
sleep 1
echo "Enabling..."
@blacktaxi
blacktaxi / win8thinborder.reg
Created April 1, 2013 13:11
Thin window borders in win8
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]
"PaddedBorderWidth"="0"
@blacktaxi
blacktaxi / silly.fs
Last active December 15, 2015 21:29
F# quine
(fun x -> printfn "%s @%A" x <| x.Replace("\"", "\"\"")) @"(fun x -> printfn ""%s @%A"" x <| x.Replace(""\"""", ""\""\""""))"
@blacktaxi
blacktaxi / .gitconfig
Created May 13, 2013 13:01
My .gitconfig.
[color]
ui = true
[format]
pretty = oneline
[core]
autocrlf = true
[alias]
# basic stuff
st = status -s
s = status -s
@blacktaxi
blacktaxi / __hooks__.py
Created July 28, 2013 09:32
Super-hack to enable hamlish-jinja templates in Wok.
from hamlish_jinja import HamlishTagExtension
from jinja2.environment import load_extensions
def enable_haml(page):
env = page.__class__.tmpl_env
env.extensions = load_extensions(env, [HamlishTagExtension])
hooks = {
'page.meta.pre': [enable_haml]
}
open System.IO
open System.Net
let wc = new WebClient()
let trainingSetFile = Path.Combine( __SOURCE_DIRECTORY__, "trainingSet.csv")
File.WriteAllText(trainingSetFile,
contents = wc.DownloadString("http://brandewinder.blob.core.windows.net/public/trainingsample.csv")
)
@blacktaxi
blacktaxi / markdown_block.rb
Created August 30, 2013 08:54
Inline markdown blocks in Jekyll layouts/pages.
module Jekyll
class MarkdownBlock < Liquid::Block
def initialize(tag_name, text, tokens)
super
end
require "kramdown"
def render(context)
content = super
"#{Kramdown::Document.new(content).to_html}"
end
@blacktaxi
blacktaxi / signextlib.bat
Created September 17, 2013 10:30
Shell script to sign a .NET assembly.
@echo off
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe" -q -vf "%1" > NUL
if ERRORLEVEL 1 goto NOT_SIGNED
:SIGNED
echo Already signed: %~nx1
goto END
:NOT_SIGNED