Skip to content

Instantly share code, notes, and snippets.

View mebjas's full-sized avatar
🖥️
Working on a camera for everyone 🐝 #CameraGo

minhaz mebjas

🖥️
Working on a camera for everyone 🐝 #CameraGo
View GitHub Profile
@mebjas
mebjas / booster_blaster.js
Last active August 29, 2015 14:06
softpedia web-scripts download count booster - by sending multiple requests
// -- blaster method--
var url = location.href;
var MAX = 2000;
function at(count) {
var x = new XMLHttpRequest();
x.open('GET', url);
x.send();
console.log('Sent ' +(count+1) +' requests master!!');
@mebjas
mebjas / gist:53d2fe43e523114b3669
Created December 2, 2014 23:05
Code to create 3d surface patch using multiple Bezier curves, js
function plot() {
ctx.fillRect(0, 0, canvas.width, canvas.height);
// draw top line and find the points
set[0] = [];
set[1] = [];
ctx.beginPath();
ctx.moveTo(p1[0], p1[1]);
drawPoint(p1[0], p1[1]);
var c = 0;
for(var t = 0; t <= 1; t += .001) {
<?php
/**
* @author Jay Taylor [@jtaylor]
*
* @date 2012-02-23
*
* @description Originally found on SO:
* http://stackoverflow.com/questions/962915/how-do-i-make-an-asynchronous-get-request-in-php
*/
@mebjas
mebjas / sample.js
Created April 1, 2015 10:12
Adding event listener to forms added via AJAX
var formObj = document.getElementById('form-loaded-via-ajax');
// ^^ Use any form of method to get the DOM object here
formObj.addEventListener("submit", function(event) {
if (typeof event.target[CSRFP.CSRFP_TOKEN] === 'undefined') {
event.target.appendChild(CSRFP._getInputElt());
} else {
//modify token to latest value
event.target[CSRFP.CSRFP_TOKEN].value = CSRFP._getAuthKey();
}
@mebjas
mebjas / code.ino
Created May 8, 2015 13:43
Controlling room lights and fan using aluminium foil touch
#include <CapacitiveSensor.h>
CapacitiveSensor c32 = CapacitiveSensor(3,2);
CapacitiveSensor c45 = CapacitiveSensor(4,5);
//CapacitiveSensor c1110 = CapacitiveSensor(11,10);
#define THRESHOLD 100
#define o1 7
#define o2 8
#define FREQ 50
import os
import sys
import time
import json
import inspect
import random
import string
def getRandStr(len):
return ''.join(random.SystemRandom().choice(
<?php
// ..... all other code ---
// Assuming database is connected
$k = $_POST['search_key'];
// Assuming $k is the search key
//include __DIR__ .'<path to lib.search.php>'
// i.e include the search library here
include __DIR__ .'/lib.search.php';
<?php
include __DIR__ .'/libs/csrf/csrfprotector.php';
csrfprotector::init();
if (isset($_POST['field1'])) {
echo 'success';
exit;
}
?>
<html>
@mebjas
mebjas / sink.php
Created September 3, 2015 15:57
simulation of vent sink worker model
<?php
$TMP = $argv[2];
$no_of_files = intval($argv[1]);
function logln($m) {
global $TMP;
file_put_contents($TMP .'/logs', $m .PHP_EOL, FILE_APPEND);
}
logln("[sink] started with pid = " .getmypid());
@mebjas
mebjas / example.js
Last active November 25, 2015 13:53
<script src="https://cdn.socket.io/socket.io-1.3.7.js"></script>
<script src="./client/socket.notification.js"></script>
<script>
var n = new notification({url: 'http://127.0.0.1:8090'});
n.bind({
channel: 'test',
message: function(data) {
if (typeof data.hello != 'undefined') return;
document.body.innerHTML += ' <div> New Message: ' +JSON.stringify(data.data) +'</div>';
}