Skip to content

Instantly share code, notes, and snippets.

taskkill /F /IM explorer.exe
devcon disable "*VEN_10EC*"
net stop "Windows Audio"
devcon enable "*VEN_10EC*"
net start "Windows Audio"
start explorer.exe
using System;
using System.Diagnostics;
using System.Reflection;
namespace RestartSound
{
static class Program
{
static void Main(string[] args)
{
@ShinNoNoir
ShinNoNoir / _controls.py
Created July 26, 2011 09:49
Fragment of wxPython _controls.py
# *snip*
class StaticText(_core.Control):
"""Proxy of C++ StaticText class"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, String label=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
@ShinNoNoir
ShinNoNoir / gist:2508693
Created April 27, 2012 12:11
Checking whether a number is even or odd: the PHP way! :p
function iseven($n) {
$lastdigit = substr($n, -1);
if ($lastdigit == '0')
return true;
elseif ($lastdigit == '2')
return true;
elseif ($lastdigit == '4')
return true;
elseif ($lastdigit == '6')
return true;
@ShinNoNoir
ShinNoNoir / gist:3780531
Created September 25, 2012 07:58
Working around a web.py bug...
import web
urls = (
'/', 'index',
# etc...
)
class index:
def GET(self):
pass
/*
Bug:
TypeScript compiler should generate a *fresh* variable name for a lexically captured this pointer.
For example, in the lambda assigned to window.onmousemove shown below, the captured outer this-pointer
should not be named "_this" since it would clash with an existing local variable, but instead should
be given a name that is not in scope, e.g. "_this2".
Tested in:
@ShinNoNoir
ShinNoNoir / Combinaties.hs
Last active December 10, 2015 16:38 — forked from anonymous/gist:4462276
Variation of an older version... Less computing (still roughly the same amount of time needed), but more memory usage.
module Combinaties where
deleteFromHead :: Eq a => a -> [a] -> [a]
deleteFromHead x [] = []
deleteFromHead x (y:ys)
| x == y = ys
| otherwise = (y:ys)
generate :: Eq a => Int -> [a] -> [a] -> [[a]]
@ShinNoNoir
ShinNoNoir / CovariantReturnTypes.cs
Created January 7, 2013 20:45
Trying to emulate covariant return types
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CovariantReturnTypes
{
interface IA<out This>
where This : IA<This>
function flip(f) {return curry(function(y,x){return f(x)(y)})}
function curry(f) {return function(x){return function(y){return f(x,y)}}}
parseDec = flip(curry(parseInt))(10)
['10','10','10','10','10'].map(parseDec)
@ShinNoNoir
ShinNoNoir / kappa.py
Created February 10, 2013 13:13
Simple implementation of the Fleiss' kappa measure in Python
def fleiss_kappa(ratings, n, k):
'''
Computes the Fleiss' kappa measure for assessing the reliability of
agreement between a fixed number n of raters when assigning categorical
ratings to a number of items.
Args:
ratings: a list of (item, category)-ratings
n: number of raters
k: number of categories