Skip to content

Instantly share code, notes, and snippets.

View binki's full-sized avatar

Nathan Phillip Brink binki

View GitHub Profile
@binki
binki / Program.cs
Last active May 24, 2017 16:24
SqlCommand does read OUTPUT from stored procedure even when RAISERROR
using System;
using System.Data;
using System.Data.SqlClient;
class Program
{
static void Main(string[] args)
{
using (SqlConnection connection = new SqlConnection(new SqlConnectionStringBuilder
{
@binki
binki / ThrottleDemo.cs
Last active May 11, 2017 15:32 — forked from AArnott/ThrottleDemo.cs
Demonstrates scheduling unbounded work and applying a throttle to keep the threadpool responsive.
using System;
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
@binki
binki / gist:1b974422b9487c37d33bd63159c8d03c
Last active April 23, 2017 22:22
can you break this code
> function decrypt(s) { return Buffer.from([].slice.call(s).reverse().join('').split(' ').map(s => Number.parseInt(s, 2))).toString(); }
undefined
> decrypt('10100110 10110110 11110110 11001110 10100110 11101110 10000110 00000100 10100110 01001110 10000110 00000100 10101110 11110110 10011010')
'You are awesome'
@binki
binki / MANIFESTO.md
Last active April 16, 2017 03:25
#retrobox remote includes magical linking manifesto

Goals

Clients trust server certificates.

No more self-sighed certs. Use something like LetsEncrypt.

Use “mesh” topology

We currently have “star” topology. That means that when my server goes down everyone suffers. If when my server goes down, other servers

@binki
binki / blah.py
Created March 28, 2017 19:05
How to ask python to stay open after running a script
#!/usr/bin/env python3
my_var = 23
@binki
binki / SQLQuery28.sql
Created March 28, 2017 17:52
Why doesn’t @@TRANCOUNT increment after my IF statement?
SET IMPLICIT_TRANSACTIONS ON
GO
IF OBJECT_ID('dbo.t1') IS NOT NULL
BEGIN
DROP TABLE dbo.t1
COMMIT
END
GO
CREATE TABLE dbo.t1 (x INT);
GO
@binki
binki / DecompiledProgram.cs
Created March 14, 2017 17:29
local method no lamdba decompiled
using System;
using System.Runtime.CompilerServices;
namespace LocalFuncCreatesClass
{
internal class Program
{
private static Func<int> GetNextThing
{
get;
@binki
binki / Program.cs
Created March 14, 2017 17:21
capture still works
using System;
namespace LocalFuncCreatesClass
{
class Program
{
static Func<int> GetNextThing { get; set; }
static void Main(string[] args)
{
SeparateFunction();
@binki
binki / Program.cs
Created March 14, 2017 17:14
Local function can capture like normal
using System;
namespace LocalFuncCreatesClass
{
class Program
{
static Func<int> GetNextThing { get; set; }
static void Main(string[] args)
{
var current = 2;
@binki
binki / py_except_speed.py
Last active February 13, 2017 16:35
if is faster than try?
#!/usr/bin/env python3
from os.path import dirname, realpath
import sys
from timeit import Timer
sys.path.append(dirname(realpath(__file__)))
def ifway3(b):
a=1
if not b == 0: