Skip to content

Instantly share code, notes, and snippets.


Mark Grandi mgrandi

  • Arizona, USA
View GitHub Profile
endolith / Has weird right-to-left characters.txt
Last active Apr 29, 2022
Unicode kaomoji smileys emoticons emoji
View Has weird right-to-left characters.txt
markembling / hosts.ps1
Created Aug 24, 2009
Powershell script for adding/removing/viewing entries to the hosts file.
View hosts.ps1
# Powershell script for adding/removing/showing entries to the hosts file.
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
traysr /
Created Mar 8, 2012
Commonly used IETF language tags
idan /
Created May 2, 2012
Requests + OAuth, sample usage
import requests
from requests.auth import OAuth1
url = u''
client_key = u'...'
client_secret = u'...'
resource_owner_key = u'...'
resource_owner_secret = u'...'
johntyree /
Last active May 5, 2022
Make one large blocklist from the bluetack lists on
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
jrusbatch / AvailablePorts.cs
Created Dec 5, 2012
Find an Available Port with C#
View AvailablePorts.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.NetworkInformation;
using System.Net;
namespace AvailablePort
class Program
View simple irc python bot
import sys
import socket
import string
import os
import threading
import time
import random
windowtitle = "Nezzbot IRC Client"
from os import system
system("title "+windowtitle)
4ndrej /
Last active Feb 11, 2022
Test of java SSL / keystore / cert setup. Check the comment #1 for howto.
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
public class SSLPoke {
taldanzig / osxvpnrouting.markdown
Created Jan 24, 2013
Routing tips for VPNs on OS X
View osxvpnrouting.markdown

Routing tips for VPNs on OS X

When VPNs Just Work™, they're a fantastic way of allowing access to a private network from remote locations. When they don't work it can be an experience in frustration. I've had situations where I can connect to a VPN from my Mac, but various networking situations cause routing conflicts. Here are a couple of cases and how I've been able to get around them.

Specific cases

Case 1: conflicting additional routes.

In this example the VPN we are connecting to has a subnet that does not conflict with our local IP, but has additional routes that conflict in some way with our local network's routing. In my example the remote subnet is 10.0.x.0/24, my local subnet is 10.0.y.0/24, and the conflicting route is Without the later route, I can't access all hosts on the VPN without manually adding the route after connecting to the VPN:

zach-klippenstein /
Last active May 12, 2022
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall (, and the original source is available at I've in…
import java.util.*;
public class ChangePassword
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception