Skip to content

Instantly share code, notes, and snippets.

@herry13
herry13 / mount_raw_qcow
Last active December 29, 2015 08:19
mount RAW/QCOW file
# Reference: http://alexeytorkhov.blogspot.co.uk/2009/09/mounting-raw-and-qcow2-vm-disk-images.html
losetup /dev/loop0 image.img
kpartx -a /dev/loop0
mount /dev/mapper/loop0p1 /mnt/image
# If kernel parameter (as loop in compiled into Fedora’s kernel) like loop.max_part=63 added it is even simplier:
losetup /dev/loop0 image.img
mount /dev/loop0p1 /mnt/image
@herry13
herry13 / hadoop1_test.sh
Last active January 3, 2016 19:28
Hadoop 1.x cluster testing script
#!/bin/bash
#####
#
# A script that runs wordcount mapreduce application on Apache Hadoop 1.x.
# The input file are files in the "<HOME>/conf" directory.
#
#####
./bin/hadoop dfs -mkdir /input
@herry13
herry13 / hash_password
Created March 28, 2014 12:02
Generate hash password for shadow file
python -c 'import crypt; print crypt.crypt("password", "random_salt")'
@herry13
herry13 / kickstart
Created March 28, 2014 23:18 — forked from ludo/kickstart
lang en_US
langsupport en_US
keyboard us
timezone Etc/UTC
text
install
skipx
halt
# Ridiculous URL... I know...
@herry13
herry13 / hpcloud-vm-post.sh
Last active August 29, 2015 14:02
Post creation script for ubuntu VM prepared for Nuri
#!/bin/bash
## install required packages
sudo apt-get -y update
sudo apt-get upgrade -y
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libreadline6-dev libyaml-dev git mercurial
## downward and install ruby-2.1.2
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
@herry13
herry13 / c9.sh
Created August 9, 2014 13:24
Install OCaml in Cloud9
#!/bin/bash -e
# Install OCaml and OPAM inside a Cloud9 IDE workspace.
# Run this script inside the workspace terminal, then eval $(opam config env)
OCAML_URL=http://caml.inria.fr/pub/distrib/ocaml-4.01/ocaml-4.01.0.tar.gz
# create a scratch directory
D=$(mktemp --tmpdir -d c9-ocaml-XXX)
pushd $D
@herry13
herry13 / .travis.yml
Created August 18, 2014 22:24
Travis configuration file for OCaml project
language: c
script: bash -ex .travis-ci.sh
branches:
only:
- master
env:
- OCAML_VERSION=4.01.0 OPAM_VERSION=1.0.0
@herry13
herry13 / .travis-ci.sh
Created August 18, 2014 22:26
Shell script for building and testing an OCaml project in Travis-CI
#!/bin/bash
#######################################
#
# Bash script file for travis-ci.org.
#
#######################################
OPAM_DEPENDS="ocamlfind yojson"
@herry13
herry13 / json_ruby.sh
Last active August 29, 2015 14:06
An oneliner to format JSON in pretty-print with Ruby
ruby -e "require 'json'; puts (JSON.pretty_generate JSON.parse(STDIN.read))"
@herry13
herry13 / yaml_ruby.sh
Created September 9, 2014 06:15
An oneliner to read and print YAML with Ruby (mainly, to verify a YAML)
ruby -e "require 'yaml'; puts ((YAML.load(STDIN.read)).to_yaml)"