Skip to content

Instantly share code, notes, and snippets.

View peterrus's full-sized avatar
🐧

peterrus peterrus

🐧
View GitHub Profile
@peterrus
peterrus / flask-websocket-log-stream.py
Created March 13, 2022 11:56
Runs a scheduled job in a background thread using APScheduler and streams it's output to a web client using websockets.
# Runs a scheduled job in a background thread using APScheduler and streams
# it's output to a web client using websockets. Communication between the Flask
# thread and APScheduler thread is being done through (blinker) signals.
#
# Install dependencies (preferably in your virtualenv)
# pip install flask apscheduler sqlalchemy blinker flask-socketio simple-websocket
# and then run with:
# python this_script.py
from time import sleep
@smashnet
smashnet / docker-compose.yml
Last active December 7, 2023 05:50
Docker-Compose: Mastodon v3.5.3 with Traefik v2.9
version: "3.5"
# Variables to fill in:
# Line 23: <LETSENCRYPT_MAIL_ADDRESS> - your mail address for contact with Let's Encrypt
# Line 36: <TRAEFIK_DASHBOARD_ADMIN_PASSWORD> - MD5 hash of your password (use http://www.htaccesstools.com/htpasswd-generator/)
# Line 54: <POSTGRES_PASSWORD> - the password for the postgres db. Use the same during mastodon:setup!
# Lines 31, 86, 111: <DOMAIN> - e.g. social.yourdomain.com (Must have an A record pointing to your box' IP) (AAAA for IPv6 ;)
services:
traefik:
@ipan
ipan / screen.md
Created January 18, 2018 00:48
screen or byobu scroll up and down #screen #byobu #scroll

scroll up and down

Ctrl-A [

This will activate copy mode in GNU/screen. Now, you can scroll up/down and look at your data. Use the following keys:

  1. Ctrl-u and Ctrl-d scroll the display up/down by the specified amount of lines while preserving the cursor position. (Default: half screen-full).
  2. Ctrl-b and Ctrl-f scroll the display up/down a full screen.
@pketh
pketh / 1-promises.coffee
Last active April 5, 2023 02:12
Promises in Coffeescript
# Create a promise:
myCoolPromise = new Promise (resolve, reject) ->
# do a thing
success = true
if success
resolve 'stuff worked'
else
reject Error 'it broke'
@peterrus
peterrus / AutoHotkey.ahk
Last active June 29, 2016 10:58
Maps mediakeys to page up/down home and end (Place in Documents folder and run AutoHotkey) (Special attention was given to modifier keys, because elsewise it wouldn't register the keystrokes for some reason)
Media_Next::Send {End}
Media_Prev::Send {Home}
Media_Stop::Send {PgUp}
Media_Play_Pause::Send {PgDn}
^Media_Next::Send ^{End}
^Media_Prev::Send ^{Home}
^Media_Stop::Send ^{PgUp}
^Media_Play_Pause::Send ^{PgDn}
@kennwhite
kennwhite / vpn_psk_bingo.md
Last active February 24, 2024 12:19
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion: https://twitter.com/kennwhite/status/591074055018582016

@hamen
hamen / gist:9fcb2c2fae8892172320
Last active October 24, 2023 13:22
Raspberry Pi T Cobbler GPIO Extension Board v2.2 PINs
ExtB -> GPIO
P0 = 17
P1 = 18
P2 = 27
P3 = 22
P4 = 23
P5 = 24
P6 = 25
P7 = 4
@gdetrez
gdetrez / powerline-test.sh
Last active November 19, 2023 04:07
Powerine font test
#!/bin/bash
echo -e "Powerline glyphs:\n\
Code points Glyphe Description Old code point
U+E0A0 \xee\x82\xa0 Version control branch (U+2B60 \xe2\xad\xa0 )\n\
U+E0A1 \xee\x82\xa1 LN (line) symbol (U+2B61 \xe2\xad\xa1 )\n\
U+E0A2 \xee\x82\xa2 Closed padlock (U+2B64 \xe2\xad\xa4 )\n\
U+E0B0 \xee\x82\xb0 Rightwards black arrowhead (U+2B80 \xe2\xae\x80 )\n\
U+E0B1 \xee\x82\xb1 Rightwards arrowhead (U+2B81 \xe2\xae\x81 )\n\
U+E0B2 \xee\x82\xb2 Leftwards black arrowhead (U+2B82 \xe2\xae\x82 )\n\
@suisho
suisho / load-script-recursive.coffee
Created February 20, 2013 16:13
Load hubot script recursive directory
# Description:
# Load script recursively
# Dependences:
# "glob": "~3.1.20"
Path = require "path"
Glob = require "glob"
module.exports = (robot) ->
robot.logger.info "read sub dir"
dirs = Glob.sync(__dirname+"/**/*/")
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active May 8, 2024 23:52
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S