Skip to content

Instantly share code, notes, and snippets.

@jinnko
jinnko / hiphop-php chef recipe.rb
Last active December 14, 2015 05:59
Opscode Chef recipe to build hiphop-php from source on Debian 6.
#
# Cookbook Name:: php-hiphop
# Recipe:: install_from_source
#
# Copyright 2011, FiveCool Consulting Ltd.
#
# Licensed 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
#
@jinnko
jinnko / mdadm-fastsync
Created August 12, 2013 10:58
Set disk values to maximize a resync, or restore the default settings. Dynamically detects the underlying volumes that make up the MD device. Based on the fine advice from Vivek Gite posted at http://www.cyberciti.biz/tips/linux-raid-increase-resync-rebuild-speed.html.
#!/bin/zsh
#
# @author Jinn Ko <https://gist.github.com/jinnko>
# @since 2013-08-11
MD_DEV=$1
ACTION=$2
MIN_SPEED=50000
MAX_SPEED=200000
@jinnko
jinnko / collectd-smartmon.sh
Last active August 15, 2018 00:22
SMART script for collectd. Forked from original at http://devel.dob.sk/collectd-scripts/smartmon.sh
#!/bin/dash
###
# ABOUT : collectd monitoring script for smartmontools (using smartctl)
# AUTHOR : Samuel B. <samuel_._behan_(at)_dob_._sk> (c) 2012
# LICENSE: GNU GPL v3
# SOURCE: http://devel.dob.sk/collectd-scripts/
#
# This script monitors SMART pre-fail attributes of disk drives using smartmon tools.
# Generates output suitable for Exec plugin of collectd.
###
[example.org]
listen = /srv/vhtdocs/example.org/log/.php-fpm.sock
listen.owner = example_org
listen.group = www-data
listen.mode = 0660
user = example_org
group = example_org
pm = dynamic
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@jinnko
jinnko / pem-split
Last active April 5, 2024 15:13
Take a PEM format file as input and split out certs and keys into separate files.
#!/usr/bin/awk -f
#
# Take a PEM format file as input and split out certs and keys into separate files
#
BEGIN { n=0; cert=0; key=0; if ( ARGC < 2 ) { print "Usage: pem-split FILENAME"; exit 1 } }
/-----BEGIN PRIVATE KEY-----/ { key=1; cert=0 }
/-----BEGIN CERTIFICATE-----/ { cert=1; key=0 }
split_after == 1 { n++; split_after=0 }
/-----END CERTIFICATE-----/ { split_after=1 }

Keybase proof

I hereby claim:

  • I am jinnko on github.
  • I am jinn (https://keybase.io/jinn) on keybase.
  • I have a public key whose fingerprint is 6B03 1AC4 B5B9 CED6 808A 96D2 1938 8E4F B6AF F041

To claim this, I am signing this object:

@jinnko
jinnko / es-verify-closed-indices.sh
Last active November 1, 2023 09:36
Script to open elasticsearch indices, allow them to complete verification or shard redistribution, then close the index.
#!/bin/dash -e
# vim:ts=2 sw=2 sts=2 expandtab:
# How long to wait for an opened index to become green
TIMEOUT=3600
DELAY=5
say() {
echo
echo "\033[32m===> \033[1;37m${1}\033[0m"
@jinnko
jinnko / keybase.md
Created June 30, 2017 09:57
keybase.md

Keybase proof

I hereby claim:

  • I am jinnko on github.
  • I am jinn (https://keybase.io/jinn) on keybase.
  • I have a public key ASAk-KAa77rdx1qtYYQCq6gmY2NjpnVarxntBnbhau_Aawo

To claim this, I am signing this object:

@jinnko
jinnko / keybase.md
Created July 12, 2017 14:27
keybase.md

Keybase proof

I hereby claim:

  • I am jinnko on github.
  • I am jinn_gds (https://keybase.io/jinn_gds) on keybase.
  • I have a public key whose fingerprint is 6B03 1AC4 B5B9 CED6 808A 96D2 1938 8E4F B6AF F041

To claim this, I am signing this object: