Skip to content

Instantly share code, notes, and snippets.

View KyleJamesWalker's full-sized avatar
😃
Hello!

Kyle James Walker (he/him) KyleJamesWalker

😃
Hello!
View GitHub Profile
# Every 4 Frames via find and a file
echo "Enter Video Name for folder: ";read VSRC; find . -type f -name '*.JPG' | sort | awk 'NR%4 == 1 {print "file \x27"$1"\x27"}' > $VSRC.txt; ffmpeg -f concat -safe 0 -i $VSRC.txt -c:v libx264 -b:v 10M -maxrate 10M -bufsize 4M -vf scale=-1:1080,format=yuv420p -r 30 $VSRC.mp4
@KyleJamesWalker
KyleJamesWalker / README.md
Created March 20, 2018 19:57
Protect Master Branch

How to protect master

  • Run:git config --global core.hooksPath ~/githooks
  • Create hooks folder: mkdir ~/githooks
  • Copy pre-push to the ~/githooks folder
  • Set executable: chmod +x ~/githooks/pre-push
@KyleJamesWalker
KyleJamesWalker / Makefile
Created March 16, 2018 21:33
Makefile Prompts
something:
$(call prompt_run,echo "FUN!")
# Prompt the user to continue and exit the script if they choose no
define prompt_continue
@read -p "Contine and $(1)? " -n 1 -r REPLY; echo "\n"; \
if [[ $$REPLY =~ ^[Nn]$$ ]]; then exit 1; fi
endef
# Prompt the user to run a given command, and keep going if they choose no
@KyleJamesWalker
KyleJamesWalker / kms_edit
Created February 3, 2018 00:03
Quickly Edit KMS Documents
#!/usr/bin/env python
import argparse
import hashlib
import os
import tempfile
import sys
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
@KyleJamesWalker
KyleJamesWalker / pretty_json_file.py
Created December 29, 2017 23:07
Print a JSON file with color!
import json
from pygments import highlight, lexers, formatters
def pretty_json_file(fn):
print(highlight(
json.dumps(json.load(open(fn)), sort_keys=True, indent=2),
lexers.JsonLexer(),
formatters.TerminalFormatter(),
))
@KyleJamesWalker
KyleJamesWalker / README.md
Last active December 26, 2017 21:47
YamlSettings Example with Null Validation

Failures:

python -m example
SERVICE_USER=foo python -m example

Valid:

SERVICE_USER=foo SERVICE_PASS=bar python -m example
@KyleJamesWalker
KyleJamesWalker / datadog_lambda.py
Created November 9, 2017 22:40
Monitoring AWS Lambda functions with Datadog Example
"""Send metrics over stdout for datadog lambda monitoring.
Monitoring details:
https://www.datadoghq.com/blog/monitoring-lambda-functions-datadog/
"""
import time
from copy import copy
@KyleJamesWalker
KyleJamesWalker / README.md
Last active November 6, 2017 23:51
Templated yamlsettings example

A quick example to allow easy environment variable injection for yamlsettings in lists. Normally a list can only be completely overriden via environement variables, this allows you to pick specific values to load in to a given entry.

Run with something like:

BAR_PASS=s3cr3t BAZ_PASS=god python example.py

Keybase proof

I hereby claim:

  • I am kylejameswalker on github.
  • I am kylejameswalker (https://keybase.io/kylejameswalker) on keybase.
  • I have a public key ASCW21fjaLLt721meHzL4foAVr3V44KfM0EX8cjlRUFDywo

To claim this, I am signing this object:

@KyleJamesWalker
KyleJamesWalker / _README.md
Created February 25, 2017 18:05
Convert directory of files with ffmpeg

Converts a directory of low bitrate mp4 audio files to window media audio with ffmpeg.

This is a quick conversion for my car's CD player as it doesn't support mp4.