Skip to content

Instantly share code, notes, and snippets.

@jlis
jlis / http_tunnel_via_ssh.sh
Created September 29, 2021 10:06
HTTP tunnel via SSH
# Install asyncssh (https://github.com/ronf/asyncssh) via Pip
pip3 install asyncssh
# Install pproxy (https://github.com/qwj/python-proxy) via Pip
pip3 install pproxy
# Start pproxy to connect to remote host via SSH using username and private key, listening on localhost:8080
pproxy -l http://:8080 -r ssh://<REMOTE HOST IP/HOSTNAME>/#<SSH USER NAME>::<ABSOLUTE PATH TO SSH PRIVATE KEY>
# Start pproxy to connect to remote host via SSH using username and password, listening on localhost:8080
@jlis
jlis / new_relic.rb
Created August 25, 2021 11:06
Install New Relic PHP Agent via Chef recipe
#
# Cookbook Name:: <INSERT COOKBOOK NAME>
# Recipe:: new_relic_agent
#
# Add apt repo
apt_repository 'newrelic' do
uri 'http://apt.newrelic.com/debian'
key 'https://download.newrelic.com/548C16BF.gpg'
components ['non-free']
@jlis
jlis / socks_ssh_tunnel.sh
Created June 9, 2020 10:31
SOCKS SSH Tunnel
# this opens a SOCKS tunnel on localhost:1337
ssh -D 1337 -q -C -N <user@host>
@jlis
jlis / Raspberry Pi Speedtest Cronjob.md
Last active August 2, 2023 15:31
Automated speedtest using a Raspberry Pi, Cronjobs and Airtables

Automated speedtest using a Raspberry Pi, Cronjobs and Airtables

We're gonna install the Okla Speedtest (speedtest.net) CLI and a write the results into a Airtables table.

Setup

First we're gonna install all required dependecies to run the speedtest CLI.

sudo apt-get install gnupg1 apt-transport-https dirmngr jq
@jlis
jlis / docker_prune.sh
Created February 3, 2020 13:41
Docker Prune
docker system prune -a --volumes
@jlis
jlis / push_to_new_remote.sh
Last active May 3, 2019 08:47
Push git branches to a new remote
#!/usr/bin/env bash
if [ "$1" == "" ]; then
echo "Usage: ./push_to_new_remote.sh <git folder> <name of the new git remote>"
exit 1
fi
if [ "$2" == "" ]; then
echo "Usage: ./push_to_new_remote.sh <git folder> <name of the new git remote>"
exit 1
@jlis
jlis / vue_turbolinks.js
Created February 12, 2019 09:37
Vue + Turbolinks
@jlis
jlis / loading_skeleton.css
Last active December 10, 2018 12:52
CSS loading animation
// https://css-tricks.com/building-skeleton-screens-css-custom-properties/
.loading {
position: relative;
width: 100%;
display: block;
margin: 0 0 10px;
height: 20px;
&--inner {
@jlis
jlis / ps_mem.py
Created October 15, 2018 11:31
RAM usage per program
#!/usr/bin/env python
# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The shared RAM is problematic to calculate, and this script automatically
# selects the most accurate method available for your kernel.
# Licence: LGPLv2
@jlis
jlis / clear_tmp.sh
Last active February 20, 2019 13:58
Clears /tmp files which are older than 10 days
sudo find /tmp -type f -atime +10 -delete