Skip to content

Instantly share code, notes, and snippets.

View kranthilakum's full-sized avatar
🚀
Focusing

Kranthi Lakum kranthilakum

🚀
Focusing
View GitHub Profile
@kranthilakum
kranthilakum / scripts.md
Last active October 17, 2017 11:14
Scripts - Code Kata
// A lock has a three pin combination to unlock it. A program to list all possible combinations
(function() {
    var i = 0,
        j = 0,
        k = 0;
    var max = 9;
    for (i; i <= max; i++) {
        for (j = i; j <= max; j++) {
            for (k = j; k <= max; k++) {
@kranthilakum
kranthilakum / os_guide.md
Last active April 25, 2018 01:00
Operating Systems Guide

CPU

Interrupts

CPU Registers

Memory

offsets, pointers, stack

Hard Disk

hard disk, cylinder, head, sector, carry bit

Segmentation

Boot Sector

Graphics

@kranthilakum
kranthilakum / GoogleAuthService.js
Created December 5, 2016 17:46
Angular Service for Google API Authentication
// <script src="https://apis.google.com/js/client:platform.js" type="text/javascript"></script>
var app = angular.module("MyApp", []);
app.service('GoogleService', ['$q', '$http', '$log', '$window', function($q, $http, $log, $window){
var gapi = $window.gapi;
var updateSigninStatus = function(isSignedIn) {
if (isSignedIn) {
makeApiCall();
}
@kranthilakum
kranthilakum / angular-directive-example.md
Last active January 4, 2016 16:19
Simple example to illustrate Angular directive
// Set image as background of a div element using CSS
.fill-bg {
  background-img: url('MYURLHERE');
  background-size : 'cover';
  background-repeat : 'no-repeat';
  background-position : 'center center';
}

/* Automate the above process using jquery, so that
@kranthilakum
kranthilakum / angular-example-2.html
Created January 27, 2014 09:39
AngularJS service, factory, provider
<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.0.1/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-controller="MyCtrl">
{{serviceOutput}}
<br/><br/>
@kranthilakum
kranthilakum / angular-example.js
Last active January 4, 2016 16:09
Angular.js: service vs provide vs factory
var myApp = angular.module('myApp', []);
// a simple service
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
};
});
// a simple factory
@kranthilakum
kranthilakum / rename_files.py
Last active February 17, 2023 03:51
Python script to replace underscores with spaces
#!/usr/bin/python
# Usage: python rename_files.py "C:\Directory of Files with Underscores"
import os
import sys
directory = sys.argv[1] # parse through file list in the current directory
for filename in os.listdir(directory): # parse through file list in the current directory
@kranthilakum
kranthilakum / social.html
Last active December 19, 2015 05:19
My Social Links using Font-Awesome and Twitter Bootstrap
<!DOCTYPE HTML>
<html>
<head>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"/>
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"/>
.social ul{
list-style-type: none;
margin: 0;
padding: 0;
}
@kranthilakum
kranthilakum / windows.sh
Created June 13, 2013 12:00
Open windows explorer anywhere. To open current working directory use < start . > or < explorer . > in cygwin
# !/bin/bash
# author: Robert Mark Bram
# link: http://robertmarkbramprogrammer.blogspot.se/2007/06/cygwin-bash-script-open-windows.html
usage ()
{
echo "Open Windows Explorer"
echo "Usage: $0 [-help] [path]"
echo " [path]: folder at which to open Windows Explorer, will"
echo " default to current dir if not supplied."
@kranthilakum
kranthilakum / ReadInput.java
Created April 10, 2013 17:32
A simple example to read input from console using BufferedReader and InputStreamReader.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ReadInput {
public static void main(String[] args)throws IOException {
int age = 0;
boolean married = false;
String gender = null;