Skip to content

Instantly share code, notes, and snippets.

View samundra's full-sized avatar
🔬
refine details

Samundra samundra

🔬
refine details
View GitHub Profile
@samundra
samundra / mazegenerator.js
Created July 26, 2013 09:55
Requires more precised description, tried to understand it and http://i76.photobucket.com/albums/j5/alexshr/null_zps4bba71f9.jpg is my understanding. I don't know if its correct or not
// @see http://dstromberg.com/2013/07/tutorial-random-maze-generation-algorithm-in-javascript/
var pot = [[currentCell[0]+1, currentCell[1], 2, 0],
[currentCell[0], currentCell[1]+1, 1, 3],
[currentCell[0]-1, currentCell[1], 0, 2],
[currentCell[0], currentCell[1]-1, 3, 1]];
<?php
function generateUsername() {
$small = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
$capital = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
$numbers = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
$f = rand(0, 25);
$s = rand(0, 25);
@samundra
samundra / __init__.py
Created November 25, 2013 06:14
Nepalicalendar unity indicator
#!/usr/bin/python
import sys
import gtk
import appindicator
import urllib2
import re
import datetime
from xml.dom.minidom import parseString
from Calculator import *
@samundra
samundra / constant access.php
Created December 4, 2013 07:25
Illustrations::Dynamically Accessing const class variable in PHP
<?php
class RegionVO {
const NSW = 35;
const ACT = 37;
const VIC = 38;
const QLD = 9;
const SA = 36;
const WA = 39;
const NT = 40;
<?php
/**
* Saves remote image using Curl request
* @param string $img URL from which image is to be retrieved
* @param string $fullpath Full path to the image
* @param string $imageVerify Fullpath where image will be saved.
* @see http://stackoverflow.com/questions/10890617/grabbing-image-with-curl-php
*/
function saveImage($img, $fullpath = null, $imageVerify = true) {
#!/usr/bin/python
# Connects to servers vulnerable to CVE-2014-0160 and looks for cookies, specifically user sessions.
# Michael Davis (mike.philip.davis@gmail.com)
# Based almost entirely on the quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import select
@samundra
samundra / sublime_text3_key_binding.json
Last active June 29, 2016 11:31
SubtimeText3 Key Bindings
[
{ "keys": ["alt+shift+f"], "command": "reindent", "args": {"single_line": false} },
{ "keys": ["ctrl+shift+y"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Set Syntax: "} },
{ "keys": ["ctrl+super+t"], "command": "phpcs_clear_sniffer_marks" },
{ "keys": ["ctrl+shift+w"], "command": "toggle_setting", "args": {"setting": "word_wrap"}},
{ "keys": ["f6"], "command": "expand_fqcn" },
{ "keys": ["shift+f6"], "command": "expand_fqcn", "args": {"leading_separator": true} },
{ "keys": ["f5"], "command": "find_use" },
{ "keys": ["f4"], "command": "import_namespace" },
{ "keys": ["f3"], "command": "implement" },
@samundra
samundra / phpunit.bat
Created November 26, 2015 18:44
Create phpunit executable in windows
1. Download phpunit.phar from phpunit.de
2. then configure "c:\bin\" in PATH environment variable.
3. Create new file "phpunit.bat" and paste the below code inside the file
```bash
@ECHO OFF
php "%~dp0phpunit.phar" %*
```
4. Test the implementation using `phpunit --version`.
@samundra
samundra / console_code_color.php
Last active January 5, 2016 08:52
PHP Code snippet to view the color coding to be used in Console output. The color output can be directly used in the PHP code then for colourful output.
<?php
/**
* PHP Code snippet to test the color coding for the CLI output
* In Console the output is:
*
* The code is 1;42m
*
* Run with - `php console_code_color.php`
*
**/
@samundra
samundra / ConsolePassword.java
Last active August 7, 2016 14:16
Instruction to compile java program from command line which resides inside package
/**
* Filename : ConsolePassword.java
* @package : com.fivedots
*
* ConsolePassword is inside "Hello" project. Thus CD into the folder first, my case its "F:\workspace\Hello\"
* - cd F:\workspace\Hello
* - cd src
* - javac "com/fivedots/ConsolePassword.java"
* - java com.fivedots.ConsolePassword
**/