Skip to content

Instantly share code, notes, and snippets.

Avatar
🀄
Focusing

Per Guth perguth

🀄
Focusing
View GitHub Profile
@perguth
perguth / nano
Last active Sep 13, 2019
⏲️📝 Back ups every file that gets touched by `nano`.
View nano
#!/bin/sh
# Back ups every file that gets touched by `nano`.
# Install by:
# 1. `sudo mv /bin/nano /bin/nano-real`
# 2. Put this file in `/usr/local/bin` and make it executable.
# 3. Set your user:
backupFolder=$HOME/.system-changes
currentFolder=$(pwd)
@perguth
perguth / computer
Last active Jul 23, 2019
Sleep host when Mosh is idle. Wake up on reconnect.
View computer
#!/bin/sh
wake-computer
echo 🚀 Connecting Mosh.
mosh user@computer.y
@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active May 9, 2021
Let's Encrypt Nginx setup with Ansible
View Ansible Let's Encrypt Nginx setup
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@ldong
ldong / download_egghead_videos.md
Last active Feb 17, 2021
download egghead videos
View download_egghead_videos.md

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

$.each($('h4 a'), function(index, video){
  console.log(video.href);
});
@kyledrake
kyledrake / ipfs-refs-daemon.sh
Last active Aug 18, 2019
IPFS replication service with one line of unix shell code!
View ipfs-refs-daemon.sh
#!/bin/bash
# First, install ncat: http://nmap.org/ncat/
# Usually comes with the 'nmap' package on distributions.
ncat -k -v -l -p 5555 -c 'ipfs refs local | gzip'
# To retrieve on the client machine:
# nc 127.0.0.1 5555 | gunzip | ipfs pin add -r
@dylansmith
dylansmith / npm_userspace.sh
Created Jan 12, 2015
Configure npm to install global modules to userspace (set npm prefix to ~/npm)
View npm_userspace.sh
#!/bin/bash
DIR=~/npm
if [[ ! -e $DIR ]]; then
mkdir $DIR
elif [[ ! -d $DIR ]]; then
echo "$DIR exists but is not a directory" 1>&2
exit 1
fi
@9point6
9point6 / ssh-retry.sh
Last active Apr 13, 2021
Keep retrying SSH connection until success (Useful for waiting for VMs to boot)
View ssh-retry.sh
#!/usr/bin/env bash
# Check we've got command line arguments
if [ -z "$*" ] ; then
echo "Need to specify ssh options"
exit 1
fi
# Start trying and retrying
((count = 100))
View channel-op-cheatsheet.md

channel operator quick reference

direct discussion about administrative action away from the main channel and into #reddit-diabetes-ops to minimise disruption. our -ops channel is the place where users should come to ask for our help. examples:

  • any sort of operator request or discussion of channel administration in the main channel
  • PMs asking why a ban was set
  • reports of harassment (unless the user is confiding in you)
  • any request for operator action

changing channel access permissions

@staltz
staltz / introrx.md
Last active May 10, 2021
The introduction to Reactive Programming you've been missing
View introrx.md
@gavinhungry
gavinhungry / nginx-tls.conf
Last active May 5, 2021
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
View nginx-tls.conf
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#