Skip to content

Instantly share code, notes, and snippets.

View binki's full-sized avatar

Nathan Phillip Brink binki

View GitHub Profile
ohnobinki@gibby ~ $ cat blah.js
#!/usr/bin/env node
console.log('hi');
ohnobinki@gibby ~ $ ./blah.js
hi
ohnobinki@gibby ~ $ cat blah2.js
console.log('hi');
ohnobinki@gibby ~ $ ./blah2.js
./blah2.js: 行 1: 予期しないトークン `'hi'' 周辺に構文エラーがあります
./blah2.js: 行 1: `console.log('hi');'
ohnobinki@gibby ~ $ cat blah.js
#!/usr/bin/env node
console.log('hi');
ohnobinki@gibby ~ $ ./blah.js
hi
ohnobinki@gibby ~ $ cat blah2.js
console.log('hi');
ohnobinki@gibby ~ $ ./blah2.js
./blah2.js: 行 1: 予期しないトークン `'hi'' 周辺に構文エラーがあります
./blah2.js: 行 1: `console.log('hi');'
@binki
binki / Program.cs
Last active January 18, 2017 18:33
Play with C# string interpolation
using System;
namespace FormattablePlay
{
class Program
{
static void Main(string[] args)
{
var stringVar = "plant";
Append($"SELECT * FROM blah b WHERE b.Thing = {stringVar}");
@binki
binki / output.txt
Created November 3, 2016 04:09
globs match backslashes on unix
ohnobinki@gibby ~/testthings/dir1/dir2\asdf\stilldir2 $ touch foo\\bar\\baz.txt
ohnobinki@gibby ~/testthings/dir1/dir2\asdf\stilldir2 $ busybox ash -c 'echo foo*.txt'
foo\bar\baz.txt
ohnobinki@gibby ~/testthings/dir1/dir2\asdf\stilldir2 $
@binki
binki / Program.cs
Created November 3, 2016 16:12
Remoting—reference versus value/AppDomain remoting
// Inspired by http://stackoverflow.com/q/13729089/429091
using System;
class Program
{
static void Main(string[] args)
{
var appDomain = AppDomain.CreateDomain("Temp AppDomain", null, AppDomain.CurrentDomain.SetupInformation);
try
@binki
binki / Program.cs
Last active November 5, 2016 14:51
#csharp7 #tuple #destructuring
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace ValueTupleFun
{
class Program
{
static void Main(string[] args)
{
@binki
binki / Scriptfile
Created November 21, 2016 15:05
[email protected]’s conditional globbing is weird
ohnobinki@gibby /tmp/.private/ohnobinki/asdf $ mkdir -p a/{b{0,1,2,3},\*\*}/c
ohnobinki@gibby /tmp/.private/ohnobinki/asdf $ find . -name node_modules -prune -or -print
.
./a
./a/**
./a/**/c
./a/b3
./a/b3/c
./a/b2
./a/b2/c
#include <stdio.h>
int main(int argc, const char *argv[]) {
return rename(argv[1], argv[2]);
}
@binki
binki / pevil.html
Last active December 12, 2016 23:22
Switch input type=password to type=text in the current page.
<p>
Drag this link to your bookmark toolbar to install this bookmarklet: <a href="javascript:(function()%20{var%20o%20=%20document.getElementsByTagName('input'),%20i%20=%200;%20for%20(;%20i%20<%20o.length;%20i++)%20if%20(o[i].type%20==%20'password')%20o[i].type%20=%20'text';%20undefined;})()">pevil</a>
</p>
<p>
Demo: <input type="password" value="password"/>
</p>
@binki
binki / output.txt
Created December 17, 2016 15:14
null trick with maps?
> var x = {}
undefined
> x['null'] = 2
2
> x['undefined'] = 4
4
> y = {parentId: null,}
{ parentId: null }
> x[y.parentId]
2