Skip to content

Instantly share code, notes, and snippets.

@Hiteshm01
Hiteshm01 / package.json
Created June 17, 2016 18:37
Package json for brand sentiment analyser
{
"name": "brand-tweet",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Hitesh",
"license": "ISC",
var Twitter = require('twitter');
var Sentiment = require('sentiment');
var debug = require('debug')('stream');
var request = require('request');
var config = {
consumer_key: '<Please your tokens here>',
consumer_secret: '<Please your tokens here>',
access_token_key: '<Please your tokens here>',
access_token_secret: '<Please your tokens here>',
};
"use strict";
var AWS = require('aws-sdk');
var https = require('https');
var http = require('http');
var keys = {
accessKeyId: 'development',
secretAccessKey: 'development',
'use strict';
var Harness = require('./support');
var post = Harness.definePostTable().as('postsss');
var customerAlias = Harness.defineCustomerAliasTable();
var user = Harness.defineUserTable();
// Harness.test({
// query: post.as('a').select(post.id.max()),
@Hiteshm01
Hiteshm01 / .bashrc
Created February 8, 2015 17:46
Bashrc file
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@Hiteshm01
Hiteshm01 / git
Created February 8, 2015 17:43
To create patch files of git branches
git diff origin/master > /tmp/patch.diff # replace origin/master with branch to compare with
# Move this patch file to new server via scp.
patch -p1 < /tmp/patch.diff # Assuming same location on remote machine.
# Or alternatively
# git apply -v /tmp/patch.diff
@Hiteshm01
Hiteshm01 / gdb
Last active August 29, 2015 14:15
To update environment variable of a running process
$> sudo apt-get install gdb
$> sudo su
$> gdb
(gdb) attach process_id # insert process id instead of process_id
(gdb) call putenv ("env_var_name=env_var_value") # Add environmental variable
(gdb) detach # detach with option y
@Hiteshm01
Hiteshm01 / gist:f326c8a6407348fd8088
Created February 8, 2015 17:32
Useful terminal commands
sudo !! # Runs last command with sudo privilege
python -m SimpleHTTPServer # Starts a HTTP server aat 8000 port in current folder, Great tool to share files!
@Hiteshm01
Hiteshm01 / sid
Created February 8, 2015 17:17
Union Intersection and difference
cat a b | sort | uniq > c # c is a union b
cat a b | sort | uniq -d > c # c is a intersect b
cat a b b | sort | uniq -u > c # c is set difference a - b
@Hiteshm01
Hiteshm01 / .bashrc
Created February 8, 2015 17:12
git branch name in bashrc
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
bold=$(tput bold)
reset=$(tput sgr0)
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != 'nothing to commit (working directory clean)' ]] && echo $red || echo $green
}