Skip to content

Instantly share code, notes, and snippets.

View sammcj's full-sized avatar
🦃

Sam sammcj

🦃
View GitHub Profile
@sammcj
sammcj / fast_resync
Created March 30, 2015 07:32
2x NVMe Intel DC3600P 1.2TB RAID1, 8x SanDisk Extreme Pro 480GB RAID10
root@s1-san5:~ # cat /proc/mdstat
Personalities : [raid1] [raid10]
md1200 : active raid1 nvme1n1[1] nvme0n1[0]
1172112896 blocks [2/2] [UU]
[=>...................] resync = 8.3% (97620800/1172112896) finish=14.7min speed=1213969K/sec
bitmap: 9/9 pages [36KB], 65536KB chunk
md480 : active raid10 sdh[7] sdg[6] sdf[5] sde[4] sdd[3] sdc[2] sdb[1] sda[0]
1874878464 blocks super 1.2 512K chunks 2 far-copies [8/8] [UUUUUUUU]
[=================>...] resync = 88.9% (1667816576/1874878464) finish=4.5min speed=765789K/sec
@sammcj
sammcj / Bash CGI Locate Search
Created June 20, 2011 23:24
CGI Locate Search - Warning: Insecure, only use on local apache instances
@calston
calston / logstash
Created May 6, 2012 06:20
Logstash init script
#! /bin/sh
### BEGIN INIT INFO
# Provides: logstash
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.

What.....?

TL;DR tunnels a socket from multiple hosts to a single host, creating sockets on the remote end automatically and encrypting all traffic over the network.

Creates a server that listens on 4433. All traffic is encrypted with OpenSSL using both client and server keys. When a client connects, a new random UNIX socket is created on the host and waits for connection. When an application connects to the socket on the server, it can talk to the socket on the client as if it were a local socket.

In this case, we're using a Docker socket, but this is easy to change.

On the server

$ ./server.sh server
@elentok
elentok / profiling.zsh
Created October 10, 2013 20:34
Profiling zshrc (to find slow scripts)
typeset -F SECONDS=0
export START_TIME=$SECONDS
if [ -e ~/.profiling ]; then
echo "zshrc started"
source() {
local before=$SECONDS
. $*
local duration=$((($SECONDS - $before) * 1000))
@pbiggar
pbiggar / enex2md.clj
Last active January 8, 2016 16:18
enex to markdown
;;; This script by Paul Biggar, available at https://gist.github.com/pbiggar/6323088a31d689c61a24
;;;
;;; This converts Evernote files into plaintext (not really markdown), so you can move your stuff out of evernote into a markdown editor.
;;;
;;; First, export your Evernotes, using File -> export notes. Export them into "My Notes.enex".
;;; copy this file into the same direcory as "My Notes.enex".
;;;
;;; To run this file, you'll need some dependencies, but they should only take a moment to install.
;;; leinigen: On OSX, use "brew install leiningen".
;;; lein-exec: From the terminal, run `mkdir ~/.lein; echo '{:user {:plugins [[lein-exec "0.3.5"]]}}' > ~/.lein/profiles.clj
@sammcj
sammcj / config.yaml
Last active February 27, 2016 09:40
beets config.yaml
# ~ % cat ~/.config/beets/config.yaml
directory: /Volumes/2TB_RAID/music
library: ~/beetslibrary.blb
import:
copy: no
move: yes
plugins:
fromfilename
ftintitle
#!/bin/bash
set -o errexit -o nounset -o pipefail
function -h {
cat <<USAGE
USAGE: ln_libjvm.bash
Symlink a likely libjvm.so into /usr/bin.
USAGE
}; function --help { -h ;}
@sammcj
sammcj / request_pacemaker_glue.md
Last active May 23, 2016 07:30
Request for pacemaker / cluster-glue packages

RHEL/CentOS/Fedora 7 Pacemaker Package was built without 'legacy' plugin support

'Legacy' pacemaker plugins provide useful, well tested resource providers for linux high availability / the open cluster framework (OCF), most of them are still very widely used / relied upon and are a potentially blocker for people wanting to build modern linux clusters based on RHEL/CentOS 7 and beyond.

In a perfect world RHEL/Fedora would simply build the pacemaker package with the --with stonithd flag and reinstate the cluster-glue package that was present in 6, However I know how hard it is to get those kind of changes made after a release (and probably for good reason).

  • There is only one difference when building the pacemaker package that enables this that requires no additional packages or code.
  • There are three parts to this request - they are neither complex or fraught with dependency nightmares.
  1. Provide the package pacemaker with legacy-plugins enabled when the RPM is generated.

A mcollective request sent from client.choria to dev1-0.choria and the reply, pathalogical case of nothing sharing infrastructure

network 0