Skip to content

Instantly share code, notes, and snippets.

View senthilnayagam's full-sized avatar

Senthil Nayagam senthilnayagam

  • Muonium
  • Chennai, India
View GitHub Profile
@senthilnayagam
senthilnayagam / Dockerfile
Last active December 21, 2015 08:49 — forked from indygreg/Dockerfile
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Create a build and development environment for Firefox.
FROM ubuntu:12.10
MAINTAINER Gregory Szorc "gps@mozilla.com"
RUN apt-get update
@senthilnayagam
senthilnayagam / gist:6474187
Last active December 22, 2015 12:39
updated code
package main
import (
"net"
"os"
)
const (
RECV_BUF_LEN = 1024
)
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
# my list had word number and word on a single line, first script splits the huge sentence by numbers into words in each line
cat 8word_list.txt | tr [:digit:] '\n' | sort | uniq | wc -l
29722
# this refines to identify words with 2 letters repeated
cat 8word_list.txt | tr [:digit:] '\n' | sort | uniq | grep '\([[:alnum:]]\)\1' | wc -l
6784
@senthilnayagam
senthilnayagam / email_extract.sh
Last active August 29, 2015 14:20
extract email from trai dump
ls *.html | xargs -n1 cat | grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' | grep -v 'advqos@trai.gov.in' | sort | uniq | wc -l
# 119798
@senthilnayagam
senthilnayagam / gist:46e817296ab30c640ddd
Created April 29, 2015 09:19
from git repository, list files when it was last modified, this can be sorted or further processing can be done
git ls-tree -r --name-only HEAD | while read filename; do
echo "$(git log -1 --format="%ad" --date=short -- $filename) $filename"
done
@senthilnayagam
senthilnayagam / git-modifiedby
Created April 30, 2015 09:40
which user knows which part of the code? this script helps you identify the files modified by a author
#!/bin/bash
set -e
git log --pretty="%H" --author="$1" | while read commit_hash; do git show --oneline --name-only $commit_hash | tail -n+2; done | sort | uniq
#usage
# git modifiedby author
git ls-files | grep '\.rb$' | xargs -I FILE -- sh -c 'echo FILE ; ruby -c FILE '
1899 26[3]
1900 36 76,094,000 0.047 NA
1901 54 77,584,000 0.070 negative increase47.12%
1902 79 79,163,000 0.100 negative increase43.38%
1903 117 80,632,000 0.145 negative increase45.40%
1904 172 82,166,000 0.209 negative increase44.26%
1905 252 83,822,000 0.301 negative increase43.62%
1906 338 85,450,000 0.396 negative increase31.57%
1907 581 87,008,000 0.668 negative increase68.82%
1908 751 88,710,000 0.847 negative increase26.78%
@senthilnayagam
senthilnayagam / gist:5c80447d12d655eab66c
Created May 13, 2015 06:22
list of commit messages
thinking of analysing commit messages
git log --pretty=format:'"%s"' --shortstat --no-merges | grep -v '^[[:space:]]*$' | grep -v 'changed.*insertion.*deletion\|changed.*insertion\| changed.*deletion'
if you want a cvs with multiple fields use this instead
git log --pretty=format:'"%h","%an","%aD","%s",' --shortstat --no-merges