Skip to content

Instantly share code, notes, and snippets.

View sinky's full-sized avatar

Marco Krage sinky

View GitHub Profile
@sinky
sinky / veryfastping.ps1
Created September 2, 2016 04:59 — forked from mbrownnycnyc/veryfastping.ps1
test-connection got you down? ping just not cutting it for you? How about using the System.Net.NetworkInformation.Ping.send() method
# with reference to http://theadminguy.com/2009/04/30/portscan-with-powershell/
function fastping{
[CmdletBinding()]
param(
[String]$computername = "127.0.0.1",
[int]$delay = 100
)
$ping = new-object System.Net.NetworkInformation.Ping
# see http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ipstatus%28v=vs.110%29.aspx
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
/* GCD */
function gcd (a, b) { return (b == 0) ? a : gcd (b, a%b); } // Source: http://stackoverflow.com/a/1186465
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)}
ratio(1920,1080)
/* "16:9" */
ratio(320,240)
/* "4:3" */