Skip to content

Instantly share code, notes, and snippets.

View Starefossen's full-sized avatar
🚀
Building platforms for the Norwegain Government

Hans Kristian Flaatten Starefossen

🚀
Building platforms for the Norwegain Government
View GitHub Profile
@Starefossen
Starefossen / virtualbox-list-usb.sh
Created October 1, 2013 19:04
List available USB devices using VirtualBox's VBoxManage CLI interface
VBoxManage list usbhost
@Starefossen
Starefossen / count-connections-from-ip.sh
Last active December 24, 2015 01:29
Count number of open connections from one IP
netstat -tap | grep 127.0.0.1 | wc -l
@Starefossen
Starefossen / gist:6724397
Created September 27, 2013 05:04
Find process listening on port 80
netstat -tulpn | grep :80
@Starefossen
Starefossen / gist:6699580
Last active June 22, 2022 12:37
Command line HTTP POST with custom headers and JSON payload using CURL
curl -X POST \
-H "X-Parse-Application-Id: $APP_ID" \
-H "X-Parse-REST-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{"score": 1337, "playerName": "Sean Plott", "cheatMode": false }' \
https://api.parse.com/1/classes/GameScore
@Starefossen
Starefossen / git-ignore-modified
Created September 13, 2013 08:30
Ignore modified file in git
git update-index --assume-unchanged path/to/file
@Starefossen
Starefossen / vim-cheats.md
Last active May 21, 2024 18:27
My vim cheat sheet for working with tabs and window splits.

Tabs

New Tab

  • :tabnew - new blank tab
  • :tabedit [file] - open file in tab

Cursor Movement

  • gt (:tabn) - next tab
@Starefossen
Starefossen / tmux-cheats.md
Last active May 13, 2024 15:56
My personal tmux cheat sheet for working with sessions, windows, and panes. `NB` I have remapped the command prefix to `ctrl` + `a`.

Sessions

New Session

  • tmux new [-s name] [cmd] (:new) - new session

Switch Session

  • tmux ls (:ls) - list sessions
  • tmux switch [-t name] (:switch) - switches to an existing session
@Starefossen
Starefossen / cmd-count-lines.sh
Created June 19, 2013 09:17
count lines from command output
cmd | wc -l
@Starefossen
Starefossen / vim-copy-paste.sh
Created June 19, 2013 08:09
vim copy / paste auto indent
:set paste # disables autoindent
:set nopaste # enables autoindent
@Starefossen
Starefossen / find-replace.sh
Created June 19, 2013 08:08
find / replace file
sed -i ‘s/[orginal_text]/[new_text]/’ filename.txt