Skip to content

Instantly share code, notes, and snippets.

View ometa's full-sized avatar

Devin Breen ometa

  • Apple
View GitHub Profile
@ometa
ometa / socks5_proxy.go
Created February 25, 2020 16:05
Golang HTTP Client using SOCKS5 proxy and DialContext
// 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 / add-gplv3.sh
Created May 31, 2017 15:19
Add the GPLv3 header to the top of each source code file
#!/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 / jenkins-api-examples
Created February 17, 2017 22:56 — forked from marshyski/jenkins-api-examples
Jenkins trigger, create and remove jobs and folders
# 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 / plex.nginx.conf
Last active August 26, 2024 15:22
NGINX reverse proxy in front of Plex media server v1.3.3.3148
# 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 / bundle exec derailed bundle:mem.txt
Created December 19, 2016 18:15
derailed_benchmarks for dogtag
$ 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 September 14, 2016 17:49 — forked from epicserve/redis_key_sizes.sh
A simple script to print the size of all your Redis keys.
#!/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 September 27, 2023 20:38 — forked from antonbabenko/curl_all.sh
Curl list of urls and save http response code & times (useful for cache warmup)
#!/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