Skip to content

Instantly share code, notes, and snippets.

View chandu-io's full-sized avatar
🎯
Focusing

Chandrasekhar Thotakura chandu-io

🎯
Focusing
  • Hyderabad, INDIA
View GitHub Profile
@chandu-io
chandu-io / Spacer.java
Last active August 29, 2015 14:06
java :: Java Spacer Enum :: for outputting fixed length string with paddings of spaces or zeroes
public enum Spacer {
ONE(1),
TWO(2),
NINE(9),
FIFTEEN(15),
// Add here - whatever number you like to use
TWENTY(20);
// FIELDS
@chandu-io
chandu-io / SudokuSolver.java
Last active August 29, 2015 14:02
java :: SudokuSolver
// UNDER DEVELOPMENT
package com.chandu.sudoku;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
@chandu-io
chandu-io / FileSizeBench.java
Last active July 25, 2019 04:36
java :: Serialization and Encryption
// Awesome enum example
//http://stackoverflow.com/questions/116574/java-get-file-size-efficiently
import java.io.*;
import java.net.*;
import java.util.*;
public enum FileSizeBench {
@chandu-io
chandu-io / README.md
Last active August 29, 2015 13:56
java :: ejar.bat :: batch script to generate java executable jars

Batch script to generate java executable jars

Requirements

  1. compiled java class files
  2. manifest file ending in .txt with intended jar name (i.e., jarname.txt)

How to use

  1. In command prompt, type the following
@chandu-io
chandu-io / gist:6930186
Last active December 25, 2015 06:09
js :: getClassName :: type of object (ECMAScript standard to find the class of Object)
// ECMAScript standard to find the class of Object => Use toString method.
function getClassName(o) { return Object.prototype.toString.call(o).split(' ')[1].slice(0, -1) }
// OR
function getClassName(o) { return Object.prototype.toString.call(o).match(/^\[object\s(.*)\]$/)[1] }
console.log(getClassName([])); // 'Array'
console.log(getClassName({})); // 'Object'
@chandu-io
chandu-io / index.html
Created August 5, 2013 06:33
html :: shrinkable iframe snippet
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Iframes</title>
<style type="text/css">
body, table, tr, td, iframe {
@chandu-io
chandu-io / gist:6127337
Last active December 20, 2015 11:59
brew :: uninstall and reinstall and commands

This useful tip is taken from the article Uninstalling brew (so I can reinstall)

Uninstall

WARNING: Before copying and pasting these commands on your shell, make sure the first one (`brew --prefix`) returns the path where homebrew was installed properly. If not, you might ending up removing stuff from your computer you did not intend to remove.

cd `brew --prefix`
rm -rf Cellar

brew prune

alias ls='ls -GA'
alias ll='ls -lGA'
alias l=ll
alias pwdc='pwd | pbcopy'
alias updatedb='sudo /usr/libexec/locate.updatedb'
# open applications
alias psd='open -a Adobe\ Photoshop\ CS5'
alias chrome='open -a Google\ Chrome'
# bash
alias b='vi ~/.bash_login'
alias u='source ~/.bashrc'
#ls
alias l='ls -CF'
alias ll='ls -alFc'
alias la='ls -A'
alias lt='ls -lart'
@chandu-io
chandu-io / extensions.js
Last active December 18, 2015 03:19 — forked from rrobe53/gist:976610
nodejs :: extensions.js
exports.ext = function () {
var extTypes = {
"3gp" : "video/3gpp"
, "a" : "application/octet-stream"
, "ai" : "application/postscript"
, "aif" : "audio/x-aiff"
, "aiff" : "audio/x-aiff"
, "asc" : "application/pgp-signature"
, "asf" : "video/x-ms-asf"
, "asm" : "text/x-asm"