Skip to content

Instantly share code, notes, and snippets.

@lancehunt
lancehunt / gist:31063b6e506a425150858f45e4a6b8d2
Created January 6, 2020 06:27
Fix cached plist file on Mac
touch /Applications/App.app
touch /Applications/App.app/Contents/Info.plist
killall Dock
# Source...somewhere on Stack Overflow
@lancehunt
lancehunt / oauth2-authcode.sh
Last active May 20, 2023 12:25
TradeStation OAuth2 Auth Code tester
#!/bin/bash
######################################################
# Stolen & Modified by Lance Hunt
# Author: Unknown
#
# Please let me know who the righful author is so I
# can give due credit
######################################################
echo '* Installing oauth2 Ruby gem'
@lancehunt
lancehunt / prune_aws_security_groups.md
Last active October 31, 2017 17:27 — forked from asinghal/prune_aws_security_groups.md
Clean up AWS Security groups

Commands to get security groups in use and echo names of groups that can not be found in use

Note: Always check manually before deleting security groups. There are various places the groups may be used, and the scripts output may not always be conclusive

aws elb describe-load-balancers --query 'LoadBalancerDescriptions[*].SecurityGroups' --output text | tr '\t' '\n' | sort | uniq > used.txt

aws elbv2 describe-load-balancers --query 'LoadBalancers[*].SecurityGroups' --output text | tr '\t' '\n' | sort | uniq >> used.txt
@lancehunt
lancehunt / mp4_to_gif.sh
Created March 2, 2017 17:19
Convert MP4 to animated Gif
#!/bin/bash
brew install ffmpeg
ffmpeg -y -ss 3 -t 3 -i ~/Downloads/input.mp4 -vf fps=10,scale=800:-1:flags=lanczos,palettegen palette.png
ffmpeg -ss 1 -t 30 -i ~/Downloads/input.mp4 -i palette.png -filter_complex "fps=10,scale=800:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
# 30-second output at 800 x 600 resolution
@lancehunt
lancehunt / createDataDogPolicy.sh
Created March 1, 2017 01:51
AWS CLI to setup role and policies for DataDog Integration
#!/bin/bash
#aws iam create-policy --policy-name DatadogIntegrationPolicy --policy-document file://datadogPolicy.json
aws iam create-role --role-name DatadogIntegrationRole --assume-role-policy-document file://datadogRoleTrustPolicy.json
aws iam attach-role-policy --role-name DatadogIntegrationRole --policy-arn arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess
aws iam attach-role-policy --role-name DatadogIntegrationRole --policy-arn arn:aws:iam::aws:policy/CloudWatchReadOnlyAccess

Keybase proof

I hereby claim:

  • I am lancehunt on github.
  • I am lancehunt (https://keybase.io/lancehunt) on keybase.
  • I have a public key whose fingerprint is F913 78EB 8FA1 41F1 2230 493A 5779 AE98 7BFC CD92

To claim this, I am signing this object:

@lancehunt
lancehunt / HowToOTGFast.md
Created October 24, 2016 03:41 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

###Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)
More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. Finally, open up the cmdline.txt. Be careful with this file, it is very picky with its formatting! Each parameter is seperated by a single

@lancehunt
lancehunt / gist:2ac22cb1f50fe61e71eedcbe4799af63
Created August 11, 2016 21:53
onename.com verification
Verifying that +lancehunt is my blockchain ID. https://onename.com/lancehunt
@lancehunt
lancehunt / Socket.IO Chrome Network log (Failure)
Created October 25, 2012 21:08
Socket.io v0.9.5 failure on websocket fallback to xhr-polling
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "537.4"
},
"pages": [
{
"startedDateTime": "2012-10-25T21:15:56.432Z",
@lancehunt
lancehunt / client.html
Created July 23, 2012 21:02
Basic socket.io example that fails in safari. Run server with node then navigate to https://localhost:9000
<html>
<head>
<div>Check your debug window for websocket failures in Safari</div>
<div>Should give you this error: WebSocket network error: The operation couldn’t be completed. (OSStatus error -2146885613.) </div>
<script src="/socket.io/socket.io.js"></script>
<script>
var baseUrl = window.location.protocol + "//" + window.location.host, // assumes client is hosted on same url/port as socket.io websockets
socket = io.connect(baseUrl);
socket.on('news', function (data) {