Skip to content

Instantly share code, notes, and snippets.

@dohsimpson
dohsimpson / resume.json
Last active April 6, 2024 20:23
resume.json
{
"basics": {
"name": "Joe Doe",
"label": "",
"image": "",
"email": "john@gmail.com",
"phone": "(912) 555-4321",
"url": "https://johndoe.com",
"summary": "A summary of John Doe…",
"location": {
@dohsimpson
dohsimpson / wireguard.conf
Created October 3, 2020 15:58 — forked from nealfennimore/wireguard.conf
Wireguard VPN - Forward all traffic to server
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
[Interface]
Address = 10.10.0.1/24 # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown
@dohsimpson
dohsimpson / gist:62b4bf6b028138990bb5e3fb0c0f4093
Created May 2, 2019 15:39
Install VIM8 from source (Unix)
#!/bin/bash
cd /tmp/
wget https://github.com/vim/vim/archive/v8.1.1244.tar.gz
tar xzf v8.1.1244.tar.gz
cd vim-8.1.1244/
./configure --enable-perlinterp --enable-rubyinterp --enable-python3interp --enable-luainterp
make
make install
**
*
*******
*
*****
*
******
----------
***
Django-REST-Framework
Serializers
* Notice that we're using hyperlinked relations in this case, with HyperlinkedModelSerializer. You can also use primary key and various other relationships, but hyperlinking is good RESTful design
* HyperlinkedModelSerializer:
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
@dohsimpson
dohsimpson / tmux-install-2-5.sh
Created October 13, 2018 23:02 — forked from wikrie/tmux-install-2-5.sh
Install Tmux 2.5 Ubuntu
#!/bin/bash
# Steps to build and install tmux from source on Ubuntu.
# Takes < 25 seconds on EC2 env [even on a low-end config instance].
VERSION=2.5
sudo apt-get -y remove tmux
sudo apt-get -y install wget tar libevent-dev libncurses-dev
wget https://github.com/tmux/tmux/releases/download/${VERSION}/tmux-${VERSION}.tar.gz
tar xf tmux-${VERSION}.tar.gz
rm -f tmux-${VERSION}.tar.gz
cd tmux-${VERSION}
@dohsimpson
dohsimpson / sa_application_guide.markdown
Last active November 7, 2018 01:04
SA Application Guide

PostgreSQL

Create User

$ sudo -u postgres createuser -P cronly
$ sudo -u postgres psql
psql (10.5 (Ubuntu 10.5-2.pgdg16.04+1))
Type "help" for help.

postgres=# ALTER USER my_username WITH PASSWORD 'my_password';
ALTER ROLE
@dohsimpson
dohsimpson / advanced_search.markdown
Last active March 18, 2024 10:18
Advanced Search Tricks

Google

  • "cocotte bag": exact match
  • "* is thicker than water": * to replace a phrase inside exact match
  • jaguar -car: minus to filter out matches
  • site:time.com google: search on site, you don't need '.', e.g. 'site:gov'
  • define:bae: check definition, even for slang
  • $0..$50: numeric range (ignore $)
  • "inbound marketing" ~professional: synonyms
  • related:nationalgeographic.com: similar sites
@dohsimpson
dohsimpson / better_than_self.txt
Last active April 1, 2018 21:30
Better Than Self Hosted
* BitTorrent (or http) Download: 百度盘离线下载
* Voip: GMail -> Hangout
@dohsimpson
dohsimpson / docker-tools.txt
Created March 20, 2018 12:09
Docker Tools
composerize: turn docker cli command into docker-compose file
* composerize docker run -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always --log-opt max-size=1g nginx