Instantly share code, notes, and snippets.

Vishal Telangre vishaltelangre

View GitHub Profile



cat links.txt | parallel --gnu "wget {}" --no-check-certificate
View emacs_keybindings
* Movement
C-v Move next screen
M-v Move backwords one screen
C-f Move forward a character
C-b Move backward a character
M-f Move forward a word
View hello.asm
; nasm -f macho64 -o hello.o 1.asm && ld -macosx_version_min 10.7.0 -lSystem -o hello hello.o && ./hello
; ^ ^ ^
; [generate object file from assembly] [link object file] [execute]
%define SYSCALL_WRITE 0x2000004
%define SYSCALL_EXIT 0x2000001
;; initialised data section
section .data
View slack_rss
/feed subscribe
/feed subscribe
/feed subscribe
/feed subscribe
/feed subscribe
/feed subscribe
/feed subscribe
/feed subscribe
/feed subscribe
/feed subscribe
View gist:3c810b20cb82cc267781
Count All Open File Handles
lsof | wc -l
List File Descriptors in Kernel Memory
sysctl fs.file-nr
  • Create /etc/logrotate.d/my-crazy-app file with following snippet:
/var/log/my-crazy-app/*.log {
        size 500M
        rotate 10
View storm_kafka_word_split_count.clj
(ns storm.starter.clj.word-count-kafka
(:import ;[backtype.storm StormSubmitter LocalCluster]
[storm.kafka KafkaConfig HostPort KafkaSpout SpoutConfig StringScheme])
(:use [backtype.storm clojure config])
(def ^{:private true}
host (list "localhost:9092"))
(def ^{:private true

^ is the XOR operator - given two numbers it "lines up" their places and flips the place only if only one of the two numbers has that place:

// All of these are binary
111 ^ 111 === 000
110 ^ 111 === 001
110 ^ 110 === 000

This means that changed will be a number with only those places set that are set in prev_state or state but not both.



  • People talk about two servers: a web server (e.g. Nginx, Apache, etc.) and a app server (e.g. Language specific servers like Unicorn, Node.js, Tomcat, Http-Kit, etc.). There are exceptions where app servers not required at all (as web server itself provides preprocessors for handling), but let's not talk about now.
  • Web servers are really fast and supports lot of standard and commonly used MIME-type requests. Concept of serving a file is -- forming and sending a response of bytes of data and labeling it with requested MIME-type by a client (e.g. web browser).
  • Every response format (in layman's language, a file) is recognized by it's MIME-type, for e.g. a PNG image file has "image/png" MIME-type. JavaScript file has "text/javascript". HTML responses (or files) has "text/html". Plain text files have "text/plain".
  • Modern Browsers supports a lot of standard MIME-types. Images, videos, text files (XML, HTML, SVG, JS), and they better know how to visualize it. Browser also knows unrec