Skip to content

Instantly share code, notes, and snippets.

Cameron Sparr sparrc

  • Amazon
  • Seattle
View GitHub Profile
@sparrc
sparrc / install-ffmpeg.sh
Last active Jul 18, 2020
Installs ffmpeg with libaom and libx265 enabled for av1 and hevc encoding (tested on Ubuntu 16.04)
View install-ffmpeg.sh
#!/usr/bin/env bash
# Installs ffmpeg from source (HEAD) with libaom and libx265, as well as a few
# other common libraries
# binary will be at ~/bin/ffmpeg
sudo apt update && sudo apt upgrade -y
mkdir -p ~/ffmpeg_sources ~/bin
export PATH="$HOME/bin:$PATH"
View udprecv.py
import socket
SOCKET_SIZE = 4096
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("localhost", 8009))
sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, SOCKET_SIZE)
while True:
try:
msg, host = sock.recvfrom(SOCKET_SIZE)
View combined_log_format.log
127.0.0.1 - - [22/Aug/2011:10:02:00 +0900] "GET / HTTP/1.1" 200 902 "-" "Python-urllib/2.7"
127.0.0.1 - - [22/Aug/2011:10:02:00 +0900] "GET / HTTP/1.1" 200 572 "-" "okhttp/2.4.0"
127.0.0.1 - - [22/Aug/2011:10:02:00 +0900] "GET /large.jpg HTTP/1.1" 200 714 "-" "okhttp/2.4.0"
127.0.0.1 - usera [22/Aug/2011:10:02:00 +0900] "GET /large.jpg HTTP/1.1" 200 926 "-" "Firefox/5.0"
127.0.0.1 - userb [22/Aug/2011:10:02:00 +0900] "GET / HTTP/1.1" 200 862 "-" "Firefox/5.0"
127.0.0.1 - - [22/Aug/2011:10:02:00 +0900] "GET / HTTP/1.1" 200 306 "-" "Firefox/5.0"
127.0.0.1 - - [22/Aug/2011:10:02:00 +0900] "POST / HTTP/1.1" 200 579 "-" "okhttp/2.4.0"
127.0.0.1 - - [22/Aug/2011:10:02:00 +0900] "POST / HTTP/1.1" 200 988 "-" "Python-urllib/2.7"
127.0.0.1 - - [22/Aug/2011:10:02:00 +0900] "GET /large.jpg HTTP/1.1" 200 115 "-" "Firefox/5.0"
127.0.0.1 - userb [22/Aug/2011:10:02:00 +0900] "GET / HTTP/1.1" 200 359 "-" "Firefox/5.0"
View influx-patterns
# Captures are a slightly modified version of logstash "grok" patterns, with
# the format %{<capture syntax>[:<semantic name>][:<modifier>]}
# By default all named captures are converted into string fields.
# Modifiers can be used to convert captures to other types or tags.
# Timestamp modifiers can be used to convert captures to the timestamp of the
# parsed metric.
# View logstash grok pattern docs here:
# https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html
# All default logstash patterns are supported, these can be viewed here:
@sparrc
sparrc / statfs.go
Created Jan 25, 2016
Golang statfs
View statfs.go
package main
import (
"fmt"
"syscall"
)
func main() {
stat := syscall.Statfs_t{}
err := syscall.Statfs("/", &stat)
@sparrc
sparrc / phabricator_readme.md
Last active May 1, 2020
Phabricator Ubuntu Installation Guide
View phabricator_readme.md

Phabricator Ubuntu Installation Guide

This is a supplement to the official Phabricator Installation Guide, because their guide will leave you with all kinds of permission and config errors and ~15,000 setup issues on startup.

Install bonus packages:

# apt-get install mercurial subversion python-pygments sendmail imagemagick

Create necessary users and add phd-user to sudoers:

You can’t perform that action at this time.