Skip to content

Instantly share code, notes, and snippets.

View itsazzad's full-sized avatar
🎯
Focusing

Sazzad Hossain (Tushar) Khan itsazzad

🎯
Focusing
View GitHub Profile
<pre><code>&lt;script&gt;
$(document).ready(function () {
$("#wizard").bwizard();
});
&lt;/script&gt;
</code></pre>
@itsazzad
itsazzad / gist:e61622b7c8250ed1a622
Last active August 29, 2015 14:27 — forked from boucher/gist:1750375
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
\Stripe\Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@itsazzad
itsazzad / specialX.php
Created September 7, 2015 12:00
Special multiplication
<?php
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
$handle = fopen ("php://stdin","r");
$t = fgets($handle);
$LIMIT=100000;
function specialX($number){
global $LIMIT;
for($i=$number;$i<$LIMIT;$i++){
if(($fours=strpos($i,'0'))===false){
$forfours=$i;
@itsazzad
itsazzad / tor_curl.php
Created November 26, 2015 14:58 — forked from zachflower/tor_curl.php
How To Anonymize PHP cURL Requests Using Tor
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) { echo "ERROR: $error_number : $err_string";
return false;
@itsazzad
itsazzad / node-and-npm-in-30-seconds.sh
Created December 7, 2015 10:46 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@itsazzad
itsazzad / Vagrantfile
Created December 16, 2015 16:40
Vagrantfile used in my Mac which provides dns hostname patterns, variable ip, and all possible changeable folders out of the box
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"#change it?
config.vm.box_check_update = false
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
config.vm.network "forwarded_port", guest: 443, host: 8443, auto_correct: true
# https://github.com/BerlinVagrant/vagrant-dns
config.dns.tld = "dev"
config.vm.hostname = "hostname"#change it
config.dns.patterns = [/^.*hostname.dev$/]#change it
@itsazzad
itsazzad / bootstrap.sh
Created December 16, 2015 16:53
bootstrap for my common vagrant
#!/bin/bash
PASSWORD='vagrant'
sudo apt-get update -y
sudo apt-get install apache2 -y
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $PASSWORD"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $PASSWORD"
@itsazzad
itsazzad / Vagrantfile
Created December 16, 2015 18:13 — forked from jkrems/Vagrantfile
Simple vagrant setup with debian and puppet
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# Map NFS uid/gid to current user. This can be used to create a
# user inside the VM with matching uid/gid which makes file access
# a lot easier.
config.nfs.map_uid = Process.uid
config.nfs.map_gid = Process.gid
@itsazzad
itsazzad / massInsertOrUpdate.php
Created May 2, 2016 10:51 — forked from RuGa/massInsertOrUpdate.php
Mass (bulk) insert or update on duplicate for Laravel 4/5
/**
* Mass (bulk) insert or update on duplicate for Laravel 4/5
*
* insertOrUpdate([
* ['id'=>1,'value'=>10],
* ['id'=>2,'value'=>60]
* ]);
*
*
* @param array $rows
@itsazzad
itsazzad / missing
Created October 18, 2016 03:50
Get missing serial
var script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);
var items=[];
$('#target tr').each(function(){
items.push($(this).find('td:first font').text().split(" ")[0].split("-")[1]);
});
var count=0;
for(var i = 0; i < items.length; i++) {
if(items[i] - items[i+1] != 1) {
console.log(items[i+1]+'-'+items[i]);
count++;