Skip to content

Instantly share code, notes, and snippets.

View dungvn3000's full-sized avatar

Nguyen Duc Dung dungvn3000

View GitHub Profile
@AlainODea
AlainODea / bootstrap.sh
Last active January 26, 2019 17:34
WIP: SmartOS installing Haskell Cabal 1.16.1.0 (look at install_cabal.sh)
#!/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
@elwinar
elwinar / snake.go
Created November 18, 2014 11:30
ToSnake function for golang, convention-compliant
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)
@RickySu
RickySu / gist:8edb9bcc58829e5478ac
Last active July 13, 2020 12:23
hhvm-ext-uv benchmark

hhvm-ext-uv benchmark

Environment

  • 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
@pryorda
pryorda / ceph.conf.txt
Last active October 17, 2020 06:55
Ceph BlueStore Config Options
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:~#
@naoto-ogawa
naoto-ogawa / sample_monadLogger.hs
Created January 15, 2017 07:27
Monad Logger Sample
-- {-# 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
@ringe
ringe / README.md
Last active May 22, 2022 14:10
KVM QCOW2 Live backup

Live backup of KVM virtual machines

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.

@paul-r-ml
paul-r-ml / haskellTcpProxy.hs
Created December 12, 2010 13:06
simple Haskell TCP proxy
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)
@tonymtz
tonymtz / gist:714e73ccb79e21c4fc9c
Created November 15, 2014 00:02
Uninstall XQuartz.app from OSX Yosemite
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
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)
*
@Multikas
Multikas / add-flow-to-vm.sh
Last active November 22, 2022 19:21
Script for limiting SmartOS zones bandwidth.
#!/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
#