Skip to content

Instantly share code, notes, and snippets.

View manniru's full-sized avatar

MUHAMMAD MANNIR AHMAD manniru

View GitHub Profile
# -*- coding:utf-8 -*-
import json
import sqlite3
JSON_FILE = "some.json"
DB_FILE = "some.db"
traffic = json.load(open(JSON_FILE))
conn = sqlite3.connect(DB_FILE)
@manniru
manniru / ReadWriteExcelFile.java
Last active August 29, 2015 14:26 — forked from madan712/ReadWriteExcelFile.java
Read / Write Excel file (.xls or .xlsx) using Apache POI
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@manniru
manniru / vbox-headless-install.sh
Last active August 29, 2015 14:26 — forked from padcom/vbox-headless-install.sh
Automatic headless VirtualBox installation script
#!/bin/sh
# -------------------------------------------------------------------
# Headless VirtualBox installation script with PhpVirtualBox
# -------------------------------------------------------------------
# 1. Add VirtualBox source
echo "deb http://download.virtualbox.org/virtualbox/debian precise contrib" > virtualbox.list
sudo mv virtualbox.list /etc/apt/sources.list.d/
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
@manniru
manniru / packer.log
Last active August 29, 2015 14:28 — forked from boenrobot/packer.log
Packer logs
2014/09/21 05:21:05 Packer Version: 0.7.1
2014/09/21 05:21:05 Packer Target OS/Arch: windows amd64
2014/09/21 05:21:05 Built with Go Version: go1.3.1
2014/09/21 05:21:05 [DEBUG] Discoverd plugin: amazon-chroot = D:\Software\Development\Packer-0.7.1\packer-builder-amazon-chroot.exe
2014/09/21 05:21:05 [DEBUG] Discoverd plugin: amazon-ebs = D:\Software\Development\Packer-0.7.1\packer-builder-amazon-ebs.exe
2014/09/21 05:21:05 [DEBUG] Discoverd plugin: amazon-instance = D:\Software\Development\Packer-0.7.1\packer-builder-amazon-instance.exe
2014/09/21 05:21:05 [DEBUG] Discoverd plugin: digitalocean = D:\Software\Development\Packer-0.7.1\packer-builder-digitalocean.exe
2014/09/21 05:21:05 [DEBUG] Discoverd plugin: docker = D:\Software\Development\Packer-0.7.1\packer-builder-docker.exe
2014/09/21 05:21:05 [DEBUG] Discoverd plugin: googlecompute = D:\Software\Development\Packer-0.7.1\packer-builder-googlecompute.exe
2014/09/21 05:21:05 [DEBUG] Discoverd plugin: null = D:\Software\Development\Packer-0.7.1\packer-b
@manniru
manniru / gist-download.rb
Created November 7, 2015 09:36 — forked from emad-elsaid/gist-download.rb
Download your latest 30 Github Gists to local directory
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
print 'Github Username: '
username = gets.chomp
# get gists
puts 'Downloading gists list'
gists_str = open("https://api.github.com/users/#{username}/gists").read
@manniru
manniru / storm.sh
Created November 9, 2015 03:24 — forked from diegopacheco/storm.sh
Storm
sudo apt-get update -y
sudo apt-get install git -y
git clone https://github.com/apache/storm.git
wget http://ftp.unicamp.br/pub/apache/storm/apache-storm-0.9.5/apache-storm-0.9.5.tar.gz
tar -zxvf apache-storm-0.9.5.tar.gz
wget http://mirror.nbtelecom.com.br/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
tar -zxvf zookeeper-3.4.6.tar.gz
touch zookeeper-3.4.6/conf/zoo.cfg
@manniru
manniru / http.php
Created December 6, 2015 15:05
simple http request example in php
<?php
/*
* simple HttpRequest example using PHP
* tom slankard
*/
class HttpRequest {
public $url = null;
@manniru
manniru / clients.md
Created December 10, 2015 03:04 — forked from defunkt/clients.md
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@manniru
manniru / PHPExcel_Basics.md
Created January 26, 2016 15:53 — forked from r-sal/PHPExcel_Basics.md
PHPExcel Notes and code snippets

Basics

Creating a new PHPExcel Object.

    $this->PHPExcel = new PHPExcel();

Working with sheets

Creating a new sheet:

@manniru
manniru / gist:a805ce72c70addc7a60b
Created February 17, 2016 02:53 — forked from mhawksey/gist:1276293
Google App Script to insert data to a google spreadsheet via POST or GET - updated version as per https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software