Skip to content

Instantly share code, notes, and snippets.

View rajasharan's full-sized avatar

Raja Sharan Mamidala rajasharan

View GitHub Profile
@rajasharan
rajasharan / fps.js
Last active July 31, 2022 18:22
How to calculate FPS using requestAnimationFrame
// note(): duration to run the test for in µs
const TEST_DURATION_US = 5_000_000;
let start, prev;
let counter = 0;
let ith_second = 0;
function fps(timestamp) {
// note(): convert to µs
const uTS = timestamp * 1000;
@rajasharan
rajasharan / README.md
Created April 2, 2020 21:14
Connect to bluetooth devices on i3
@rajasharan
rajasharan / CNTLM.md
Last active July 31, 2022 18:23
CNTLM proxy setup
@rajasharan
rajasharan / spring-boot-quick-setup.md
Last active July 21, 2018 16:09
Spring-boot hands-on lab

Step 0 - Verify java & mvn are installed on the system

  • $ java -version
  • $ mvn -version

Step 1 - Generate simple maven archetype project

$ mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 

Step 2 - Configure maven compiler plugin

hardstatus alwayslastline
#hardstatus string "%{= g} %{= w}%-Lw%{=r}%n%f* %t%{-}%+LW"
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
defscrollback 5000
bindkey "^x" remove
bind x remove
bind l focus right
bind h focus left
@rajasharan
rajasharan / applicative.md
Last active October 11, 2017 03:25
Intuition for Applicatives (<$>)

Intuition for Applicatives

Consider below program for sequencing commands

sequence : [IO a] -> IO [a]
sequence [] = return []
sequence (c:cs) = do
  x  <- c
  xs <- cs
 return (x:xs)
@rajasharan
rajasharan / bytes.js
Last active July 29, 2017 14:34
bit level manipulation in javascript
const R = require('ramda');
/*
* https://cryptopals.com/sets/1/challenges/1
*/
const HEX_DIGITS = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" ];
const HEX_TO_BINARY_MAP = {
"0": "0000",
"1": "0001",
@rajasharan
rajasharan / git-commands.md
Last active March 8, 2019 19:52
common git commands I usually use

Always double check remotes

git remote -v

Always track remotes

git branch -u <remote>/<branch>
@rajasharan
rajasharan / functors-monads.md
Last active October 11, 2017 03:24
Simple Functor and Monad example for string manipulation

Functors & Monads in simple JS

Consider this contrived example of string manipulation. We want to convert a string to uppercase and append "!".

Procedural style code:

function test(str) {
  return str.toUpperCase() + "!";
}
package com.sample.test
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;