Skip to content

Instantly share code, notes, and snippets.

Avatar
🐵
Busy

Rohit Yadav rhtyd

🐵
Busy
View GitHub Profile
@rhtyd
rhtyd / mp4-to-mp3
Created Oct 18, 2010
Converts Mp4 in a dir to mp3
View mp4-to-mp3
#! /bin/bash
#
# Converts all MP4 files in the current directory to MP3s.
#
# Uncomment to remove whitespaces in mp4 files
for video in *.MP4; do
#f=`echo $video | tr ' ' '_'`
#mv "$video" $f
View termDJ
# 2 Minutes Terminal Dj using cmus
mix(){ cmus-remote -n -k 40; }
dj(){ while [ 1==1 ]; do mix; sleep 16; done };
nohup cmus &
echo "Warning nohup may cause size of nohup.out in GBs when played for a longer time..."
cmus-remote -p
echo "Running termDJ, Ctrl+C to break"
dj
@rhtyd
rhtyd / gist:9072b1250b7d2207bb5c
Created Apr 22, 2013
Convert svn repo to git
View gist:9072b1250b7d2207bb5c
- Get authors file:
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
- Fix the authors file with alias = Name <Email@Server.com>
- Convert!
mkdir repo && cd repo
git svn init repo --no-metadata
git config svn.authorsfile <path to authors file>
git svn fetch
@rhtyd
rhtyd / Alcohol Sensor
Created May 3, 2013
Arduino hack @wingify, our resident alcohol breathlyzer
View Alcohol Sensor
int sensorValue;
void setup()
{
Serial.begin(9600); // sets the serial port to 9600
}
void loop()
{
sensorValue = analogRead(0); // read analog input pin 0
@rhtyd
rhtyd / buildrepo.sh
Last active May 3, 2016
APT/YUM signed repo hosting
View buildrepo.sh
cd /path/to/repo
# rpm
for release in 4.2 4.3 4.4;
do
echo "Buildling repo for $release"
cd $release
rm -fr repodata
createrepo .
@rhtyd
rhtyd / gist:6b120bca5cbb4a2db732
Created Dec 18, 2014
deploy-cloudstack-basic.sh
View gist:6b120bca5cbb4a2db732
#!/bin/bash
# By Rohit Yadav <bhaisaab@apache.org>
# Change the values as needed below
set -e
set -x
cli=cloudmonkey
dns_ext=8.8.8.8
dns_int=192.168.1.1
gw=192.168.1.1
View cs-x-y.sh
domains=1
instances=1
usage(){
echo "usage: $0 [-d domains] [-i instances]"
echo " -d number of domains to create (defaults to 1)"
echo " -i number of instances to create (defaults to 1)"
echo " -h (prints this help)"
}
while getopts d:i:h opt
@rhtyd
rhtyd / cleanup-db.sql
Last active Aug 29, 2015
Drops and truncates table without removing database
View cleanup-db.sql
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;
@rhtyd
rhtyd / build-systemvm-vmware-ovftool.sh
Created May 12, 2015
build-systemvm-vmware-ovftool
View build-systemvm-vmware-ovftool.sh
#!/bin/bash
# usage: bash <script> systemvm64template-4.5-vmware systemvm64template-4.5-vmware.vmdk
function stage_vmx (){
cat << VMXFILE > "${1}.vmx"
.encoding = "UTF-8"
displayname = "${1}"
annotation = "${1}"
guestos = "otherlinux-64"
@rhtyd
rhtyd / rpm-centos6-build.sh
Last active May 11, 2016
Building CloudStack Packages
View rpm-centos6-build.sh
set -e
export ROOT=$PWD
git fetch origin
git clean -fdx
rm -fr deps/*jar deps/awsapi-lib deps/*.mar NONOSS
git checkout -- .
git checkout ${TAG}
export MINOR=${BUILD_ID}