Skip to content

Instantly share code, notes, and snippets.

Avatar

Devin Breen ometa

  • Apple
View GitHub Profile
@ometa
ometa / add-gplv3.sh
Created May 31, 2017
Add the GPLv3 header to the top of each source code file
View add-gplv3.sh
#!/bin/bash
for i in $(git ls | grep "\.rb$"); do
year=$(git log --follow --diff-filter=A $i | grep Date | tail -1 | awk '{ print $6 }')
echo "Adding GPL3 header w/ year $year to $i"
cat ~/lic.txt |sed "s|THEDATE|$year|" | cat - $i > /tmp/temp && mv /tmp/temp $i
done
@ometa
ometa / plex.nginx.conf
Last active May 25, 2021
NGINX reverse proxy in front of Plex media server v1.3.3.3148
View plex.nginx.conf
# This example assumes the NGINX proxy is on the same host as the Plex Media Server.
# To configure Plex Media Server to serve requests without requiring authentication,
# ensure that your LAN subnet is correctly added to the advanced server setting called
# "List of IP addresses and networks that are allowed without auth". Example:
# 192.168.0.1/24
upstream plex-upstream {
server 127.0.0.1:32400;
}
@ometa
ometa / socks5_proxy.go
Created Feb 25, 2020
Golang HTTP Client using SOCKS5 proxy and DialContext
View socks5_proxy.go
// Golang example that creates an http client that leverages a SOCKS5 proxy and a DialContext
func NewClientFromEnv() (*http.Client, error) {
proxyHost := os.Getenv("PROXY_HOST")
baseDialer := &net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}
var dialContext DialContext
@ometa
ometa / jenkins-api-examples
Created Feb 17, 2017 — forked from marshyski/jenkins-api-examples
Jenkins trigger, create and remove jobs and folders
View jenkins-api-examples
# check if job exists
curl -XGET 'http://jenkins/checkJobName?value=yourJobFolderName' --user user.name:YourAPIToken
# with folder plugin
curl -s -XPOST 'http://jenkins/job/FolderName/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# without folder plugin
curl -s -XPOST 'http://jenkins/createItem?name=yourJobName' --data-binary @config.xml -H "Content-Type:text/xml" --user user.name:YourAPIToken
# create folder
@ometa
ometa / bundle exec derailed bundle:mem.txt
Created Dec 19, 2016
derailed_benchmarks for dogtag
View bundle exec derailed bundle:mem.txt
$ bundle exec derailed bundle:mem
TOP: 39.8594 MiB
rails/all: 13.5508 MiB
active_record/railtie: 6.5781 MiB
active_record: 4.8164 MiB (Also required by: authlogic)
active_record/connection_adapters/abstract_adapter: 2.1992 MiB
active_record/connection_adapters/abstract/schema_statements: 0.7383 MiB
active_record/migration/join_table: 0.3555 MiB
active_record/migration: 0.3398 MiB
active_record/type: 0.4648 MiB
@ometa
ometa / redis_key_sizes.sh
Created Sep 14, 2016 — forked from epicserve/redis_key_sizes.sh
A simple script to print the size of all your Redis keys.
View redis_key_sizes.sh
#!/usr/bin/env bash
# This script prints out all of your Redis keys and their size in a human readable format
# Copyright 2013 Brent O'Connor
# License: http://www.apache.org/licenses/LICENSE-2.0
human_size() {
awk -v sum="$1" ' BEGIN {hum[1024^3]="Gb"; hum[1024^2]="Mb"; hum[1024]="Kb"; for (x=1024^3; x>=1024; x/=1024) { if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x]; break; } } if (sum<1024) print "1kb"; } '
}
@ometa
ometa / curl_all.sh
Last active Sep 2, 2016 — forked from antonbabenko/curl_all.sh
Curl list of urls and save http response code & times (useful for cache warmup)
View curl_all.sh
#!/bin/bash
[ ! $1 ] && echo "you must include a file containing urls, one per line" && exit 1
while read LINE; do
curl -o /dev/null --silent --progress-bar --head --write-out '%{http_code} %{time_starttransfer} %{url_effective}\n' "$LINE"
done < $1