Skip to content

Instantly share code, notes, and snippets.

View kgashok's full-sized avatar
🎯
Focusing

Ashok Bakthavathsalam kgashok

🎯
Focusing
View GitHub Profile
@kgashok
kgashok / HuffmanCoding.py
Created December 31, 2019 11:08 — forked from bhrigu123/HuffmanCoding.py
Code for Huffman Coding, compression and decompression. Explanation at http://bhrigu.me/blog/2017/01/17/huffman-coding-python-implementation/
import heapq
import os
class HeapNode:
def __init__(self, char, freq):
self.char = char
self.freq = freq
self.left = None
self.right = None
@kgashok
kgashok / cron.md
Created December 17, 2017 02:01 — forked from evancz/cron.md
Cron job to remind myself to stretch

Type crontab -l to see your cron jobs. Type crontab -e to edit them. You have to use Vim apparently.

Add a line like this:

0,30	*	*	*	*	/Users/YOURNAME/Documents/scripts/stretch.sh

That is on every 0th and 30th minute of the hour. Make sure all the separators in there are tabs!

@kgashok
kgashok / replace_words.js
Created December 14, 2017 18:17 — forked from mrcoles/replace_words.js
Replaces words in a web page
// ### Replace words in document
//
// Update all instances of `fromWord` to `toWord` within the text
// in the current document.
//
function replaceWordsInDocument(fromWord, toWord) {
if (/\s/.test(fromWord)) {
throw new Error('You must enter a single word without whitespace');
}
// Ernest Hemingway
function fibonacci(size) {
var first = 0, second = 1, next, count = 2, result = [first, second];
if(size < 2)
return "the request was made but it was not good"
while(count++ < size) {
@kgashok
kgashok / reverseListBetweenMandN.md
Last active October 3, 2017 12:56 — forked from superlayone/reverseListBetweenMandN.md
Reverse a linked list from position m to n in-place and in one-pass.

##Leetcode-Reverse Linked List II##

Reverse a linked list from position m to n. Do it in-place and in one-pass.

For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,

return 1->4->3->2->5->NULL.

Note: Given m, n satisfy the following condition:

var serialAsyncMap = function () {
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(collection, fn) {
var result, _iterator, _isArray, _i, _ref2, item;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
result = [];
_iterator = collection, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();
@kgashok
kgashok / Game.fsx
Created March 3, 2017 19:16 — forked from battermann/Game.fsx
Data-centric vs Function-centric Domain Design
open System
// -----------------------------------------------------------
// Domain
// -----------------------------------------------------------
module GameDomain =
type Dice = One | Two | Three | Four | Five | Six
@kgashok
kgashok / Game.fsx
Created March 3, 2017 19:16 — forked from battermann/Game.fsx
Data-centric vs Function-centric Domain Design
open System
// -----------------------------------------------------------
// Domain
// -----------------------------------------------------------
module GameDomain =
type Dice = One | Two | Three | Four | Five | Six
@kgashok
kgashok / enterprise-tic-tac-toe-2.fsx
Created March 3, 2017 19:09 — forked from swlaschin/enterprise-tic-tac-toe-2.fsx
Follow up to the example of implementing "enterprise" tic-tac-toe in a functional way.
(*
enterprise-tic-tac-toe-2.fsx
Follow up to the example of implementing "enterprise" tic-tac-toe in a functional way.
* Added true capability based security.
Related blog post: http://fsharpforfunandprofit.com/posts/enterprise-tic-tac-toe-2/
*)
@kgashok
kgashok / info_sec python modules
Created October 31, 2016 19:01 — forked from sh1nu11bi/info_sec python modules
This a collection of Python modules commonly associated with InfoSec.
Scapy: send, sniff and dissect and forge network packets. Usable interactively or as a library
pypcap, Pcapy and pylibpcap: several different Python bindings for libpcap
libdnet: low-level networking routines, including interface lookup and Ethernet frame transmission
dpkt: fast, simple packet creation/parsing, with definitions for the basic TCP/IP protocols
Impacket: craft and decode network packets. Includes support for higher-level protocols such as NMB and SMB
pynids: libnids wrapper offering sniffing, IP defragmentation, TCP stream reassembly and port scan detection
Dirtbags py-pcap: read pcap files without libpcap
flowgrep: grep through packet payloads using regular expressions
Knock Subdomain Scan, enumerate subdomains on a target domain through a wordlist
Mallory, extensible TCP/UDP man-in-the-middle proxy, supports modifying non-standard protocols on the fly