Skip to content

Instantly share code, notes, and snippets.

@pcn
pcn / build.md
Created February 5, 2016 23:15
Build ixgbevf from OOT

Based on https://gist.github.com/vdm/6af55e1a568de0b61882

export VER=2.16.4
apt-get install -y dkms
cd /usr/src
curl -L http://sourceforge.net/projects/e1000/files/ixgbevf%20stable/${VER}/ixgbevf-${VER}.tar.gz | sudo tar -xzf -
cd ixgbevf-${VER}
cat <<EOF > dkms.conf
PACKAGE_NAME="ixgbevf"
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@pcn
pcn / startup.md
Created February 4, 2016 21:36
Cassandra 2.2.4 startup
:
# Ensure that the queing behavior on our cassandra block device is
# tuned for ssd
for disk in $(blockdev --report | grep -v xvda | grep '/dev' | cut -d/ -f3) ; do
    echo 1 > /sys/block/$disk/queue/nomerges # SSD only! 0 on HDD
    echo 8 > /sys/block/$disk/queue/read_ahead_kb
done

# Use the TSC as the clock source instead of xen
@pcn
pcn / items.md
Last active January 14, 2016 22:21
Are these vars still relevent/suported in cassandra (as of 2.2?)
@pcn
pcn / tableflip.sh
Last active December 29, 2015 19:59
tableflip.sh: for all your commandline table flipping needs
#!/bin/sh
flip() {
echo;
echo -en "( º_º) ┬─┬ \r"; sleep .2;
echo -en " ( º_º) ┬─┬ \r"; sleep .2;
echo -en " ( ºДº)┬─┬ \r"; sleep 1.2;
echo -en " (╯'Д')╯︵⊏ \r"; sleep .1;
echo -en " (╯'□')╯︵ ⊏ \r"; sleep .1;
echo " (╯°□°)╯︵ ┻━┻"; sleep .1;
}
@pcn
pcn / test.md
Created December 22, 2015 22:09
Filter a dict based on value w/ jinja (untested)

Something like this:

#map={s1:leader,s2:peon,s3:peon}
{% for k, v in map.items() %}
{% if v == 'leader' %}
{{ k }}
{% endif %}
{% endfor %}
2015/12/10 11:21:47 [INFO] Terraform version: 0.6.8 f1f214f03df27c1a790980b6f050fe92a7a547bf
2015/12/10 11:21:47 [DEBUG] Detected home directory from env var: /Users/peter.norton
2015/12/10 11:21:47 [DEBUG] Discovered plugin: atlas = /opt/homebrew-cask/Caskroom/terraform/0.6.8/terraform-provider-atlas
2015/12/10 11:21:47 [DEBUG] Discovered plugin: aws = /opt/homebrew-cask/Caskroom/terraform/0.6.8/terraform-provider-aws
2015/12/10 11:21:47 [DEBUG] Discovered plugin: azure = /opt/homebrew-cask/Caskroom/terraform/0.6.8/terraform-provider-azure
2015/12/10 11:21:47 [DEBUG] Discovered plugin: cloudflare = /opt/homebrew-cask/Caskroom/terraform/0.6.8/terraform-provider-cloudflare
2015/12/10 11:21:47 [DEBUG] Discovered plugin: cloudstack = /opt/homebrew-cask/Caskroom/terraform/0.6.8/terraform-provider-cloudstack
2015/12/10 11:21:47 [DEBUG] Discovered plugin: consul = /opt/homebrew-cask/Caskroom/terraform/0.6.8/terraform-provider-consul
2015/12/10 11:21:47 [DEBUG] Discovered plugin: digitalocean = /opt/homebrew-cask/C
@pcn
pcn / figwheel-emacs-cider.txt
Created October 27, 2015 04:24 — forked from auramo/figwheel-emacs-cider.txt
figwheel emacs cider stuff
## Using Emacs CIDER as the Figwheel REPL tool
project.clj should have this line:
```
:figwheel { :nrepl-port 7888 }
```
At the defproject-level.
It enables external tools to connect to the Figwheel REPL. To connect
@pcn
pcn / example.md
Last active September 14, 2023 19:40
Using jq to get+filter aws data

I've been playing with jq, and I've been having a hard time finding examples of how it works with output from a service like AWS (which I use a lot).

Here is one I use a lot with vagrant-ec2.

When we're launching and killing a lot of instances, the AWS API is the only way to track down which instances are live, ready, dead, etc.

To find instances that are tagged with e.g. {"Key" = "Name", "Value" = "Web-00'} in the middle of a vagrant dev cycle, or a prod launch/replace cycle, you can do something like this:

@pcn
pcn / example.md
Last active August 31, 2015 16:45
Using jq and the instance-id of an AWS node to get its name tag

You can get the instance-id of a system via curl, so something like this is an all-in-one:

ubuntu@test-aws-box$ aws ec2  describe-instances \
  --instance-id $(curl -s http://169.254.169.254/latest/meta-data/instance-id) | \
  jq '.Reservations[0].Instances[0].Tags[] | select(.Key == "Name").Value '
"the-name"