Skip to content

Instantly share code, notes, and snippets.

<local:ResizeableWindow x:Class="FlicScannerWedge.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FlicScannerWedge"
Title="Scanner Wedge"
Icon="/FlicScannerWedge;component/Barcode.ico"
FontSize="14"
MinWidth="225" MinHeight="150"
Height="{Binding Default.Height, Mode=TwoWay, Source={StaticResource Settings}}"
Width="{Binding Default.Width, Mode=TwoWay, Source={StaticResource Settings}}"
@ChadSki
ChadSki / gist:f0be01dd2556f04753b1
Created September 20, 2014 23:36
Map of Programming Languages
(Lisp)-----\ /---ML-----Caml---OCaml----------------F#
\ / \_____________ (C#)---/
>---ISWIM \
Cobol / \----SASL---KRC----Miranda---Haskell
/ / \
Fortran---Algol--BCPL---B---C--\-/--C++---\ /------Pizza---Scala
/ \ X \----Java
Speedcoding \---Simula---\----/ \ / \---C#
\ \ \ >---Objective-C
Assembly >--Scheme \ /
@ChadSki
ChadSki / gist:0f3b5e110022b48c4c54
Last active August 29, 2015 14:07
byteaccess example
from byteaccess import FileByteAccessContext, WinMemByteAccessContext
if location == 'file':
context = FileByteAccessContext('file.txt')
elif location == 'mem'
context = WinMemByteAccessContext('process.exe')
foo = context.ByteAccess(offset, size)
foo.write_bytes(0, b'somedata')
foo.read_bytes(4, 4) #=> b'data'
def compose(f1, f2):
return lambda x: f1(f2(x))
<pre style="" class="prettyprint lang-nocode linenums:1 prettyprinted">
<ol class="linenums">
<li class="L0" value="1">
<span class="pln" />
<span class="pun">(</span>
<span class="typ">Lisp</span>
<span class="pun">)-----</span>
<span class="pln">\</span>
<span class="pun">/---</span>
<span class="pln">ML</span>
@ChadSki
ChadSki / gist:847c99f4342e51541ba5
Last active August 29, 2015 14:08
Rob Pike Interview Excerpt
Interviewer:

Recently on the Google Labs Aptitude Test there was a question: "What's broken with Unix? How would you fix it?"

What would you have put?

Rob Pike:

Ken Thompson and I started Plan 9 as an answer to that question. The major things we saw wrong with Unix when we started talking about what would become Plan 9, back around 1985, all stemmed from the appearance of a network. As a stand-alone system, Unix was pretty good. But when you networked Unix machines together, you got a network of stand-alone systems instead of a seamless, integrated networked system. Instead of one big file system, one user community, one secure setup uniting your network of machines, you had a hodgepodge of workarounds to Unix's fundamental design decision that each machine is self-sufficient.

Nothing's really changed today. The workarounds have become smoother and some of the things we can do with networks of Unix machines are pretty impressive, but when ssh is the foundation of your security architecture, you

@ChadSki
ChadSki / winnt.h
Created November 27, 2014 02:41
winnt.h snippet
typedef WCHAR *PWCHAR, *LPWCH, *PWCH;
typedef CONST WCHAR *LPCWCH, *PCWCH;
typedef _Null_terminated_ WCHAR *NWPSTR, *LPWSTR, *PWSTR;
typedef _Null_terminated_ PWSTR *PZPWSTR;
typedef _Null_terminated_ CONST PWSTR *PCZPWSTR;
typedef _Null_terminated_ WCHAR UNALIGNED *LPUWSTR, *PUWSTR;
typedef _Null_terminated_ CONST WCHAR *LPCWSTR, *PCWSTR;
typedef _Null_terminated_ PCWSTR *PZPCWSTR;
typedef _Null_terminated_ CONST PCWSTR *PCZPCWSTR;

Plugin Code Snippet

__init__.py loads plugins. The other three files are examples of plugins.

@ChadSki
ChadSki / HaloLagCompensation.cpp
Last active August 29, 2015 14:10
PaulusT's code with comments, reformatted indentation
/********************************************************************************
Copyright (C) 2012 PaulusT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ChadSki
ChadSki / gist:238b5a61e1dbcd09d257
Last active August 29, 2015 14:10
Read/write bits
def read_bit(self, offset, bit):
if not 0 <= bit <= 7:
raise ValueError("Bit must be 0-7.")
byte = self.read_uint8(offset)
return byte & (1 << bit) != 0
def write_bit(self, offset, bit, data):
if not 0 <= bit <= 7:
raise ValueError("Bit must be 0-7.")