Skip to content

Instantly share code, notes, and snippets.

Avatar

Santosh Kumar santosh

View GitHub Profile
@santosh
santosh / num_of_cores.cpp
Created Jan 26, 2015
get the number of cores
View num_of_cores.cpp
#include <thread>
unsigned int nthreads = std::thread::hardware_concurrency();
@santosh
santosh / randLocation.py
Created May 20, 2015
Create multiple poly objects and translate it to random locations. #AutodeskMaya
View randLocation.py
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 Jun 28, 2015
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.
View noteredirect.php
<?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 / pythonProjectTODO.md
Created Aug 18, 2015
Take care of these things in a Python based project.
View pythonProjectTODO.md

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 / time_localStorage.html
Last active Aug 29, 2015
Put time in localstorage if user visits for first time and retrieve later when the webpage was visited.
View time_localStorage.html
<!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 / .gitconfig
Last active Oct 9, 2015
My .gitconfig file
View .gitconfig
[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 Oct 7, 2012
JavaScript: Method #2: Randomize elements on a page
View gist:3847532
<!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 Oct 7, 2012
JavaScript: Method #1: Randomize elements on a page
View gist:3847513
<!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 Nov 15, 2015
My Code::Blocks configuration file. Including the 5 color schemes.
View default.conf
<?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 Nov 16, 2015
Minimal .vimrc file for Windows. Note that my dotfiles are on BitBucket. For sake of compatibility I am maintaining a different version for Windows.
View .vimrc
" {{
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'