Skip to content

Instantly share code, notes, and snippets.

@mpls
mpls / netpps.sh
Created February 11, 2014 04:02 — forked from joemiller/netpps.sh
#!/bin/bash
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
echo shows packets-per-second
#!/bin/bash
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
echo shows packets-per-second
@mpls
mpls / enable_rps.sh
Created February 24, 2016 08:21 — forked from netmarkjp/enable_rps.sh
enable rps/rfs on centos6
#!/bin/bash
VAL_RPS_FLOW_CNT="32768"
VAL_RPS_SOCK_FLOW_ENTRIES="32768"
PROC_NUM=$(cat /proc/cpuinfo | grep -c ^processor)
VAL_RPS_CPUS=0
if [ ${PROC_NUM:?} -eq 1 ]
then
# setting up irq affinity according to /proc/interrupts
# 2008-11-25 Robert Olsson
# 2009-02-19 updated by Jesse Brandeburg
#
# > Dave Miller:
# (To get consistent naming in /proc/interrups)
# I would suggest that people use something like:
# char buf[IFNAMSIZ+6];
#
# sprintf(buf, "%s-%s-%d",
@mpls
mpls / s3upload.py
Created May 25, 2016 08:06 — forked from rochacon/s3upload.py
Simple script to upload a file to S3 using a pre-signed URL
#!/usr/bin/env python
# Reference: http://docs.aws.amazon.com/AmazonS3/latest/dev/PresignedUrlUploadObject.html
import argparse
import os
import boto
import requests
if __name__ == '__main__':
@mpls
mpls / configure_proxy_protocol.md
Created May 27, 2016 00:51 — forked from pablitoc/configure_proxy_protocol.md
Configuring Proxy Protocol

##Install AWS CLI Tools##

  1. Install AWS CLI Tools. You can also use the EC2 API Tool if you are more comfortable with them. But this write-up uses the EC2 CLI.
  2. Create a user via Amazon IAM or download the security accessID and securitykey you will need it to query Amazon CLI.
  3. using Terminal cd into .aws directory cd ~/.aws edit or create new file named config paste the following contents inside.
    `[default]`
    `aws_access_key_id = ACCESS_ID`
    `aws_secret_access_key = SECRET_ID`
    `output = json OR bson OR text`
    `region = PREFERRED_AWS_REGION`

Save the file as "config"

@mpls
mpls / rd-clean.sh
Created July 5, 2016 08:47 — forked from unicolet/rd-clean.sh
Shell script to purge Rundeck execution history
#!/bin/sh
# setup ~/.pgpass to allow passwordless connection to postgres
# keep last 30 executions for each job
KEEP=30
cd /var/lib/rundeck/logs/rundeck
JOBS=`find . -maxdepth 3 -path "*/job/*" -type d`
#!/bin/bash
#
# https://www.redhat.com/archives/rhl-list/2007-September/msg03735.html
# https://github.com/hiboma/hiboma/blob/master/kernel/net/softnet_stat.md
#
cmd="${0##*/}"
usage() {
@mpls
mpls / crypto-pi-root.md
Created August 21, 2016 01:26 — forked from pezz/crypto-pi-root.md
Archlinux ARM encrypted root

Intro

Just some FYI, to get started:

  • I'm using a 16 GB Sandisk SD card.
  • I have a model B Pi, 512 MB RAM (not really relevant, thought I'd mention it).
  • Monitor and keyboard connected to the Pi itself, for now.
  • Network working, internet access.

The process starts by creating the CSR and the private key:

openssl req -nodes -newkey rsa:2048 -nodes -keyout dotmarks.net.key -out dotmarks.net.csr -subj "/C=GB/ST=London/L=London/O=dotmarks/OU=IT/CN=dotmarks.net"

Generates

  • dotmarks.net.key
  • dotmarks.net.csr