Skip to content

Instantly share code, notes, and snippets.

@kitingChris
kitingChris / pyenv-python-install.sh
Last active August 16, 2023 15:36
Install pyenv and python 3.10 on Ubuntu
## Basic requirements for python development
sudo apt-get install build-essential zlib1g-dev libffi-dev libssl-dev libbz2-dev libreadline-dev libsqlite3-dev liblzma-dev
## Tkinter support
sudo apt-get install tk-dev
## PyAudio support
sudo apt-get install portaudio19-dev
## ffmpeg support
@kitingChris
kitingChris / docker-entrypoint.sh
Created March 2, 2022 19:39
docker-entrypoint.sh for ReactApps with pm2 and environment variable substitution on startup
#!/usr/bin/env sh
env | grep "REACT_APP_" | while IFS= read -r line; do
var=${line%%=*}
val=$(printf '%s\n' "${line#*=}" | sed -e 's/[\/&]/\\&/g')
find . -type f -regex '.*\.\(html\|js\|js\.map\|css\|css\.map\|json\|svg\)' \
-exec sed -i "s/{{$var}}/$val/g" {} +
done
command -v pm2 > /dev/null && status="$?" || status="$?"
@kitingChris
kitingChris / idea.sh
Created May 8, 2021 18:37
Launching current Intellij Idea version
#!/usr/bin/env bash
$($(cat /usr/local/share/applications/jetbrains-idea.desktop ~/.local/share/applications/jetbrains-idea.desktop 2>/dev/null | grep -m1 -Eo '^Exec="(.*)"' | cut -d'"' -f2) "$@")
@kitingChris
kitingChris / stash-pop-recover
Created May 23, 2019 16:15 — forked from davidwalter0/stash-pop-recover
Undoing accidental git stash pop
# https://stackoverflow.com/questions/6543519/undoing-accidental-git-stash-pop
# https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git
accepted
If you have only just popped it and the terminal is still open, you will still have the hash value printed by git stash pop on screen (thanks, Dolda).
Otherwise, you can find it using this for Linux and Unix:
git fsck --no-reflog | awk '/dangling commit/ {print $3}'
and for Windows:
@kitingChris
kitingChris / arch-linux-install
Last active March 14, 2019 21:12 — forked from binaerbaum/arch-linux-install
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set german keymap
@kitingChris
kitingChris / boilerplate-shell-script.sh
Created November 13, 2018 16:25
BOILERPLATE SHELL SCRIPT TEMPLATE
#!/usr/bin/env bash
# ##################################################
# My Generic BASH script template
#
version="1.0.0" # Sets version variable
#
scriptTemplateVersion="1.3.0" # Version of scriptTemplate.sh that this script is based on
# v.1.1.0 - Added 'debug' option
# v.1.1.1 - Moved all shared variables to Utils
sudo chmod go-w ~/ && \
sudo chmod 600 ~/.ssh/* && \
sudo chmod 644 ~/.ssh/*.pub && \
sudo chmod -f 644 ~/.ssh/authorized_keys && \
sudo chmod 644 ~/.ssh/known_hosts && \
sudo chmod 700 ~/.ssh && \
sudo chown $(id -un):$(id -gn) ~/.ssh
@kitingChris
kitingChris / luksmount
Last active September 10, 2017 15:03
LUKS Mount & Umount scripts
#!/bin/bash
# ------------------------------------------------------------------
# [Christian Ego] luksmount
# Mounts an encrypted LUKS container
# ------------------------------------------------------------------
HELP="\n
Usage:\n
\t$(basename $0) [FILE] [MOUNTPOINT] [FILESYSTEM]\n
\n
@kitingChris
kitingChris / tmux-cheatsheet.markdown
Created December 8, 2016 13:08 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@kitingChris
kitingChris / calibre
Last active November 1, 2016 11:12 — forked from razrichter/calibre
Calibre Server upstart script
#! /bin/sh
### BEGIN INIT INFO
# Provides: calibre
# Required-Start: network
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Controls the Calibre content server
# Description: Controls the Calibre content web server
#