Skip to content

Instantly share code, notes, and snippets.

View smartameer's full-sized avatar

ameer smartameer

View GitHub Profile
@smartameer
smartameer / generate-table.js
Last active May 18, 2017 20:05
Generate Table from JSON Array
(function ($) {
/**
* data - array of record
* hidecolumns, array of fields to hide
* usage : $("selector").generateTable(json, ['field1', 'field5']);
*/
'use strict';
$.fn.generateTable = function (data, hidecolumns) {
if ($.isArray(data) === false) {
console.log('Invalid Data');
@smartameer
smartameer / docker.sh
Last active September 30, 2017 20:36
Docker Installation Script for ubuntu 16.04
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)"
sudo chmod +x /usr/local/bin/docker-compose
sudo service docker restart
@smartameer
smartameer / docker-uninstall.sh
Last active October 4, 2017 14:24
Uninstall & Clean Docker
sudo docker rm -f $(sudo docker ps -a -q)
sudo docker rmi -f $(sudo docker images -a -q)
sudo docker volume rm $(sudo docker volume ls -f dangling=true -q)
sudo docker network rm -f $(sudo docker network ls | awk '$3 == "bridge" && $2 != "bridge" { print $1 }')
sudo service docker stop
sudo apt-get update
sudo apt-get purge docker-ce -y
sudo rm /usr/local/bin/docker-compose
@smartameer
smartameer / PWM-LED.ino
Created December 25, 2018 11:35
Pulse width modulation analog output example by adding led to arduino nano
int i = 0;
int j = 0;
const int W = 6; // white, 2 white connected to same pin
const int R2 = 3; // red
const int R1 = 11; // red
const int G1 = 10; // green
const int G2 = 5; // green
@smartameer
smartameer / prepare-commit-msg
Created July 6, 2021 19:35
Git coauthor hook for pre-commit message
#!/bin/bash
function prompt_for_multiselect {
# little helpers for terminal print control and key input
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
RESTORE='\033[0m'
ESC=$( printf "\033")
cursor_blink_on() { printf "$ESC[?25h"; }