Skip to content

Instantly share code, notes, and snippets.

View kra3's full-sized avatar
🤠
I may be slow to respond.

Arun Karunagath kra3

🤠
I may be slow to respond.
View GitHub Profile
@kra3
kra3 / eq.preset
Created March 26, 2014 12:11
Audacious presets: ~/.config/audacious/eq.preset
[Presets]
Preset0=Classical
Preset1=Club
Preset2=Dance
Preset3=Flat
Preset4=Live
Preset5=Laptop Speakers/Headphone
Preset6=Rock
Preset7=Pop
@kra3
kra3 / setdifferencenum.py
Created July 11, 2012 18:56
Compare two files with numbers, one number in one line: python version
"""
# A shorter ugly version
total = set([i.strip() for i in open("total.txt").readlines()]) # list comprehension to remove \r\n from lines
coupon = set([i.strip() for i in open("coupon.txt").readlines()]) # set to remove duplicates and do set difference
open("result.txt", "w").write('\n'.join(sorted(total-coupon))) # use set difference and use sorted to sort then write in separate lines
"""
### Now see same thing above in beautiful & readable way
@kra3
kra3 / per user contribution in svn.sh
Created September 24, 2012 12:56
Script to find per user contributions from an Subversion (svn) repository.
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort | uniq -c | sort -r
$ echo "Now let's bisect the above one liner"
$ svn ls -R # will list all files in svn repo recursively
$ svn ls -R | egrep -v -e "\/$" # get files & directories one line at a time
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame # do a svn blame on each file (print file content with rev & author info)
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' # get second column which contains svn user name
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort # sort out put (will be based on svn username)
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort | uniq -c # get uniq lines with counts (no of lines contributed by user)
$ svn ls -R | egrep -v -e "\/$" | xargs svn blame | awk '{print $2}' | sort | uniq -c | sort -r # sort in reverse order (so user who contributed most comes first)
@kra3
kra3 / removeFalseValuesRecurse.js
Created May 18, 2018 09:27
remove false values from nested objects recursively
import _isObjectLike from 'lodash/isObjectLike';
import _size from 'lodash/size';
function removeEmptyValuesRecursively(obj) {
return removeEmptyValues(obj);
function isFalsy(val) {
// return true, if val is empty [], empty {} or null
return !_isObjectLike(val) ? val === null : _size(val) <= 0;
@kra3
kra3 / convert-postman-to-insomnia.js
Created October 22, 2021 05:32 — forked from wesleyegberto/convert-postman-to-insomnia.js
Script to convert a Postman backupt to Insomnia
/**
* Script to parse a Postman backupt to Insomnia keeping the same structure.
*
* It parses:
* - Folders
* - Requests
* - Environments
*
* Notes: Insomnia doesn't accept vars with dots, if you are using you must replace yours URLs manually (see ENVIRONMENTS_EXPORTS).
*/
@kra3
kra3 / maven tips.sh
Last active November 6, 2018 10:53
Speed up maven build times.
# rip off from https://zeroturnaround.com/rebellabs/your-maven-build-is-slow-speed-it-up/
# in .bashrc
set MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
# add -DdependencyLocationsEnabled=false to retain fewer outgoing connections.
# compile all modules
mvn -T 1C install -offline
@kra3
kra3 / tutorial.md
Created July 17, 2018 11:49 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

Mean -> Sum of all elements divided by number of elements. Arithmetic mean = average.
Median -> middle element after sorting all elements. If there are even number of elements, then get the mean of middle elements.
Mod -> Most repeated element (if there is one).
Range -> biggest element minus smallest element.
Standard deviation (sigma) -> how spread out the numbers are. Square root of variance.
Mean diviation - How far, on average, all values are from the middle. square root of absolute variance.
Variance (mu) -> average of squared differences from mean. That is (element - mean) squared for each element and find the mean of it.
@kra3
kra3 / Jenkins.md
Last active May 3, 2018 11:31
CI through GitHub

Jenkins PR

https://plugins.jenkins.io/ghprb

  • "ok to test" to accept this pull request for testing
  • "test this please" for a one time test run
  • "add to whitelist" to add the author to the whitelist
  • "retest this please" to start a new build
@kra3
kra3 / gis.md
Last active May 3, 2018 11:30
GIS