Skip to content

Instantly share code, notes, and snippets.

View anchoo2kewl's full-sized avatar

Anshuman Biswas anchoo2kewl

View GitHub Profile
@anchoo2kewl
anchoo2kewl / responsive-video
Created May 19, 2013 15:27
Just include this code on a page with videos and see them "magically" become responsive.
var $allVideos = $("iframe[src^='http://player.vimeo.com'],iframe[src^='http://www.youtube.com']");
var $fluidEl = $("figure");
$allVideos.each(function() {
$(this)
// jQuery .data does not work on object/embed elements
.attr('data-aspectRatio', this.height / this.width)
.removeAttr('height')
.removeAttr('width');
});
@anchoo2kewl
anchoo2kewl / mm1.c
Created April 21, 2014 17:14
A simple M/M/1 queue simulation
//******************************************************************************
//* A simple M/M/1 queue simulation *
//******************************************************************************
//* Notes: 1. This program requires parameters for Inter Arrival time, *
//** Service time as well as maximum number of customers *
//*----------------------------------------------------------------------------*
//* Build: gcc -o mm1 mm1.c *
//*----------------------------------------------------------------------------*
//* Execute: ./mm1 MAX_CUSTOMERS ARR_TIME SERV_TIME *
//*----------------------------------------------------------------------------*
@anchoo2kewl
anchoo2kewl / tandem.c
Created April 21, 2014 17:15
'k' M/M/1 tandem queue simulation
//******************************************************************************
//* 'k' M/M/1 tandem queue simulation *
//******************************************************************************
//* Notes: *
//*----------------------------------------------------------------------------*
//* Build: gcc -o tandem tandem.c *
//*----------------------------------------------------------------------------*
//* Execute: ./tandem MAX_CUSTOMERS NUM_SERVERS(k) INTER_ARR_TIME1 *
//* SERV_TIME1 PROBABILITY1 .. INTER_ARR_TIME(k) SERV_TIME(k) PROBABILITY(k) *
//*----------------------------------------------------------------------------*
@anchoo2kewl
anchoo2kewl / deploy.sh
Last active August 29, 2015 14:01
This is used to merge one branch with several other branches
#/bin/bash
# chkconfig: 2345 50 70
SUCCESS=0
FAILURE=1
#
if [ $# -lt 2 ]
then
echo "Usage: deploy.sh mergeFromBranch {ListOFmergeToBranches}"
exit $FAILURE
fi
@anchoo2kewl
anchoo2kewl / delete.sql
Last active August 29, 2015 14:01
Delete all the duplicate entries from a table
DELETE FROM xyz where id in ( SELECT id from (SELECT id
FROM xyz
GROUP BY
name
HAVING COUNT(*) > 1) as newXYZ)
@anchoo2kewl
anchoo2kewl / createUser
Created August 26, 2014 14:11
This script helps create a new email account in postfix and dovecot. The domain is hardcoded for my needs because its faster but one may pass the domain as a parameter.
#/bin/bash
# chkconfig: 2345 50 70
SUCCESS=0
FAILURE=1
#
if [ $# -ne 1 ]
then
echo "Usage: createUser {username}"
exit $FAILURE
fi
@anchoo2kewl
anchoo2kewl / copy.vba
Created April 27, 2015 22:24
Copying values when IDs match
Private Sub Migrate()
For i = 3 To 26
For j = 3 To 62
If Sheets("final").Cells(j, 1) = Cells(i, 1).Value Or Sheets("final").Cells(j, 1) = Cells(i, 2).Value Or Sheets("final").Cells(j, 1) = Cells(i, 3).Value Then
Sheets("final").Cells(j, 7) = Cells(i, 4).Value
Sheets("final").Cells(j, 8) = Cells(i, 5).Value
End If
Next j
Next i
End Sub
sudo update-rc.d -f service defaults
sudo update-rc.d service enable
sudo apt-get update
sudo apt-get install build-essential libx11-dev libssl-dev -y libgssglue-dev libpcsclite-dev
tar zxvf rdesktop-1.8.3.tar.gz
cd rdesktop-1.8.3
./bootstrap
./configure
make
sudo make install
./letsencrypt-auto certonly -a manual --rsa-key-size 4096 --email [email protected] -d abc.com