Skip to content

Instantly share code, notes, and snippets.

@meyju
meyju / 1-setup.md
Created April 14, 2020 06:44 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or Krypt.co.

@meyju
meyju / encrypt_openssl.txt
Created November 14, 2018 09:10 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL
For symmetic encryption, you can use the following:
To encrypt:
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt:
openssl aes-256-cbc -salt -a -d -in encrypted.txt -out plaintext.txt
For Asymmetric encryption you must first generate your private key and extract the public key.
@meyju
meyju / tmux-cheatsheet.markdown
Created July 8, 2018 11:22 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@meyju
meyju / iframe_rotator.html
Created May 7, 2018 19:14
iframe Rotator with preload of next frame
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body,
html {
margin: 0;
padding: 0;
map $http_x_request_id $uuid {
default "${request_id}";
~* "${http_x_request_id}";
}
server {
listen 80;
server_name _;
proxy_set_header X-Request-ID $uuid;
@meyju
meyju / bash_installer.sh
Last active May 13, 2017 12:31
Wget Bash Installer done right
# Transfer this over a secure connection, e.g. https
wget -q -O bash_installer.sh https://example.com/bash_installer.sh && \
echo "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 bash_installer.sh" | sha256sum -c && \
chmod +x ./bash_installer.sh && \
./bash_installer.sh
@meyju
meyju / .bash_profile
Created October 5, 2016 07:04
bash session auto record with script
# Script Record
TIMESTAMP=$(date "+%Y%m%d-%H%M%S")
script -q -f -t /home/test/.script/script-${TIMESTAMP}.log 2> /home/test/.script/script-${TIMESTAMP}.time.log && exit
@meyju
meyju / get_file_body.sh
Created August 18, 2016 11:33
get file from line to line
#! /bin/env bash
filename=$1
firstline=$2
lastline=$3
# Usage: ./get_file_body.sh 10 15 access.log
awk -vs="$firstline" -ve="$lastline" 'NR>=s&&NR<=e' "$filename"
@meyju
meyju / cleanup.sh
Last active July 14, 2016 08:46
Remove all files older than X days, but keep at least the Y youngest
KEEP=2 OLDERTHEN=4;find /backups/ -type f -mtime +${OLDER} -printf '%T@ %p\n'|sort -nr | tail -n +${KEEP}|awk '{print $2}'|xargs -r rm -f
# For Crontab: escape the % in printf option => -printf '\%T@ \%p\n'
@meyju
meyju / gist:fe53b2e67c358f57221b
Created February 3, 2016 08:20
multiple ssh config
alias ssh="cat ~/.ssh/config.d/* > ~/.ssh/config; ssh"