Skip to content

Instantly share code, notes, and snippets.

View lloydroc's full-sized avatar

Lloyd Rochester lloydroc

  • Denver, Colorado
View GitHub Profile
@lloydroc
lloydroc / unix_network.sh
Last active June 22, 2016 22:06
Network Commands
#!/bin/sh
arping -I eth0 -c 3 10.203.167.71
ifconfig eth0:ncsvip 10.203.167.72 netmask 255.255.255.192 broadcast 10.203.167.127
@lloydroc
lloydroc / neutron_floating_ip.sh
Created June 22, 2016 22:34
Create floating ip in Openstack/Neutron
!#/bin/sh
neutron net-list # find the list the compute hosts are on
neutron port-create --name nso-vip 0d7f88a9-09a6-4cb4-8b08-eae94ece9f97 --fixed-ip ip_address=10.114.195.172 # create a port for the vip
neutron port-update 2f8c9163-b71f-4c0e-8f1e-751aec8127e9 --allowed-address-pairs type=dict list=true ip_address=10.114.195.172 # add allowed address pairs (do for both ports)
@lloydroc
lloydroc / search_replace.sh
Last active June 23, 2016 15:16
Search Replace Multiple Files
perl -pi -w -e 's/search/replace/g;' $( grep -rl 'search' . )
# Perl arguments
# -e means execute the following line of code.
# -i means edit in-place
# -w write warnings
# -p loop over the input file, printing each line after the script is applied to it.
# Grep Arguments
# r is recursive which defaults to NOT following symbolic links
# l is listing the file names only
# the . is the directory you want to search in
@lloydroc
lloydroc / jsonrpc.sh
Created July 7, 2016 18:40
JSON RPC
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
"jsonrpc":"2.0",
"id":1,
"method":"login",
"params":{
"user":"admin",
"passwd":"admin"
}
}' "http://localhost:8080/jsonrpc/"
@lloydroc
lloydroc / opts.sh
Created July 15, 2016 04:32
Changing Java Install Version in Unix
/sbin/alternatives --config java
/sbin/alternatives --config javac
@lloydroc
lloydroc / sniff.sh
Created July 30, 2016 20:56
Sniff iPhone Packets
Connect your iOS device by USB
UDID=<get from xcode>
ADDR=<address of iphone>
rvictl -s $UDID # where UDID is the UDID of your device (located in XCode under Devices, shortcut to with ⇧⌘2)
sudo launchctl list com.apple.rpmuxd
sudo tcpdump -n -t -i rvi0 -q tcp or $ sudo tcpdump -i rvi0 -n
sudo tcpdump 'src $ADDR' -i rvi0 -n -A -w blah.txt
@lloydroc
lloydroc / config
Created August 1, 2016 21:11
ssh-config
Host x
User y
HostName z
ProxyCommand ssh jumpX@jumpHost nc %h %p 2> /dev/null
@lloydroc
lloydroc / fetch-nasdaqtraded.sh
Created August 1, 2016 21:14
Fetch stocks on the NASDAQ and backup yesterdays fetched
mv /srv/nasdaqtraded.txt /srv/nasdaqtraded.txt`date --date="yesterday" +"%m-%d-%Y"`
wget ftp://ftp.nasdaqtrader.com/SymbolDirectory/nasdaqtraded.txt
mv nasdaqtraded.txt /srv/nasdaqtraded.txt
@lloydroc
lloydroc / NasdaqTickerFetcher.scala
Last active August 11, 2016 22:41
Scala program that fetches traded stock tickers and ETFs from the NASDAQ, note other exchanges like NYSE are also in this file.
import scala.language.postfixOps
import sys.process._
object NasdaqTickerFetcher extends App {
val tickers = "wget ftp://ftp.nasdaqtrader.com/SymbolDirectory/nasdaqtraded.txt"!!;
println(tickers)
}
@lloydroc
lloydroc / TickerParser.scala
Created August 7, 2016 02:21
Parses all non-ETF tickers from the NASDAQ FTP server, has other exchanges like ETFs as well
// Nasdaq Traded|Symbol|Security Name|Listing Exchange|Market Category|ETF|Round Lot Size|Test Issue|Financial Status|CQS Symbol|NASDAQ Symbol|NextShares
// 1 - Nasdaq Traded
// 2 - Symbol
// 3 - Security Name
// 4 - Listing Exchange
// 5 - Market Category
// 6 - ETF
// 7 - Round Lot Size
// 8 - Test Issue
// 9 - Financial Status