Skip to content

Instantly share code, notes, and snippets.

@jimitit
jimitit / gist:6dec13ffe84819ae2a7a
Last active August 29, 2015 14:27 — forked from tamoyal/gist:1b7ec4d3871b343d353d
Transitioning your pem/key on an EC2 instance

Note: This is mainly useful for instances you are essentially locked out of in the case where you don't want to create a new instance.

  1. Launch a micro instance with your new key (we'll call this the "key transitioning instance"). This instance will need to be in the same availability zone ("us-east-1b", for example) as the instances you are locked out of.
  2. Make sure you can ssh in
  3. Select the instance you are locked out of and make note of the attached EBS volume ID which will look something like vol-6a844e25 and the Root Device which will look something like /dev/sda1.
  4. Stop the EC2 instance you are locked out of
  5. Go to that instance's Root Device EBS volume and detach it
  6. Re-attach the EBS volume to the key transitioning instance
  7. On the key transitioning instance, run sudo fdisk -l
  8. Note the "Device" column output from this command that is similar to the "Attachment information" which is displayed when you select the EBS volume (we'll use /dev/xvdf1 as an example). That will be yo
@jimitit
jimitit / .js
Last active August 29, 2015 14:26
Sticky column on horizontal scroll
var lastScrollLeft = 0;
$(window).scroll(function() {
var documentScrollLeft = $(document).scrollLeft();
if (lastScrollLeft != documentScrollLeft) {
//console.log('scroll x' + documentScrollLeft);
//For first column check below line: *:nth-child(1)
$('#tbl_newdashboard > tbody').find("tr > *:nth-child(1)").css({
'position' : 'relative',
'left': documentScrollLeft + 'px',
'background-color': 'white',
//Make it center e.g $('.spotlight').centerfill();
(function ($, undefined) {
//Changing logic to set left and -ve margin to align center
$.fn.centerfill = function () {
return this.each(function () {
var iWidth = $(this).width();
var iHeight = $(this).height();
var parent = $(this).parent();
@jimitit
jimitit / gist:e0e98c931c588aa6ec5a
Last active August 29, 2015 14:19
Serialize object and serialize object array
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
@jimitit
jimitit / gist:c2445cbf56537689b32a
Last active August 29, 2015 14:14
Configuring PhpMyAdmin on Amazon EC2 to manage Amazon RDS
#Follow below simple steps to install PhpMyAdmin on EC2
# 1) Installing through repositories by enabling epel. To install phpmyadmin package.
sudo yum --enablerepo=epel install phpmyadmin
# 2) Navigate to file “/etc/httpd/conf.d/phpMyAdmin.conf” and make sure you can access phpMyAdmin from outside (your local pc).
<Directory /usr/share/phpMyAdmin/>
<IfModule mod_authz_core.c>