Skip to content

Instantly share code, notes, and snippets.

View dungvn3000's full-sized avatar

Nguyen Duc Dung dungvn3000

View GitHub Profile
@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.

@staltz
staltz / introrx.md
Last active June 18, 2024 06:15
The introduction to Reactive Programming you've been missing
@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
@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
@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)
@dopoljak
dopoljak / CertificateSigningRequestUsingSunJDK.java
Last active August 28, 2023 13:56
Example how to create PKCS#10 Certificate Signing Request (CSR) using Sun JDK, This example creates signature externally - suitable for Cryptographic devices such as Hardware Security Module (HSM)
package com.ilirium.client;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.KeyPair;
@james-huston
james-huston / haproxy.conf
Created December 23, 2014 18:03
haproxy.conf polling and sockets with sticky sessions using url param
global
maxconn 32768
quiet
# Performance turning
tune.maxaccept -1
stats socket /tmp/haproxy.sock mode 0666 level admin
log 127.0.0.1 local0 notice
log 127.0.0.1 local0 debug
@stupidbodo
stupidbodo / aes_encryption.go
Last active January 3, 2024 10:29
AES Encryption Example in Golang
// Playbook - http://play.golang.org/p/3wFl4lacjX
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
@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
#
@bantonsson
bantonsson / FormUpload.scala
Created March 3, 2015 12:49
Akka HTTP 1.0-M4 File upload using a form
/*
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
*/
import akka.actor.ActorSystem
import akka.http.Http
import akka.http.Http.IncomingConnection
import akka.http.model.HttpEntity
import akka.http.model.Multipart.FormData
import akka.http.server.{ Directives, Route, RoutingSetup }