Skip to content

Instantly share code, notes, and snippets.

View shadowbq's full-sized avatar
👔
Doing Things

shadowbq shadowbq

👔
Doing Things
View GitHub Profile
$ yum update
$ sudo yum install gcc libtool perl-core zlib-devel openssl-devel libxslt-devel libxml-devel libyaml-devel -y
$ sudo update-ca-trust
$ cd /usr/src/
$ wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
$ tar zxvf Python-2.7.10.tgz
$ cd Python-2.7.10/
$ ./configure
@shadowbq
shadowbq / vmkernel_prep.sh
Last active March 11, 2018 22:42
AskUbuntu SO #966585 - Post Kernel Upgrade
#!/usr/bin/env bash
# Must be run as root / sudo
# Reference: https://askubuntu.com/questions/966585/ubuntu-17-10-upgrade-broke-vmware-workstation-12-5
if [ $(dpkg-query -W -f='${Status}' linux-headers-generic 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
echo "Kernel Headers Package Missing"
echo "apt-get install linux-headers-generic";
exit 1
fi
NetworkFlow process, process_id where NetworkFlow src_ip contains 10.250.45.0/24
and NetworkFlow dst_ip equals 10.0.0.2
CurrentFlow process_id where CurrentFlow local_ip contains 10.250.45.0/24 and
CurrentFlow remote_ip equals 10.0.0.2
Indicator type Indicator Description
FileHash-SHA256 426142a23d356f105dfdfa27e9855d3ee47fe7149a502e9eb3cde1f368025fee
FileHash-SHA256 f82e90c02b05f86cd720f7f15667356a7e997c5cf13a1d6f6492db0c5ffbe6a2
domain sqnhh67wiujb3q6x.onion
FileHash-MD5 bda230a18d42aabca4b6b9ccdd62dedd
FileHash-MD5 d5bc571d34a80fc91ed6189f50b47772
FileHash-SHA1 1eb97c7ca98e75d64ad2d7b1ec5d5f6a67bb5c30
FileHash-SHA1 6b1589c5cd84d52ee091580355e99c9560064ebb
domain fxn5ao5mmaktpsug.onion
@shadowbq
shadowbq / update_cloudwatch_vpncount
Last active June 8, 2016 21:05
describe ipsec vpns for aws
#!/usr/bin/python
import boto.ec2.cloudwatch
import boto.vpc
AWS_Regions=["us-east-1","us-west-2","us-west-1","eu-west-1","ap-southeast-1","ap-northeast-1","ap-southeast-2","sa-east-1","eu-central-1"]
#AWS_Regions=boto.ec2.regions()
CloudWatch_Region="us-east-1"
cw = boto.ec2.cloudwatch.connect_to_region(CloudWatch_Region)
for region in AWS_Regions:
@shadowbq
shadowbq / app.rb
Last active December 10, 2015 18:49
Email Backtraces if an exception occurs in Production, else just show the user..
require 'bundler' # gem requires
Bundler.require(:default, ENV['RACK_ENV'].to_sym) # only loads environment specific gems
if ENV['RACK_ENV'] == 'production' # production config / requires
require './lib/middleware/exceptionmailer'
use Rack::ExceptionMailer,
:to => ['me@example.com'],
:from => 'service@example.com',
:subject => 'Error Occurred on Rack Application'
require 'rubygems'
require 'sqlite3'
require 'rest-assured'
require 'pry'
RestAssured::Server.start(port: 7899)
@double = RestAssured::Double.create(:fullpath => '/some/api')
@double = RestAssured::Double.create(:fullpath => '/some/api2', :response_headers => { 'Content-Type2' => 'text/html' })
@shadowbq
shadowbq / GITHUB-SUBMODULE-PR-README.md
Created July 16, 2015 15:25
Adding a submodule to existing 3rd party repo via pull request

Fork the hack-night (https://github.com/rubyloco/hack-night.git) on github to your account (ala https://github.com/shadowbq/hack-night.git)

Using the shell download your clone, create/switch to your topic branch, add your submodule, commit it, push it to your account.

git clone https://github.com/shadowbq/hack-night.git
cd hack-night/
git remote add upstream https://github.com/rubyloco/hack-night.git
git fetch upstream
git checkout -b shadowbq-loco-flag upstream/master
@shadowbq
shadowbq / restart_worker.rb
Last active August 29, 2015 14:24
find and kill all old worker.rb and restart in context
#!/bin/sh
# Ubuntu tested 14.04.2
# root@downloader:/usr/local/www/ydl# ps -U www-data -u www-data ajf |grep 'worker.rb' |grep -v 'grep'
# 1 10193 10185 1320 pts/0 10440 Sl 33 0:00 ruby ./worker.rb
# 1 10163 10155 1320 pts/0 10440 Sl 33 0:00 ruby ./worker.rb
echo 'killing old proc'
ps -U www-data -u www-data ajf |grep 'worker.rb' |grep -v grep | awk -F ' ' '{print $3}'| xargs -I {} kill -9 -{}
echo 'starting worker'
sudo -u www-data sh -c 'nohup ./worker.rb >> logs/worker.log &'
@shadowbq
shadowbq / gem_hunt.sh
Created May 23, 2015 15:54
find shebangs that are explict .. and likely wrong.
#!/usr/bin/env bash
#
# Find FreeBSD gems that are hardcoded to a ruby minor version
# example: /usr/local/bin/ruby20
find /usr/local/bin/ -type f | xargs file | grep Ruby | awk 'BEGIN { FS = ":" }; { print $1 }' |xargs head -1