- OS: Ubuntu 14.04 X64
- CPU: Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
- RAM: 8GB
- go: go version go1.3 linux/amd64
- nodejs: v0.10.30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -o xtrace | |
# A script to bootstrap cabal-install. | |
# It works by downloading and installing the Cabal, zlib and | |
# HTTP packages. It then installs cabal-install itself. | |
# It expects to be run inside the cabal-install directory. | |
# install settings, you can override these by setting environment vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"unicode" | |
) | |
// ToSnake convert the given string to snake case following the Golang format: | |
// acronyms are converted to lower-case and preceded by an underscore. | |
func ToSnake(in string) string { | |
runes := []rune(in) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@prod-ceph-node5:~# cat /etc/ceph/ceph.conf |egrep -i '(blue|read)' | |
bluestore default buffered read = true | |
osd disk threads = 12 | |
filestore op threads = 12 | |
bluestore compression mode = none | |
bluestore min alloc size ssd = 4096 | |
bluestore min alloc size hdd = 4096 | |
root@prod-ceph-node5:~# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- {-# LANGUAGE OverloadedStrings #-} | |
import Data.Text | |
import Control.Monad.Trans | |
import Control.Monad.Trans.Maybe | |
import Control.Monad.Trans.State | |
import Control.Monad.Trans.Identity | |
import Control.Monad.Identity | |
import Control.Monad.Logger |
This script will let you make backups of live VMs running on KVM, using libvirt.
The backup job will suspend the VM for the time it takes to copy the RAM to disk.
Credits: Luca Lazzeroni
I've made some minor adjustments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Concurrent (forkIO) | |
import Control.Monad (forever, unless) | |
import Network (PortID(PortNumber),listenOn) | |
import Network.Socket hiding (listen,recv,send) | |
import Network.Socket.ByteString (recv,sendAll) | |
import qualified Data.ByteString as S | |
import System.Posix (Handler(Ignore),installHandler,sigPIPE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist | |
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist | |
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz | |
sudo pkgutil --forget org.macosforge.xquartz.pkg | |
# Log out and log in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import monix.eval.Task | |
import java.util.concurrent.TimeUnit | |
import scala.concurrent.duration._ | |
/** Request limiter for APIs that have quotas per second, minute, hour, etc. | |
* | |
* {{{ | |
* // Rate-limits to 100 requests per second | |
* val limiter = TaskLimiter(TimeUnit.SECONDS, limit = 100) | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# | |
# Script should be run in GZ. | |
# | |
# example: | |
# ./add-flow-to-vm.sh c480b89f-f8a1-41b1-abd0-45bac4685cb2 15M | |
# | |
# It will add TCP/UDP flows for this particular VM, and limits bandwidth to 15Mbps | |
# |