Skip to content

Instantly share code, notes, and snippets.

View Sjeanpierre's full-sized avatar
💭
🤷🏿‍♂️

Stevenson Jean-Pierre Sjeanpierre

💭
🤷🏿‍♂️
View GitHub Profile
@Sjeanpierre
Sjeanpierre / athena_ddl
Created December 6, 2018 06:26
Cloudflare logs Athena DDL - Create Athena schema for Cloudflare logs
CREATE EXTERNAL TABLE `cf_logs`(
`cachecachestatus` string COMMENT 'from deserializer',
`cacheresponsebytes` int COMMENT 'from deserializer',
`cacheresponsestatus` int COMMENT 'from deserializer',
`cachetieredfill` boolean COMMENT 'from deserializer',
`clientasn` int COMMENT 'from deserializer',
`clientcountry` string COMMENT 'from deserializer',
`clientdevicetype` string COMMENT 'from deserializer',
`clientip` string COMMENT 'from deserializer',
`clientipclass` string COMMENT 'from deserializer',
@Sjeanpierre
Sjeanpierre / Skype_reset.sh
Created April 30, 2018 21:48
If your Skype for Business Installation on Mac OS keeps crashing on startup run the following.
#!/usr/bin/env bash
set -e
echo "Waring, this script will remove chat history and prefrences from Skype for Business"
read -p "Press enter to continue"
current_user=`whoami`
#going into directory where app stuff is stored
cd /users/$current_user/library
pwd
@Sjeanpierre
Sjeanpierre / aws_inventory.sh
Created November 24, 2015 19:42
Report running instances across all regions in AWS
regionlist=($(aws ec2 describe-regions --query Regions[*].RegionName --output text))
for region in "${regionlist[@]}"
do
aws --region $region ec2 describe-instances --output text --query 'Reservations[*].Instances[*].[Tags[?Key==`Name`] | [0].Value,PrivateIpAddress,InstanceId,State.Name,InstanceType,Placement.AvailabilityZone,LaunchTime]' --filters 'Name=tag:Name,Values=*'
done
@Sjeanpierre
Sjeanpierre / switching_from_ahci_to_raid.txt
Created September 6, 2015 05:13
Windows 10, switching from AHCI to RAID after installation
Open Admin command prompt: bcdedit /set {current} safeboot minimal
Restart to BIOS and set to AHCI
Restart. Windows will boot into safe mode and will update the driver.
Open Admin command prompt: bcdedit /deletevalue {current} safeboot
Restart to boot Windows Normally.
@Sjeanpierre
Sjeanpierre / convert.sh
Created September 1, 2015 05:49
iso to mkv conversion, cygwin
#! /usr/bin/bash
for i in $( ls *.iso ); do
filename=$i
base=${filename%.*}
echo processing $filename
/cygdrive/c/Program\ Files\ \(x86\)/MakeMKV/makemkvcon.exe mkv iso:$filename 0 processed/
mv processed/title00.mkv processed/$base.mkv
echo done
done
@Sjeanpierre
Sjeanpierre / db_connect.sh
Created June 15, 2015 19:04
Connect to database defined by rails databae.yml when on a server
#! /usr/bin/env bash
USERNAME=`cat config/database.yml | grep username | awk {'print$2'}`
PASSWORD=`cat config/database.yml | grep password | awk {'print$2'}`
HOST=`cat config/database.yml | grep host | awk {'print$2'}`
DATABASE=`cat config/database.yml | grep database | awk {'print$2'}`
mysql -h $HOST -u $USERNAME -D $DATABASE -p$PASSWORD
require 'sinatra'
require 'multi_json'
class App < Sinatra::Application
configure do
# Don't log them. We'll do that ourself
set :dump_errors, false
# Don't capture any errors. Throw them up the stack
set :raise_errors, true
@Sjeanpierre
Sjeanpierre / create.rb
Last active August 29, 2015 14:16
Create dynamodb table with global index example aws-sdk ruby
def setup_dynamo
options = {
:table_name => 'servers',
:attribute_definitions => [
{
:attribute_name => 'uid',
:attribute_type => 'S'
},
{
:attribute_name => 'private_ip',
@Sjeanpierre
Sjeanpierre / credentials.yml
Last active August 29, 2015 14:06
run ss_update.sh and follow the prompts
:access_key_id: 'ACCESS_KEY'
:secret_key: 'SECRET_KEY'
require "minitest/autorun"
# Each member of a Cartesian Array corresponds to the selection of one element each in every one of those sets.
# http://en.wikipedia.org/wiki/Cartesian_product
class CartesianArray < Array
# CartesianArray.new([0,1], [a,b], etc)
def initialize(*args)
super args