Skip to content

Instantly share code, notes, and snippets.

View phillijw's full-sized avatar
🐌
Reading the yellow pages

Joe Phillips phillijw

🐌
Reading the yellow pages
View GitHub Profile
@phillijw
phillijw / gist:cf1de972df08ae37fc9ae980c00fd730
Created February 25, 2021 14:39
Coinigy v2 API Authentication for Postman
// Pre-request script for private Coinigy endpoints (requiring authentication and authorization)
// This function is used for variable replacement in URLs. It finds the curly braces
// and replaces with the corresponding variable
function interpolate (str) {
return str.replace(/{{([^}]+)}}/g, function (match, $1) {
return pm.variables.get($1);
});
}
@phillijw
phillijw / gist:d8466359efd41e75425c70d138eaecb7
Created August 6, 2020 19:52
Docker health checks for services
```
healthcheck:
test: ["CMD-SHELL", "[ $$(expr $$(date +%s) - $$(stat -c '%Y' \"/app/health_check\")) -lt 60 ] || exit 1"
interval: 60s
timeout: 5s
retries: 3
```
This checks the last modified date of a file `/app/health_check` which the service should update
whenever it wants to mark itself as "alive". This command will check that it was updated in the
last 60 seconds and exit with a zero code. If its more than 60 seconds, it will exit with 1.
@phillijw
phillijw / Dockerfile
Last active August 5, 2020 19:16
Getting diagnostic tools to work in swarm
#File: dotnet-tools/Dockerfile
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 as tools
RUN dotnet tool install --tool-path /tools dotnet-trace
RUN dotnet tool install --tool-path /tools dotnet-dump
RUN dotnet tool install --tool-path /tools dotnet-counters
FROM mcr.microsoft.com/dotnet/core/runtime:3.1 AS runtime
COPY --from=tools /tools /tools
@phillijw
phillijw / macvlan-physical.md
Created September 5, 2018 02:19 — forked from aaronstaves/macvlan-physical.md
Notes on making a macvlan physical network and container attached

Create a network on the host interface

Prereqs

  1. Setup the network that you'll be connecting to to only allow dhcp within a certain range
  2. Use the unreserved dhcp range for docker

Example

I'm using 192.168.1.2 - 192.168.1.199 as my DHCP range.
All my docker containers are going to be limited to the ip range of 192.168.1.224 - 192.168.1.254 (--ip-range=192.168.1.224/27)

@phillijw
phillijw / sample.py
Last active April 13, 2021 18:26 — forked from nottug/sample.py
Coinigy API v2 Signature and Request Example in Python 3
import time
import hmac
import hashlib
import requests
BASE_URL = 'https://api.coinigy.com'
ENDPOINT = '/api/v2/private/exchanges'
X_API_KEY = 'your_api_v2_key_goes_here'
SECRET = 'your_corresponding_api_v2_secret_goes_here'
METHOD = 'GET'
@phillijw
phillijw / sample.py
Created July 28, 2018 15:20
Coinigy API v2 Signature Example in Python 3
import time
import hmac
import hashlib
BASE_URL = 'https://api.coinigy.com'
ENDPOINT = '/api/v2/private/exchanges'
KEY = 'keykeykeykeykeykeykeykeykeykeyke'
SECRET = 'secretsecretsecretsecretsecretse'
METHOD = 'GET'
UNIXTIME = 1532718830.0 #time.time()
@phillijw
phillijw / traefik-docker-compose.yml
Last active January 28, 2021 19:08
Working traefik + zoneminder docker setup
version: '3'
services:
traefik:
image: traefik
restart: always
ports:
- "80:80" #http
- "443:443" #https
- "8080:8080" #web ui
SELECT
es.SubCategoryName
,es.ClientProductID
,es.ProductSID
,CAST(ps.DATE AS DATE) DATE
,Price
,Cost
FROM ProductStatus ps
JOIN v_EnterpriseStructure es ON es.ProductSID = ps.ProductSID
JOIN PriceZone pz ON pz.PriceZoneID = ps.PriceZoneID
Calling "git cleanup" will delete local branches that have already been merged into origin/master. It skips master, staging, and dev because we don't want to delete those in normal circumstances.
$ git config --global alias.cleanup '!git branch --merged origin/master | egrep -v "(^\*|master|staging|dev)" | xargs git branch -d'
@phillijw
phillijw / gist:6f35778a0dcde5b839158cee2d74521b
Last active January 22, 2022 03:35
transmission (bittorrent)
docker run \
-d \
-v /var/lib/docker/volumes/transmission/config:/config \
-v /media/kingkong:/downloads \
-v /media/kingkong/torrents:/watch \
-e TZ=America/Chicago \
-p 9091:9091 -p 51413:51413 \
-p 51413:51413/udp \
--name=transmission \
--restart unless-stopped \