Skip to content

Instantly share code, notes, and snippets.

View binki's full-sized avatar

Nathan Phillip Brink binki

View GitHub Profile
diff --git a/configure.in b/configure.in
index 67acee0..dc98c90 100644
--- a/configure.in
+++ b/configure.in
@@ -43,22 +43,20 @@ AC_ARG_WITH([localdir],
withval="/usr/pkg"
elif test -d /opt/lib ; then
withval="/opt"
- else
- with_extra_libdir="no"
#!/usr/bin/env python
import datetime
class Job(object):
def __init__(self, mean_hours, dates):
self.mean_hours = mean_hours
self.dates = dates
def parse_date(s):
@binki
binki / -
Created February 6, 2016 02:55
ohnobinki@gibby ~ $ cd UseMef/
ohnobinki@gibby ~/UseMef $ mono ./UseMef.exe
Plugin SomePlugin
ohnobinki@gibby ~/UseMef $ rm SomePlugin.dll
ohnobinki@gibby ~/UseMef $ mono ./UseMef.exe
ohnobinki@gibby ~/UseMef $ make
mcs /o:'SomePlugin.dll' /t:library SomePlugin.cs /r:UseMef.exe
ohnobinki@gibby ~/UseMef $ mono ./UseMef.exe
Plugin SomePlugin
@binki
binki / undelayed-expansion-ridik.cmd
Last active February 29, 2016 16:13
Undelayed expansion use case?
SETLOCAL
CALL test.cmd
IF ERRORLEVEL 1 (
SET TESTRET=1
) ELSE (
: # Do something with some envvars that test.cmd set that
: # we want to protect our own cmd code from.
)
: # Rely on undelayed expansion semantics to communicate variables
: # out of the SETLOCAL/ENDLOCAL :-D. Though, I suspect that if
@binki
binki / ahk_sendinput.ahk
Created March 2, 2016 22:47
SendInput() compatible with mstsc, using AutoHotKey
; Run with START /WAIT to wait for the keys to be sent.
; I think Process has options for that in .net
; Be compatible with mstsc and just work better™?
SendMode Input
; Rudimentary support for sending a chunk of chars, sending four chars at once instead of 1 probs will feel like a major speedup
; I’m using ordinals because just sending numerals as arguments avoids all that
; potential escaping nightmare. Is simple to code against.
a1 = %1%
@binki
binki / -
Created March 8, 2016 05:03
Python is less like JavaScript in handling the dot operator than I thought
>>> def callCallback(cb):
... cb()
...
>>> class MyClass(object):
... def __init__(self, x):
... self.x = x
... def f(self):
... print('x = %s' % (self.x, ))
...
>>> myObject = MyClass(3)
ohnob@DESKTOP-A4G2C0J ~/repos/MainContainer4
$ 7z a test.7z testdir
7-Zip [64] 15.14 : Copyright (c) 1999-2015 Igor Pavlov : 2015-12-31
Scanning the drive:
1 folder, 1 file, 0 bytes
Creating archive: test.7z
@binki
binki / better.patch
Created April 29, 2016 16:39
SQL WHERE 1=1 as a diff-cleaning technique
ohnob@DESKTOP-A4G2C0J ~/OneDrive/repos/Main
$ diff -u .better.sql.orig .better.sql.new
--- .better.sql.orig 2016-04-29 12:37:32.586963400 -0400
+++ .better.sql.new 2016-04-29 12:37:43.936262800 -0400
@@ -1,3 +1,2 @@
WHERE 1=1
-AND Squirrels=1
AND Humans=1
@binki
binki / ragespectate-rockpaperscissors.py
Created May 1, 2016 02:17
My “improved” version of ragespectate’s janken
#!/usr/bin/env python
import random
def intro():
print('Welcome to Rock, Paper, Scissors!')
def user():
user_move = ''
while user_move != 'r' and user_move != 'p' and user_move != 's':
user_move = input('What is your move? (r,p,s) ')
using System;
using System.Threading.Tasks;
namespace ArgumentListAwait
{
class Program
{
// Too bad to call a function with multiple task results you have to
// store the intermediate tasks in locals because of the order of
// evaluation of argument lists.