Skip to content

Instantly share code, notes, and snippets.

@WarpEngineer
WarpEngineer / ssl_test.sh
Created May 1, 2021 00:48 — forked from jaydansand/ssl_test.sh
Use OpenSSL to scan a host for available SSL/TLS protocols and cipher suites
#!/bin/bash
# Author: Jay Dansand, Technology Services, Lawrence University
# Date: 10/17/2014
# OpenSSL requires a port specification; default to 443.
SERVER="$1:443"
SERVER_HOST=$(echo "$SERVER" | cut -d ":" -f 1)
SERVER_PORT=$(echo "$SERVER" | cut -d ":" -f 2)
if [[ -z "$SERVER_HOST" || -z "$SERVER_PORT" ]]; then
echo "Usage: $0 host[:port] [ciphers [delay in ms]]"

gif-from-tweet

There are so many great GIFs out there and I want to have copies of them. Twitter makes that harder than it should be by converting them to MP4 and not providing access to the source material. To make it easier, I made a bash pipeline that takes a tweet URL and a filename, extracts the MP4 from that tweet and uses ffmpeg to convert back to GIF.

Dependencies

  • ffmpeg
    • macOS: brew install ffmpeg
    • Ubuntu/Debian: apt install ffmpeg
@WarpEngineer
WarpEngineer / web-servers.md
Created July 6, 2017 12:58 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
This is a tweak of https://github.com/mislav/dotfiles/blob/master/bin/tmux-vim-select-pane
which is linked from https://github.com/christoomey/vim-tmux-navigator as a possible fix for the vim integration.
I couldn't get the original one to work right on tmux 1.8 so I fixed it up.
These go into tmux config file:
bind-key -n C-h run-shell "~/tmux-vim-select-pane -L"
bind-key -n C-j run-shell "~/tmux-vim-select-pane -D"
bind-key -n C-k run-shell "~/tmux-vim-select-pane -U"
@WarpEngineer
WarpEngineer / gist:f0253ba778e47b91c214c5d3c38194b6
Created August 17, 2016 12:05
Script to fix git commit author and email.
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@WarpEngineer
WarpEngineer / ssh-menu
Last active November 14, 2015 01:12
Easily list the hosts in ssh's config file.
function ssh-menu() {
cat ~/.ssh/config | grep "^Host " | awk '{$1="";print NR,$0}' | more
}
sudo apt-mark hold packagename
sudo apt-mark unhold packagename
dpkg --get-selections | grep "hold"
Supported escape sequences:
~. - terminate session
~B - send a BREAK to the remote system
~R - Request rekey (SSH protocol 2 only)
~# - list forwarded connections
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
List all installed Linux kernel images:
dpkg --list | egrep -i --color 'linux-image|linux-headers'
Remove a single image:
apt-get --purge remove linux-image-...
Remove all:
apt-get purge $(dpkg --list |egrep 'linux-image-[0-9]' |awk '{print $3,$2}' |sort -nr |tail -n +3 |grep -v $(uname -r) |awk '{ print $2}')
@WarpEngineer
WarpEngineer / osx-for-hackers.sh
Created November 20, 2014 16:06 — forked from brandonb927/osx-for-hackers.sh
Yosemite Edition
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'