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
shuf -n 1 oblique.txt | |
# or | |
rl -c 1 oblique.txt | |
# or | |
sed -n $((RANDOM%$(wc -l < leader.txt)+1))p oblique.txt |
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 | |
# Declare requirements in bash scripts | |
set -e | |
function requires() { | |
if ! command -v $1 &>/dev/null; then | |
echo "Requires $1" | |
exit 1 | |
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 | |
# List missing files from a web server. Missing means we get a non-200 response. | |
BASE="http://www.example.com" | |
FILES="index.html | |
about.html" | |
for ITEM in ${FILES}; do | |
URL="${BASE}/${ITEM}" |
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "AWS CloudFormation deploys a Windows machine used for Steam", | |
"Parameters": { | |
"AWSAMI": { | |
"Description": "Choose the AMI ID for your Steam machine. This should be a Windows Server 2012 R2 instance and the ID will look like ami-XXXXXXXX", | |
"Type": "AWS::EC2::Image::Id" | |
}, | |
"AWSSubnet": { | |
"Description": "Choose a subnet for the Steam instance.", |
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/sh | |
# Fuzzy find and kill a process. Supports signal codes (-9 etc.) | |
set -e | |
pid="$(ps -ef | fzf | awk '{ print $2}')" | |
kill $@ ${pid} |
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 | |
# reconfigure AWS CLI credentials | |
set -e | |
function requires() { | |
if ! command -v "$1" &>/dev/null; then | |
echo "Requires $1" | |
exit 1 | |
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
#!/usr/bin/env python3 | |
from argparse import ArgumentParser | |
import os | |
import subprocess | |
proxy_host = os.getenv('PROXY_HOST', default='http-gw.mycompany.com') | |
proxy_port = os.getenv('PROXY_PORT', default='80') | |
base_java_opts = os.getenv("BASE_JAVA_OPTS", "") | |
on_network = "MyCompany On Network" |
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
// Simple camera follow system | |
public class CameraFollow : MonoBehaviour | |
{ | |
// The target to follow | |
public Transform Target; | |
// Position offset from target |
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
public class ReadOnlyAttribute : PropertyAttribute | |
{ | |
} | |
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))] |
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 | |
import sys | |
def rgb2Yiq(red, green, blue): | |
y = int((0.299 * red) + (0.587 * green) + (0.114 * blue)) | |
i = int((0.596 * red) - (0.275 * green) - (0.321 * blue)) | |
q = int((0.212 * red) - (0.528 * green) + (0.311 * blue)) | |
return (y, i, q) |
NewerOlder