Skip to content

Instantly share code, notes, and snippets.

@suplo
suplo / commands.md
Created April 6, 2017 08:33
useful commands

flush dns cache

dscacheutil -flushcache; sudo killall -HUP mDNSResponder
@suplo
suplo / .bash_profile
Created March 17, 2017 05:46
CentOS ssh-agent ForwardAgent
exec ssh-agent $BASH -s 10<&0 << EOF
ssh-add ~/.ssh/id_rsa &> /dev/null
exec $BASH <&10-
EOF
@suplo
suplo / README.md
Created February 24, 2017 01:12 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.
@suplo
suplo / music.md
Created February 9, 2017 06:11 — forked from staltz/music.md
coding music

Not for everyone. Each programmer has their own appreciation of what is good coding music.

For when I need to think deep, debug something, or design

(From most influential to least)

@suplo
suplo / terminal.md
Created January 5, 2017 06:04
Getting around "su: must be run from a terminal"

Solution to su: must be run from a terminal when working in reverse shell (PHP).

echo "import pty; pty.spawn('/bin/bash')" > /tmp/asdf.py
python /tmp/asdf.py

Reference

@suplo
suplo / gist:f6a91a4b1b36056e79171f069fec07a4
Created December 19, 2016 06:10
Sum of longest prefix-suffix strings
/**
* Finding sum of longest prefix-suffix strings in a string S
*
* A prefix string of string S is S[0..i]
* A suffix string of string S is S[i..n-1] (n = S's length)
*
* Longest prefix-suffix of a string is max value k where
* suffix[0..k-1] == prefix[0..k-1]
*
* @param {[string]} S [Input string]
@suplo
suplo / vcode.md
Last active May 23, 2024 22:48
Quick hack to open vscode from fish shell

The code extension does not allow me to open folder with vscode from command line.
Solution: Add the following function to ~/.config/fish/config.fish

function vcode
  open -a "Visual Studio Code.app" $argv
end

then using vcode $folder to open $folder

@suplo
suplo / enable_screensharing.md
Last active November 8, 2016 05:54
Enable screen sharing from command line OSX
@suplo
suplo / com.docker.machine.default.plist
Created November 2, 2016 09:38
Run docker-machine at startup in OS X
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>{{ INSERT_PATH_HERE }}</string>
</dict>
<key>Label</key>

Notice

This script is no longer required with Docker for Mac which includes an option to run Docker at startup and doesn't use docker-machine to administer the local Docker engine.

Requirements

  • Docker Machine + Docker
  • curl
  • A Virtualbox-driven Docker Machine called "default" docker-machine create --driver virtualbox default (this is the default with Docker toolkit).