Skip to content

Instantly share code, notes, and snippets.

View fijimunkii's full-sized avatar
🦁
𐂃͠

Harrison Powers fijimunkii

🦁
𐂃͠
View GitHub Profile
@fijimunkii
fijimunkii / gui-docker.md
Created July 26, 2019 20:01 — forked from rizky/gui-docker.md
Running Graphical applications in Docker for Mac

Setup

Docker for Mac lets you run any Linux executable in an isolated process on Mac. A graphical app is just another process, that needs access to the X11 socket of the system, or an X11 server. You can run X11 applications on a Mac using an open source project called Xquartz. The steps to expose XQuartz to a Linux process running in Docker are simple:

  1. install XQuartz from xquartz.org. Note: you need to install XQuartz version 2.7.10, version 2.7.11 does not work with Docker for Mac. Then you have 3 choices:
  2. Proxy the XQuartz socket to port 6000 or
  3. Tell Xquartz to accept network calls. This is not very secure.
  4. Tell Xquartz to accept network calls and require authentication, setup X11 security using xauth, and mount ~/.Xauthority in the container.
@fijimunkii
fijimunkii / gist:211e96e24598c2c041f0238b0c6ae151
Created August 10, 2018 03:58 — forked from khakimov/gist:3558086
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@fijimunkii
fijimunkii / find_networks.sh
Created July 16, 2018 14:30 — forked from afresh1/find_networks.sh
A script to find and connect to known wifi networks on OpenBSD. Works for me on my iwn card in my laptop
#!/bin/sh
# find_network.sh - An OpenBSD Wireless Network configurator
# Looks for available networks listed at the end of the script
# Use this by adding "!/path/to/find_network.sh \$if" to your wlan hostname.if
if=$1
if [ -z "$if" ]; then
echo "Usage: $0 interface" >&2
exit 2;
fi
@fijimunkii
fijimunkii / uid_awk.sh
Created June 22, 2018 19:06 — forked from staaldraad/uid_awk.sh
Get the uid, gid and user groups without touching /etc/passwd or running the `id` command
awk -F: 'END {print "uid:"u" gid:"g" groups:"gg}{if($1=="Uid"){split($2,a," ");u=a[1]}if($1=="Gid"){split($2,a," ");g=a[1]}if($1=="Groups"){gg=$2}}' /proc/self/status
@fijimunkii
fijimunkii / awk_netstat.sh
Created June 22, 2018 19:06 — forked from staaldraad/awk_netstat.sh
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
@fijimunkii
fijimunkii / google-authenticator.md
Created March 23, 2018 19:27 — forked from troyfontaine/google-authenticator.md
Getting Google Authenticator working on Ubuntu for SSH Authentication

Google Authenticator for SSH How-To

Installing the Google Authenticator pam package alone does not configure a system for 2 Factor Authentication when connecting via SSH.

Overview

The Google Authenticator package can be installed on Ubuntu via apt-get on Ubuntu 14.04.3 and later (that I've confirmed).

It provides a pam module that allows you to prompt a user for a code generated via a Google Authenticator app or other compatible TOTP app (such as 1Password). The script below enables the authenticator prompt when using ssh and password authentication.

A few things to keep in mind:

  • You cannot enable Google Authenticator for Public Key-based authentication at the same time as Password-based authentication
@fijimunkii
fijimunkii / mount_ebs.sh
Created March 22, 2018 19:18 — forked from stingh711/mount_ebs.sh
How to mount another EBS as /var on EC2 (ubuntu)
#!/bin/bash
#attach the EBS to /dev/sdf before running it
#format EBS
mkfs -t ext4 /dev/xvdf
#copy original /var to /dev/xvdf
mkdir /mnt/new
mount /dev/xvdf /mnt/new
cd /var
@fijimunkii
fijimunkii / aws-temp-token.sh
Created February 22, 2018 15:04 — forked from ogavrisevs/aws-temp-token.sh
Script to generate AWS STS token
#!/bin/bash
#
# Sample for getting temp session token from AWS STS
#
# aws --profile youriamuser sts get-session-token --duration 3600 \
# --serial-number arn:aws:iam::012345678901:mfa/user --token-code 012345
#
# Based on : https://github.com/EvidentSecurity/MFAonCLI/blob/master/aws-temp-token.sh
#
@fijimunkii
fijimunkii / readme.md
Created December 19, 2017 21:54 — forked from max-mapper/readme.md
Video stabilization using VidStab and FFMPEG (Mac OS X)

Video stabilization using VidStab and FFMPEG

Examples here use the default settings, see the VidStab readme on GitHub for more advanced instructions.

Here's an example video I made

Install ffmpeg with the vidstab plugin from homebrew

brew install ffmpeg --with-libvidstab