Skip to content

Instantly share code, notes, and snippets.

View luckyjajj's full-sized avatar
🎯
Focusing

Lakhveer Jajj luckyjajj

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am luckyjajj on github.
  • I am luckyjajj (https://keybase.io/luckyjajj) on keybase.
  • I have a public key ASD2pIy52zYUUHo_cYYyKlQtpuETFYix-3PlkEG7kiqzlAo

To claim this, I am signing this object:

@luckyjajj
luckyjajj / elasticache_backup.sh
Last active January 14, 2019 22:28
Hacky AWS ElastiCache Hourly Backup Shell Script
#!/bin/bash
## Requires AWS CLI Tools
aws elasticache create-snapshot --cache-cluster-id redis-replica-1 --snapshot-name cg-backup-hourly-"$(date +"%Y-%m-%d-%H%M")"
if [ $(aws elasticache describe-snapshots --cache-cluster-id redis-replica-1 |grep SnapshotName | wc -l) = "8" ]; then
old_snapshot="$(aws elasticache describe-snapshots --cache-cluster-id redis-replica-1 |grep SnapshotName | head -1 | cut -d \" -f 4)"
aws elasticache delete-snapshot --snapshot-name $old_snapshot
fi
@luckyjajj
luckyjajj / main.cpp
Created May 9, 2014 20:13
OpenGL: Banner Modeling and Animation
//
// main.cpp
// Banner Modeling and Animation
//
// Created by Lakhveer Jajj on 2013-09-25.
//
#include <iostream>
#include <string>
#include <cstdlib>
@luckyjajj
luckyjajj / index.html
Created July 16, 2013 20:41
A CodePen by Lakhveer Jajj. CSS Card Flip - CSS card flip for a smart way to showcase contact picture and information.
<div class="container indiv">
<div class="card">
<div class="face front">
<img src="http://images2.wikia.nocookie.net/__cb20070802000213/memoryalpha/en/images/2/27/Spock,_2267.jpg" alt="">
</div>
<div class="face back">
<div id="text">
<ul>
<li><img src="http://katcalvin.com/wp-content/uploads/2012/11/grey-twitter-icon-128.png"/>@LuckyJajj</li>
<li>l.jajj@sunviewlabs.com </li>
@luckyjajj
luckyjajj / jpeg-webp.js
Last active December 19, 2015 10:39
JavaScript snippet to replace all jpeg images with webp images to reduce network bandwidth.
window.onload = function() {
var supportsWebP = Modernizr.webp;
var allImages = document.body.getElementsByTagName("img");
var length = allImages.length;
for(i = 0; i < length; i++){
var image = allImages[i];
var imgSource = image.getAttribute('data-img-source');
image.src = supportsWebP ? imgSource.replace('.jpg', '.webp') : imgSource;
}
}