Skip to content

Instantly share code, notes, and snippets.

View santosh's full-sized avatar
:octocat:

Santosh Kumar santosh

:octocat:
View GitHub Profile
@santosh
santosh / num_of_cores.cpp
Created January 26, 2015 15:26
get the number of cores
#include <thread>
unsigned int nthreads = std::thread::hardware_concurrency();
@santosh
santosh / randLocation.py
Created May 20, 2015 06:59
Create multiple poly objects and translate it to random locations. #AutodeskMaya
import maya.cmds as mc
import random
for i in range(5):
x = random.uniform(-10.0, 10.0)
y = random.uniform(-10.0, 10.0)
z = random.uniform(-10.0, 10.0)
mycube = mc.polyCube(h=2, w=2, d=2, n="Object#")
mc.move(x, y, z, mycube)
@santosh
santosh / noteredirect.php
Created June 28, 2015 03:53
Collect useragent and ipaddress data from friends. I created this note redirect script to do the same. They were pointed to this script saying that they will be shown a note they must read.
<?php
/*
@scriptName: noteredirect.php
@author: Santosh Kumar
@authorURL: http://sntsh.com
*/
// set the content type which is read by browser
header("Content-type: text/plain");
@santosh
santosh / time_localStorage.html
Last active August 29, 2015 14:27
Put time in localstorage if user visits for first time and retrieve later when the webpage was visited.
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
<title> Loopingtriangle </title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
</head>
<body>
<script charset="utf-8">
@santosh
santosh / pythonProjectTODO.md
Created August 18, 2015 20:43
Take care of these things in a Python based project.

Development Phase

  • PEP-0008
  • Follow the hierarchy by distribute module
  • Implement argparse if it's a command line program

Publicity Phase

  • Post it on comp.lang.python with some masala
  • obviously on social networking sites, specially Geeklist, Reddit
  • Choose appropriate audience for app
@santosh
santosh / .gitconfig
Last active October 9, 2015 06:27
My .gitconfig file
[core]
editor = vii # See : http://unix.stackexchange.com/a/45877/22240
whitespace = nowarn
pager = less
diff = vimdiff
excludesfile = ~/.gitignore_global
[user]
name = # Santosh Kumar
email = # {Email Here}
[github]
@santosh
santosh / gist:3847532
Created October 7, 2012 08:31
JavaScript: Method #2: Randomize elements on a page
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title> Randomise Element's Position </title>
<style type="text/css" media="screen">
.randomizeme {
position:absolute;
@santosh
santosh / gist:3847513
Created October 7, 2012 08:19
JavaScript: Method #1: Randomize elements on a page
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>Randomize Element</title>
<style type="text/css" media="screen">/* mininal style {{ */
html, body { height: 100%; overflow: hidden;}
@santosh
santosh / default.conf
Created November 15, 2015 08:20
My Code::Blocks configuration file. Including the 5 color schemes.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocksConfig version="1">
<!-- application info:
svn_revision: 9501
build_date: Dec 10 2013, 22:28:10
gcc_version: 4.7.1
Windows Unicode -->
<app>
<locale>
<CATALOGNUM int="61" />
@santosh
santosh / .vimrc
Created November 16, 2015 13:53
Minimal .vimrc file for Windows. Note that my dotfiles are on BitBucket. For sake of compatibility I am maintaining a different version for Windows.
" {{
se nocompatible autoindent autoread autowrite autowriteall confirm cindent expandtab foldenable gdefault hidden hlsearch ignorecase incsearch lazyredraw lbr nu ruler sm sc smd scs smartindent sta spell splitright ttyfast undofile noerrorbells wildmenu wrap equalalways splitbelow wrapscan list
" }}
se dir=~/tmp/vimswapfiles//,~/.vim/vimswapfiles// bs=eol,start,indent,start cb=unnamed cc=-1 cot=menu,longest,preview enc=utf-8 ffs=unix fdm=marker foldlevel=0 fmr={{,}} foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo formatoptions=tcqrn1 history=100 laststatus=2 matchtime=1 mouse=a nrformats=octal,hex,alpha scrolloff=5 shiftwidth=4 softtabstop=4 spl=en_us timeoutlen=300 tw=77 ts=4 undolevels=1000 udir=~/tmp/vimundo,~/.vim/vimundo uc=10 whichwrap+=<,>,[,],h,l wildchar=<tab> wig=*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn guioptions-=T lcs=tab:?\ ,eol:¬,trail:·,nbsp:?
" ESSENTIALS
" ==========
" {{
filetype plugin indent on
let snips_author = 'Santosh Kumar'