Skip to content

Instantly share code, notes, and snippets.

View ypid's full-sized avatar

Robin Schneider ypid

View GitHub Profile
@sj26
sj26 / LICENSE.md
Last active November 6, 2024 21:56
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

@MoOx
MoOx / index.js
Last active November 14, 2024 22:42
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@florianbeer
florianbeer / set-tmux-title
Created April 21, 2015 10:47
Set tmux pane title to short hostname on ssh connections
ssh() {
if [ "$(ps -p $(ps -p $$ -o ppid=) -o comm=)" = "tmux" ]; then
tmux rename-window "$(echo $* | cut -d . -f 1)"
command ssh "$@"
tmux set-window-option automatic-rename "on" 1>/dev/null
else
command ssh "$@"
fi
}
_qvm-run() {
local app_vms
app_vms=( $(qvm-ls --raw-list|grep -v "^dom0$") )
local exc=
if (( words[(I)--all] )); then
exc="*--exclude=[When --all is used: exclude this VM name (may be repeated)]:QubesVMs:($app_vms)"
fi
_arguments -S '(-a --auto)'{-a,--auto}'[Auto start the VM if not running]'\
@shabbyrobe
shabbyrobe / decode.py
Created October 6, 2014 23:31
Hacky Ansible decode module for binary encoded vault data
#!/usr/bin/python
import os
import time
import tempfile
import hashlib
import base64
filters = {
'base64': base64.b64decode,
@CMCDragonkai
CMCDragonkai / sed-simple.sh
Last active August 23, 2022 05:32
BASH: Sed Simple Literal Text Search & Replace (does not support new lines)
function sed-keyword-escape {
echo $1 | sed -e 's/[]\/$*.^|[]/\\&/g'
}
function sed-replace-escape {
echo $1 | sed -e 's/[\/&]/\\&/g'
}
function sed-easy {
sed -i "s/$(sed-keyword-escape $1)/$(sed-replace-escape $2)/g" $3
@thom-nic
thom-nic / Dockerfile
Last active August 13, 2020 14:35
Dockerfile that attempts to run the app as non-root user. This creates a `node` user & sets permissions on app files. Note you cannot `chown` files in a docker 'volume' during the build process, but you can at runtime (as part of your `CMD`) but in that case you can't use the `USER` command to change the UID before `CMD` runs.
###
# Node.js app Docker file
#
# Some basic build instructions:
# ```
# # you should delete node_modules b/c you don't want that copied during 'ADD'
# docker build -t thom-nic/node-bootstrap .
# # run a shell in the container to inspect the environment (as root):
# docker run --rm -itu root thom-nic/node-bootstrap /bin/bash
# ```
; ___ _ __ ___ __ ___
; / __|_ _ __ _| |_____ / /| __|/ \_ )
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
; |___/_||_\__,_|_\_\___\___/___/\__/___|
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself
; to learn a little bit about assembly. I **think** I understood everything, but I may
; also be completely wrong :-)
@akorobov
akorobov / ipv6-httpd.py
Created December 11, 2013 00:58
quick ipv6 http server using python's SimpleHttpServer
import socket
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
class MyHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/ip':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
@simonmorley
simonmorley / gist:7224897
Last active June 4, 2017 16:44
Nginx configuration for a secure kibana, elasticsearch setup. Version 1, no way finished.
server {
listen 8443 default ssl;
server_name www.yourdomain.com;
ssl on;
ssl_certificate /etc/nginx/conf.d/cert.pem;
ssl_certificate_key /etc/nginx/conf.d/cert.key;
client_max_body_size 50M;
error_log /var/log/nginx/elasticsearch-errors.log;