Skip to content

Instantly share code, notes, and snippets.

@OrangeCrush
OrangeCrush / napsack.js
Created November 30, 2018 19:00
My Solution to the classic napsack problem
// Dollars to notebooks
var valueMap = {
5: 6,
10: 13,
1: 1
};
// How much money you are allowed
var money = 17;
@OrangeCrush
OrangeCrush / nmap.md
Last active April 22, 2016 01:18
Nmap for newbies

Nmap for newbies

Reverse DNS scan

nmap -sL 192.168.1.0/24

Ping scan (skip port scan)

nmap -sn 192.168.1.0/24
@OrangeCrush
OrangeCrush / centos7-kvm.sh
Created March 1, 2016 02:03
centos7-kvm.sh
#!/bin/bash
VM_NAME=$1
INSTALL_HOST=$2
virsh destroy $VM_NAME
virsh undefine $VM_NAME
virt-install \
--network bridge:br0 \
#!/bin/bash
#
# TODO Figure out how to get an unattended install
#
VM_NAME=$1
virsh destroy $VM_NAME
virsh undefine $VM_NAME
@OrangeCrush
OrangeCrush / tmux-notes.md
Last active December 21, 2019 11:49
Tmux Notes

Tmux 101

Why you should use tmux

  • Detachable for long running scripts / workloads
  • Organize your work
  • Remember what you were working on last
  • Type in your password less
  • Keep your ssh sessions alive when transporting laptop
  • Sync panes to work in multiple at once
  • Look like a hacker
@OrangeCrush
OrangeCrush / panes.sh
Last active April 23, 2016 07:19
Create multiple tmux panes with a SERVER variable
#!/bin/bash
#
# I like to run this like
# cat serverfile | xargs ./panes.sh name-of-pane
#
NAME=$1
shift
if [ $# == 0 ]
# Mount an nfs via an iface hotplug
IP_ADDR=0.0.0.0
NFS_MOUNT=/media
MOUNT=/nfs-share
mkdir -p $MOUNT
mount -t nfs -o nolock $IP_ADDR:/$NFS_MOUNT $MOUNT
#!/bin/bash
#
# Randomly change wallpaper.
#
# Pass the directory to serve files from as the first arg
#
PICDIR=$1
@OrangeCrush
OrangeCrush / belkin-2-way-usb-thing.txt
Created August 9, 2015 02:06
How to use a belkin two way usb adapter
1) Plug it in
2) ifconfig -a (note the new usb[0-9]+ interface)
3) on each computer
ip link set up usb0
ip addr add 10.10.10.[0-9] dev usb0
ip route add 10.10.0.0/16 dev usb0
4) ping to verify
package chat
import "net/http"
import "sync"
import "html/template"
import "time"
import "strings"
type chatpost struct{
text string
when time.Time