Skip to content

Instantly share code, notes, and snippets.

View napsternxg's full-sized avatar
🎯
Focusing

Shubhanshu Mishra napsternxg

🎯
Focusing
View GitHub Profile
@napsternxg
napsternxg / soxHelp.sh
Created February 22, 2013 23:03
Sox Commands
#Enable mp3 in sox
yum install sox-plugins-freeworld
#Trim file in sox from 0 for 10 seconds
sox file1.mp3 output.mp3 trim 0 10
#Mix multiple files in sox.
@napsternxg
napsternxg / RenameCamelCase.ps1
Last active December 14, 2015 08:09
Rename camel case files in a folder to split file name.
ls -name | where {$_ -cmatch "^[A-Z][a-z0-9]+[A-Z][A-Za-z0-9]+$" } | ren -new { ($_ -creplace "([A-Z0-9])", " $&").Trim() }
@napsternxg
napsternxg / .bashrc
Last active December 14, 2015 23:59
Search for text in files opened in the current folder in the current work space in Perforce. I would suggest using the part before the string passed to grep as an alias in your bashrc so you can use something like grep_p4o "text to search" directly.
alias grep_p4o='p4 opened | (folder="${PWD##*/}"; sed -e "s/.*${folder}\/\(.*\)#.*/\1/g") | xargs -o grep --color=auto -H'
@napsternxg
napsternxg / corenlp.bat
Created December 14, 2013 11:01
Batch file to run CoreNLP by Stanford on windows http://nlp.stanford.edu/software/corenlp.shtml#Download
set scriptdir=%~dp0
echo java -mx3g -cp \"%scriptdir%/*\" edu.stanford.nlp.pipeline.StanfordCoreNLP %*
java -mx3g -cp "%scriptdir%/*" edu.stanford.nlp.pipeline.StanfordCoreNLP %*
@napsternxg
napsternxg / saveSQLSession.sh
Created June 13, 2014 16:07
Save current SQL interactive session to file
mysql --user=root --password=root --tee=./SQLSession.out
# To start the logging to the given file from the session use
# mysql> \T
# Logging to file ./SQLSession.out
# To stop logging use
# mysql> \t
SELECT ROUND(numeric_value, -2) AS bucket,
COUNT(*) AS COUNT,
RPAD('', LOG(COUNT(*)), '*') AS bar
FROM my_table
GROUP BY bucket;
/*
numeric_value = column name
-2 to round in steps of 100. Use -1 for steps of 10 and any positive vale for rounding to nearest decimal
LOG(COUNT(*)) is to make the count on log scale
@napsternxg
napsternxg / Sentiment.md
Last active January 3, 2017 18:09
Sentiment Analysis Links

Links to important dictionaries and research projects on sentiment analysis available online

  • SentiStrength: http://sentistrength.wlv.ac.uk/ - Used for multiple social web sentiment analysis. Can also do topic specific sentiment analysis. Multi linguial.
@napsternxg
napsternxg / SSH_IP.ino
Last active January 4, 2019 13:10
Gist for common programs on running SSH on Intel Galileo Gen 2 [source: https://communities.intel.com/message/208564 ]
void setup() {
// put your setup code here, to run once:
system("telnetd -l /bin/sh");
system("ifconfig eth0 169.254.0.2 netmask 255.255.0.0 up");
system("sudo service ssh start");
}
void loop() {
// put your main code here, to run repeatedly:
@napsternxg
napsternxg / monte_carlo_circle.py
Created February 11, 2015 01:00
Monte Carlo Method for approximating the value of pi using ratio of area of circle inscribed in unit length square.
"""
Using Monte Carlo to find the value of pi.
Intiution: Ratio of area of circle to area of uniq length squre it is inscribed it can be used to approximate pi.
Area of circle = pi/4
Area of square = 1
Ratio = pi/4
Let us generate random points x,y inside the square. The probabilty of the point being inside circle is equal to the above ratio.
Circle centered on origin.
Given: -0.5 <= x,y <= 0.5
A point is inside circle if x**2 + y**2 <= 1/4
@napsternxg
napsternxg / progress.c
Created April 10, 2015 22:28
Progress bar and progress percentage in C.
/**
* progress.c - Progress bar and progress percentage in C.
* This program uses ANSI escape codes to show an always updating progress line in the terminal.
* Author: Shubhanshu Mishra
**/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>