Skip to content

Instantly share code, notes, and snippets.

View WarFox's full-sized avatar
🦊
⭐️ ⭐️ ⭐️ ⭐️ ⭐️

Deepu Mohan Puthrote WarFox

🦊
⭐️ ⭐️ ⭐️ ⭐️ ⭐️
View GitHub Profile
@WarFox
WarFox / StackOverflow.java
Created February 20, 2014 10:51
static int is getting more count than AtomicInteger in single thread, why so?
import java.util.concurrent.atomic.AtomicInteger;
public class StackOverflow {
private static AtomicInteger atomicInteger = new AtomicInteger(0);
private static int staticInt = 0;
public static void main(String args[]) {
int atomicInt = atomicInteger.incrementAndGet();
staticInt++;
@WarFox
WarFox / 0_reuse_code.js
Created April 3, 2014 04:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@WarFox
WarFox / setup-ruby.sh
Created October 4, 2014 21:52
Inital setup of Ruby using rbenv and ruby-build
#!/bin/bash
# https://gorails.com/deploy/ubuntu/14.04
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv &
wait # wait for cloning to finish
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
@WarFox
WarFox / facebook_mining.r
Created July 1, 2012 14:50 — forked from simecek/facebook_mining.r
Facebook Mining
# go to 'https://developers.facebook.com/tools/explorer' to get your access token
access_token <- "******************* INPUT YOUR ACCESS TOKEN ******************************"
require(RCurl)
require(rjson)
# Facebook json function copied from original (Romain Francois) post
facebook <- function( path = "me", access_token, options){
if( !missing(options) ){
options <- sprintf( "?%s", paste( names(options), "=", unlist(options), collapse = "&", sep = "" ) )
@WarFox
WarFox / fiddle.html
Created September 24, 2012 15:30
Change html content with jQuery
<div id="myelement">Old Text</div>
@WarFox
WarFox / MainClass.cpp
Created September 26, 2012 13:05
Paisa To Rupee Converter in C++
//============================================================================
// Name : MainClass.cpp
// Author : Deepu Mohan Puthrote
// Version : 1.0
// Created on : 26 Sep 2012
// Copyright : Apache License, Version 2.0
// Description : Class which runs the program, Ansi-style
//=============================================================================
#include "MainClass.h"
@WarFox
WarFox / git-author-rewrite.sh
Last active October 14, 2015 09:50 — forked from octocat/git-author-rewrite.sh
Rewrite author information in commits
#!/usr/bin/env bash
git filter-branch --env-filter '
OLD_EMAIL=$1
CORRECT_NAME=$2
CORRECT_EMAIL=$3
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@WarFox
WarFox / Spring Roo textarea with rows and cols.tagx.jsp
Last active December 14, 2015 00:09
Spring Roo with cols and rows attributes
<jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:spring="http://www.springframework.org/tags" xmlns:form="http://www.springframework.org/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:output omit-xml-declaration="yes" />
<jsp:directive.attribute name="id" type="java.lang.String" required="true" rtexprvalue="true" description="The identifier for this tag (do not change!)" />
<jsp:directive.attribute name="cols" type="java.lang.Integer" required="false" rtexprvalue="true" description="No of columns in the textarea (sets the width)" />
<jsp:directive.attribute name="field" type="java.lang.String" required="true" rtexprvalue="true" description="The field exposed from the form backing object" />
<jsp:directive.attribute name="label" type="java.lang.String" required="false" rtexprvalue="true" description="The label used for this field, will default to a message bundle if not supplied" />
<jsp:directive.attribute name=
@WarFox
WarFox / input.tagx.jsp
Last active December 14, 2015 15:09
Spring Roo text field input.tagx with adjustable width attribute
<jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:spring="http://www.springframework.org/tags" xmlns:form="http://www.springframework.org/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:output omit-xml-declaration="yes" />
<jsp:directive.attribute name="id" type="java.lang.String" required="true" rtexprvalue="true" description="The identifier for this tag (do not change!)" />
<jsp:directive.attribute name="field" type="java.lang.String" required="true" rtexprvalue="true" description="The field exposed from the form backing object" />
<jsp:directive.attribute name="label" type="java.lang.String" required="false" rtexprvalue="true" description="The label used for this field, will default to a message bundle if not supplied" />
<jsp:directive.attribute name="labelCode" type="java.lang.String" required="false" rtexprvalue="true" description="Key for label message bundle if label is not supplied" />
<jsp:directive.attr
@WarFox
WarFox / PrintWithoutSemiColon.java
Last active December 18, 2015 21:29
Java :: Print "Hello World" without using semicolon (;)
public class PrintWithoutSemiColon {
public static void main(String[] args) {
if (System.out.printf("Hello World!\n") == null) {}
/**
* This one is given by Salil Joshi, in the following LinkedIn discussion
* http://www.linkedin.com/groups/How-print-Hello-World-in-3983267.S.252703117?qid=1ce0f1f0-73f3-4c31-ba37-c27aa8e81b55&trk=group_most_popular-0-b-ttl&goback=%2Egmp_3983267
*/
if (System.out.append("Hello World!\n").equals(null)) {}