Skip to content

Instantly share code, notes, and snippets.

View pstadler's full-sized avatar

Patrick Stadler pstadler

View GitHub Profile
@dmengelt
dmengelt / docker-compose.yml
Last active November 29, 2020 20:32
a configuration to run a unifi cloud key behind traefik
version: "3.3"
services:
traefik:
image: traefik:v2.2.0
container_name: traefik
restart: unless-stopped
command:
- --log.level=DEBUG
- --api
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@topjor
topjor / wg.sh
Created February 7, 2019 20:44
Wireguard firmware sustain script
#!/bin/bash -e
BOARD=e300
if [ ! $(dpkg-query --show wireguard) ]; then
tag=$(curl "https://api.github.com/repos/Lochnair/vyatta-wireguard/releases" | jq -r '.[0].tag_name')
deb_url="https://github.com/Lochnair/vyatta-wireguard/releases/download/$tag/wireguard-$BOARD-$tag-1.deb"
curl -L -o "/tmp/wireguard-$BOARD-$tag.deb" "$deb_url"
dpkg -i "/tmp/wireguard-$BOARD-$tag.deb"
rm "/tmp/wireguard-$BOARD-$tag.deb"
source /opt/vyatta/etc/functions/script-template
configure
@schmich
schmich / ducky.md
Last active April 5, 2024 14:20
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

"use strict";
// Registering cleanup callback before requiring flightplan.
process.on("SIGINT", interruptedCleanup);
const util = require("util"),
moment = require("moment"),
_ = require("lodash"),
plan = require("flightplan"),
request = require("request-promise");
@s1lvester
s1lvester / rancheros_on_freenas.md
Last active March 23, 2021 08:36
Installing RancherOS on FreeNAS using iohyve

RancherOS on FreeNAS

Date: 2016-10-04 Version: 1.2
Author: s1lvester@bockhacker.me

This is my short documentation on how to install RancherOS on FreeNAS.

Versions used:
- RancherOS v.0.6.1
  • FreeNAS 9.10-stable
@ttscoff
ttscoff / init.lua
Last active January 9, 2024 23:44
Hammerspoon config examples for hyper key
-- A global variable for the Hyper Mode
k = hs.hotkey.modal.new({}, "F17")
-- Trigger existing hyper key shortcuts
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)
-- OR build your own
launch = function(appname)
@daviderickson
daviderickson / writes.dtrace
Last active March 5, 2022 19:34
Dtrace script to print all written-to files in FreeNAS, and their average write rate every 10 seconds.
#!/usr/sbin/dtrace -s
#pragma D option quiet
#pragma D option defaultargs
#pragma D option switchrate=10hz
#pragma D option dynvarsize=4m
#pragma D option cleanrate=30hz
dtrace:::BEGIN
{
@technovangelist
technovangelist / setup.md
Created February 12, 2016 23:17
Setting up Pushover.net and Datadog
  1. Create Pushover account
  2. Create a new Application in the Pushover site.
  3. You should now have a token and user id. You will need this for the webhook
  4. Go to the Datadog webhooks integration
  5. Enter Pushover for the name.
  6. Under URL enter `https://api.pushover.net/1/messages.json?token=YOURPUSHOVERAPPTOKEN&user=YOURPUSHOVERUSERID
  7. Under Custom Payload, enter {"title":"$EVENT_TITLE","message":"$EVENT_MSG"}
  8. Check both Use Custom Payload and Encode as form
  9. Create a monitor that notifies @webhook-pushover
  10. Boom, you are done
@socketwiz
socketwiz / cloud-config.yml
Last active April 6, 2018 06:51
CoreOS cloud-config for DigitalOcean with iptables firewall
#cloud-config
coreos:
etcd2:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
# specify the initial size of your cluster with ?size=X
discovery: https://discovery.etcd.io/<token>
# multi-region and multi-cloud deployments need to use $public_ipv4
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
initial-advertise-peer-urls: http://$private_ipv4:2380