This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Exports a GitHub repository's issues to CSV format.""" | |
from __future__ import print_function | |
import argparse | |
import csv | |
import getpass | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
tags="$(git tag --list)" | |
for tag in $tags; do | |
hash="$(git rev-list $tag | head -n 1)" | |
echo "${hash} ${tag}" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import Popen, PIPE | |
def cmd(*args): | |
"""Runs a shell command and returns the output as a string.""" | |
out, err = Popen(args, stdout=PIPE, stderr=PIPE).communicate() | |
# Convert output from byte array to string. | |
out = out.decode('utf-8') | |
err = err.decode('utf-8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --graph --all --oneline --decorate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEditor.Macros; | |
using UnityEngine; | |
/// <summary> | |
/// Allows use of the undocumented MacroEvaluator class. Use at your own risk. | |
/// </summary> | |
public class Macros : EditorWindow | |
{ | |
string macro = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
STATUS=`defaults read com.apple.finder AppleShowAllFiles` | |
if [ "$STATUS" = TRUE ]; then | |
defaults write com.apple.finder AppleShowAllFiles FALSE | |
else | |
defaults write com.apple.finder AppleShowAllFiles TRUE | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
grep -r --include='*.py' "$1" ${2:-.} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func parent(ofPath path: String, levels: Int) -> String { | |
var parentPath = path | |
for _ in 1...levels { | |
parentPath = (parentPath as NSString).deletingLastPathComponent | |
} | |
return parentPath | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let homeDirectory: String = { | |
let home = getpwuid(getuid()).pointee.pw_dir! | |
return FileManager.default.string(withFileSystemRepresentation: home, length: Int(strlen(home))) | |
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func isPortInUse(_ port: Int) -> Bool { | |
// Use netstat to find ports in use then grep for one we're interested in. | |
// See this solution for piping shell commands: http://stackoverflow.com/a/16650638 | |
let process = Process() | |
process.launchPath = "/bin/sh" | |
process.arguments = ["-c", "netstat -an | grep '\\b\(port)\\b' | grep LISTEN"] | |
process.standardOutput = Pipe() | |
process.launch() |
OlderNewer