Skip to content

Instantly share code, notes, and snippets.

@rentzsch
rentzsch / setup github issues labels.sh
Last active July 1, 2021 22:10
Shell script to set up a GitHub Project's Issues' Labels as described in <http://rentzsch.tumblr.com/post/252878320/my-lighthouse-ticket-settings-with-colors>. WARNING: script assumes a newish project that hasn't really used labels yet. It deletes all default labels, which means DATA LOSS if you've used them for anything.
USER=rentzsch
PASS=mypassword
REPO=mogenerator
# Delete default labels
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/bug"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/duplicate"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/enhancement"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/invalid"
curl --user "$USER:$PASS" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/question"
#!/bin/bash
URL=http://www.mythic-beasts.com/cgi-bin/job.pl
curl -s ${URL} |
gawk '
/Evaluate/ {
gsub (/([[:alpha:]]|[[:space:]]|[,.<>/])/,"", $0);
print $0 |& "bc";
"bc" |& getline res;
@antonioribeiro
antonioribeiro / gist:24a19f22cffd0beaa7e3
Last active September 13, 2021 19:17
The Laravel Forge, NGINX, PHP-FPM & A Blank Page Debugging Tale

After an apt-get upgrade on my Forge box, both php and nginx got upgraded, and while browsing my sites, PHP FPM was being hit by nginx, but it returned nothing, zilch, nada.

Nothing on laravel.log.

Something in the nginx log:

10.10.10.10 - - [23/Sep/2014:11:52:09 -0300] "GET / HTTP/1.1" 200 31 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
@crohr
crohr / howto-stream-tmux-session-in-realtime-over-http.md
Last active January 22, 2024 08:25
Stream a tmux session in realtime over HTTP

On the server with tmux

Create a new tmux session:

tmux new-session -s my-session # launch `top`, `htop`, or anything that will regularly updates, then detach

Stream your session:

@csonto
csonto / lvm-json
Created September 29, 2015 16:22
lvm-json
#!/usr/bin/python
import sys
import json
from lvmjson import *
import argparse
if __name__ == "__main__":
AVAILABLE_COMMANDS = ["lvs", "vgs", "pvs", "dminfo"]
@samael500
samael500 / handler.lua
Last active August 25, 2023 15:11
Validating payloads from GitHub webhooks with Nginx + Lua
-- luarocks install JSON4Lua
-- luarocks install luacrypto
local json = require "json"
local crypto = require "crypto"
local secret = '<MY SUPER SECRET>'
local event = 'push'
local branch = 'refs/heads/master'
@gomesar
gomesar / gist:f9c32463a8abbe02470b9934eeb09db5
Last active September 28, 2018 13:26
tmuxToTmuxinatorLayout.sh
#!/bin/bash
# Scritp to list tmux windows and respectives layouts inputs to tmuxinator
# shows windows number, name and TmuxinatorLayout
tmux list-windows | sed -r 's/([0-9]+: .*) \([0-9]+ panes\).*layout (.*)] @.*/\1:\n layout: \2/g'
# tmux: https://github.com/tmux/tmux/wiki
# tmuxinator: https://github.com/tmuxinator/tmuxinator
# quick profile config guide: https://fabianfranke.de/2013/11/19/use-tmuxinator-to-recreate-tmux-panes-and-windows/
@cowlicks
cowlicks / Dockerfile
Last active September 11, 2023 19:23
Safely share your SSH access while building a Dockerfile using socat to forward ssh-agent's SSH_AUTH_SOCK
FROM python:3-stretch
COPY . /app
WORKDIR /app
RUN mkdir -p /tmp
# install socat and ssh to talk to the host ssh-agent
RUN apt-get update && apt-get install git socat openssh-client \
# create variable called SSH_AUTH_SOCK, ssh will use this automatically
@alexsoin
alexsoin / setting-pandoc.txt
Created July 8, 2019 12:43
Настройки pandoc для вывода русского текста в pdf
sudo apt install texlive-xetex
sudo apt-get install texlive-lang-all
pandoc test.md -s -o test.pdf --latex-engine=xelatex
---
title: Title text
geometry: margin=2cm
lang: ru
header-includes: |
@bramford
bramford / mikrotik-rb750gr3-dnsmasq-dhcp-bootp-tftp-install.sh
Last active July 8, 2023 00:01
Install OpenWRT on Mikrotik hEX (RB750Gr3) using dnsmasq to provide DHCP/BOOTP/TFTP server
# These instructions assume the user is following the TL;DR guide for Mikrotik install:
# https://openwrt.org/toh/mikrotik/common
# 'Step-By-Step OpenWrt Installation Process on Routerboard'
# 'TL;DR: simple way for all supported models'
# Complete steps 1-4 of the guide
# On Debian host (in my case, a Lenovo Thinkpad running Debian Buster)
## Ensure WiFi is connected (as assumed) to an existing network with a WAN connection
## Take down the Wired connection