Skip to content

Instantly share code, notes, and snippets.

View binki's full-sized avatar

Nathan Phillip Brink binki

View GitHub Profile
@binki
binki / rockford-community-band-2019-fall-calendar.md
Created September 10, 2019 04:55
Rockford Community Band 2019 Fall Calendar

2019-2020 Rockford Community Band Calendar

Date Description Time
Monday, September 9 Rehearsals Begin
East Rockford MS Bandroom
Subsequent rehearsals each Monday evening
7:00–9:00pm
Monday, October 21 Performance at Porter Hills
Call time: 6:00pm
7:00pm
Monday, October 28 Performance at Breton Woods
Call time: 6:00pm
7:00pm
Sunday, December 8 Holiday Concert
Rockford HS Auditorium
Call time: 2:00pm
3:00pm
Monday, December 9 Performance at Covenant Village
Call time: 6:00pm
7:00pm
Monday, January 6 Rehearsals resume East Rockford MS Bandroom *Subsequent rehearsals each Monday evenin
@binki
binki / count-to-100.sql
Last active September 2, 2019 05:59
Counting to 100 with recursive CTEs in SQL Server
WITH number AS (SELECT
CAST(1 AS BIGINT) Value
UNION ALL SELECT
n.Value + 1
FROM number n
WHERE n.Value < 100)
SELECT n.Value
FROM number n
ORDER BY n.Value
;
# Apparently there’s a thing called cycle() for this in python:
>>> x = ['a', 'b', 'c']
>>> [x[i % len(x)] for i in range(0, 20)]
['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b']
C:\Users\ohnob>SET _test=this is ab test of abs.
C:\Users\ohnob>ECHO %_test:*ab=%
test of abs.
C:\Users\ohnob>ECHO %_test:ab=%
this is test of s.
C:\Users\ohnob>ECHO %_test:*ab=%
test of abs.
@binki
binki / Program.cs
Last active March 27, 2019 04:25
MultiDimensionalArray
using System;
namespace MultiDimensionArray
{
class Program
{
static void Main(string[] args)
{
var x = new int[2, 3];
UseArray(x);
// Copyright 2019 Nathan Phillip Brink
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
@binki
binki / README.md
Created January 16, 2019 17:10
mysql connection pooling in node.js

This is in reaction to http://www.madhur.co.in/blog/2016/09/05/nodejs-connection-pooling.html

It is critical that you remember to release connections to the pool if you are using pooling with the mysql module. It is best to use the pool.query() command if you can. You’ll know if you can’t.

Examples of things which cannot use pool.query() but must use pool.getConnection() followed by connection.release() are:

  1. Using transactions where you send multiple commands to the server.
  2. Sharing per-session data objects between subsequent commands sent to the server such as temporary tables.
XDocument.Parse(XDocument.Parse("<x xml:space=\"preserve\">&#xd;\n</x>").ToString(SaveOptions.DisableFormatting)).Root.Value == "\r\n"
XDocument.Parse("<x xml:space=\"preserve\">&#xd;\n</x>").Root.Value == "\r\n"
@binki
binki / blah.py
Created November 27, 2018 02:56
Python function binding
#!/usr/bin/env python
def my_func(x):
print(x)
def build_my_func_call(x):
def f():
my_func(x)
return f