Skip to content

Instantly share code, notes, and snippets.

View joekiller's full-sized avatar

Joseph Lawson joekiller

View GitHub Profile
@joekiller
joekiller / flume.conf
Last active May 25, 2016 02:34
Flume With Solr 6
# example.conf: A single-node Flume configuration
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
a1.sources.r1.type = spooldir
a1.sources.r1.channels = c1
a1.sources.r1.spoolDir = /tmp/messages
@joekiller
joekiller / README.md
Last active November 21, 2016 18:43
alias bash profiles based on client names

Say you support multiple clients or multiple projects but don't want everything on your shell at once. This script in your .bashrc file will allow you to automatically create aliases for any directory that has it's own .bashrc file. It starts a new bash shell so no existing variables are overwritten and you can exit when needed.

For example, say you have project or client named superx and another named johndoe. You create a directory superx and johndoe. Within each you pust a custom .bashrc file and optional .superx-secrets and .johndoe-secrets file and then your shell (upon next login) will detect those files and alias them to the parent directory's name. So if I want superx stuff, I just run superx and vice versa for johndoe.

Some references:

http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment http://www.linuxjournal.com/content/tech-tip-dereference-variable-names-inside-bash-functions http://stackoverflow.com/questions/3601515/how-to-check-if-a-v

@joekiller
joekiller / README.md
Created September 15, 2016 21:07
csd-wrapper.sh to help run openconnect against an old cisco anyconnect vpn
VPN=https://vpn.company.com
alias vpntun="sudo ip tuntap add vpn0 mode tun user `whoami`"
alias vpn="openconnect --csd-wrapper ~/.cisco/csd-wrapper.sh ${VPN} --no-cert-check -i vpn0 -s 'sudo -E /etc/vpnc/vpnc-script'"
@joekiller
joekiller / arch-linux-install dell precision 3510
Last active November 7, 2019 14:02 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt, luks, grub-git, nvme
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# This assumes a wifi only system...
wifi-menu
# sync the clock
timedatectl set-ntp true
@joekiller
joekiller / README.md
Created September 23, 2016 20:03
Hardware recommendations for Arch Linux Laptop

If you want to run Arch on a Laptop, use pure Intel hardware as much as possible. Especially for WiFi. Next use NVIDIA hardware if you need a discreet video card. AMD support is lacking to say the least.

@joekiller
joekiller / zip.clj
Created March 9, 2017 05:21
zip up a target directory
(with-open [zip (ZipOutputStream. (io/output-stream "target/lambda.zip"))]
(doseq [f (file-seq (io/file *compile-path*)) :when (.isFile f)]
(.putNextEntry zip (ZipEntry. (subs (.getPath f) (+ 1 (count *compile-path*)))))
(io/copy f zip)
(.closeEntry zip)))
@joekiller
joekiller / delete_all_object_versions.sh
Last active April 11, 2017 17:50 — forked from weavenet/delete_all_object_versions.sh
Delete all versions of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@joekiller
joekiller / clean-docker.sh
Last active May 9, 2017 16:40
Delete docker images volumes and containers
#!/bin/bash
# !!!!DESTRUCTIVE!!!!
# This will delete all local docker images.
CleanDocker () {
docker ps -aq | xargs docker rm
docker images | awk '{print $1":"$2}' | xargs docker rmi
docker volume prune
}
@joekiller
joekiller / enable-xray.sh
Last active June 25, 2020 19:09
Enable Lambda X-Ray on all functions via AWS CLI
#!/bin/bash
fns=($(aws lambda list-functions --query "Functions[].FunctionName" --output text))
GrantWrite () {
aws iam attach-role-policy --policy-arn arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess --role-name $(ROLE=$(aws lambda get-function --function-name $1 --query "Configuration.Role" --output text);echo ${ROLE##*/})
}
XRay () {
aws lambda update-function-configuration --function-name $1 --tracing-config Mode=Active >/dev/null && echo $1 OK || (GrantWrite $1; aws lambda update-function-configuration --function-name $1 --tracing-config Mode=Active > /dev/null && echo $1 OK || echo $1 FAILED)
}
for f in ${fns[@]}; do XRay $f; done
@joekiller
joekiller / README.md
Last active May 30, 2017 19:52
Minimal Clojurescript aws x-ray lambda cljs-lambda

The basics here are to make sure you include the externs for advanced compliation and then to wrap the S3 client with an AWSXray capture client.

(def S3 (nodejs/require "aws-sdk/clients/s3"))
(def s3-client (S3. (clj->js {:httpOptions {:timeout 10000}})))

vs

(def S3 (nodejs/require "aws-sdk/clients/s3"))
(def AWSXRay (nodejs/require "aws-xray-sdk"))

(def s3-client (.captureAWSClient AWSXRay (S3. (clj->js {:httpOptions {:timeout 10000}}))))