Skip to content

Instantly share code, notes, and snippets.

🐵
Busy

Rohit Yadav rhtyd

🐵
Busy
Block or report user

Report or block rhtyd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 / vnc-decrypt.sh
Created May 29, 2015
vnc-decrypt: CloudStack VNC Password decryption tool
View vnc-decrypt.sh
#!/bin/bash
input=$(mysql -u root -proot -e "select vnc_password from cloud.vm_instance where name='$1'\G;" | grep vnc_password | sed 's/.*vnc_password: //')
java -classpath /usr/share/cloudstack-common/lib/jasypt-1.9.0.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh input=$input password=password verbose=true
View deepcopy-vs-list.py
import copy
a = 1
b = [1,2,3]
c = "Some random string :)"
z = [a,b,c]
x = list(z)
x[1][1] = 100
View cloudstack-db-mock-upgrade.sql
USE `cloud`;
INSERT into `cloud`.`vm_template` (unique_name, name, uuid, hvm, hypervisor_type) values ('systemvm-xenserver-4.5-fake-uuid', 'systemvm-xenserver-4.5', 'fakeduuidkvm1', 0, 'KVM');
INSERT into `cloud`.`vm_template` (unique_name, name, uuid, hvm, hypervisor_type) values ('systemvm-vmware-4.5-fake-uuid', 'systemvm-vmware-4.5', 'fakeduuidvmware1', 0, 'VMware');
@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
View updateddns.sh
#!/bin/bash
set -x
IP=$(wget -qO- http://ipecho.net/plain; echo)
wget -qO- http://username:password@dynupdate.no-ip.com/nic/update?hostname=fqdn.host.name&myip=$IP &> /dev/null
@rhtyd
rhtyd / ListCiphers.java
Last active Oct 16, 2015
Lists available ciphers in jdk
View ListCiphers.java
import java.security.KeyStore;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.TrustManagerFactory;
public class ListCiphers
{
public static void main(String[] args)
You can’t perform that action at this time.