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 / 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 / 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 / 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 / website_optimization.md
Last active October 15, 2020 15:50
Before pushing a site into production, double check these points.

This is an incomplete list:

  • Make spritesheet of all images.
  • Use CDN for static websites
  • Use Audit tools (Chrome)
  • Google PageSpeed
    • Minify the CSS and JavaScript you are using
    • Reduce the HTTP request
    • Optimize the images as much possible
@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 / 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 / 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 / crazify.py
Created October 12, 2013 05:13
Converts a "string" into "StRiNg".
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
from __future__ import print_function
import sys
var = sys.argv[1:]
def crazify(string):
"""Converts first index of string to uppercase followed by lowercase and so on.
@santosh
santosh / changebase.c
Created October 8, 2013 01:38
Program to convert a base 10 integer to base 2, 8 and 16.
/**
* File: 7.7.c
* Author: Santosh Kumar <[email protected]>
* Date created: Tue 08 Oct 2013 06:33:28 IST
* Description: Program to convert a positive integer to another base
* Taken from 'Programming in C' book.
*/
#include <stdio.h>
@santosh
santosh / numerical2words.c
Created October 4, 2013 01:19
Generate English words for given 'base 10' numbers, limited to 01-99.
/**
* File: numerical2words.c
* Author: Santosh Kumar <[email protected]>
* Date created: Tue 1 Oct 2013 09:27:49 IST
* Description: Translate numerical digit to English words, ranging 01 to 99
*/
#include <stdio.h>
#include <string.h>