Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ryanlewis's full-sized avatar

Ryan Lewis ryanlewis

  • Leeds, United Kingdom
  • 09:43 (UTC +01:00)
View GitHub Profile
@florentchauveau
florentchauveau / leaky_bucket.lua
Created August 28, 2018 12:50
Redis script (Lua) to implement a leaky bucket
-- Redis script to implement a leaky bucket
-- see https://medium.com/callr-techblog/rate-limiting-for-distributed-systems-with-redis-and-lua-eeea745cb260
-- (c) Florent CHAUVEAU <florent.chauveau@gmail.com>
local ts = tonumber(ARGV[1])
local cps = tonumber(ARGV[2])
local key = KEYS[1]
-- remove tokens < min (older than now() -1s)
local min = ts -1
version: '2.1'
services:
grafana:
container_name: grafana
image: proxx/grafana-armv7
user: "1000"
ports:
- 3000:3000
volumes:
- /opt/grafana:/etc/grafana:rw
@seanf
seanf / process.kt
Created August 23, 2017 02:12
Execute process from Kotlin
import java.lang.ProcessBuilder.Redirect
import java.util.concurrent.TimeUnit
fun String.runCommand(workingDir: File? = null) {
val process = ProcessBuilder(*split(" ").toTypedArray())
.directory(workingDir)
.redirectOutput(Redirect.INHERIT)
.redirectError(Redirect.INHERIT)
.start()
if (!process.waitFor(10, TimeUnit.SECONDS)) {
@zkat
zkat / index.js
Last active March 10, 2024 14:32
npx is cool
#!/usr/bin/env node
console.log('yay gist')
anonymous
anonymous / docker-compose.yml
Created March 15, 2017 15:23
Download stack for usenet.
version: '2'
services:
nzbget:
image: "linuxserver/nzbget:latest"
environment:
- PUID=0
- PGID=0
- TZ=Europe/Amsterdam
ports:
- "6789:6789"
@simonswine
simonswine / copy-k8s-resources-across-namespaces.sh
Created August 2, 2016 13:40
Copying kubernetes resources accross namespaces
kubectl get rs,secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl create-f -
anonymous
anonymous / gist:bf6abd6d60b4abdc2d75
Created May 18, 2015 12:01
ImageProcessor service for Umbraco.Storage.S3
namespace ImageProcessor.Web.Services
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Web;
@kolodny
kolodny / bookmarklet.js
Last active February 23, 2019 17:43
Save any form to autofill for development, supports dynamic content with {{ Math.random() }} syntax
http://kolodny.github.io/bookmarklet.html
document.body.addEventListener('click', go);
alert('click on a form element to get a bookmarklet of the saved form');
function go(event) {
var form = event.target;
while (form && form.tagName !== 'FORM') {
form = form.parentNode;
}
@vsouza
vsouza / .bashrc
Last active April 9, 2024 05:27
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Web.Script.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Models;