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 / fizzbuzz.elm
Last active May 6, 2016 01:29 — forked from ctran/fizzbuzz.elm
Fizz Buzz in elm
import Graphics.Element exposing (Element, flow, down, show)
import List exposing (map)
main : Element
main =
let fizzBuzz n = case (n % 3, n % 5) of
(0, 0) -> "FizzBuzz"
(0, _) -> "Fizz"
(_, 0) -> "Buzz"
_ -> toString n
@kgashok
kgashok / fizzbuzz2.elm
Last active May 7, 2016 16:54
A more dynamic version of fizzBuzz
import Graphics.Element exposing (..)
type alias Filter =
{ divisor : Int,
string : String
}
inputFilters =
[ Filter 3 "Fizz"
, Filter 5 "Buzz"

I am Ashok B. I am 30 years old (in hexadecimal). I am an entrepreneur. I am good.

Period.

@kgashok
kgashok / C++Example.cpp
Created May 10, 2016 02:57 — forked from ahmedahamid/C++Example.cpp
Why I started to feel differently about C# | Using STL map
//
// (1) C++: - Defining a dictionary [key type=string, value type=int]
// - No easy way to initialize.
//
map<string, int> dict;
//
// (1`) C++11: Defining and initializing a dictionary [key type=string, value type=int]
//
map<string, int> dict
{
@kgashok
kgashok / C#Example.cs
Created May 10, 2016 02:58 — forked from ahmedahamid/C#Example.cs
Why I started to feel differently about C# | Using Dictionaries
//
// (1) C#: Defining an initializing a dictionary [key type=string, value type=int]
//
Dictionary<string, int> dict = new Dictionary<string, int>()
{
{"Eve", 101},
{"George", 150},
{"Emma", 200}
};
//
  • a task list item
  • list syntax required
  • normal formatting, @mentions, #1234 refs
  • incomplete
  • completed
@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
@kgashok
kgashok / toggleSize.js
Last active November 5, 2016 21:01
JS code for PythonTutor bookmarklet
var toggle_count = 0;
var toggleFont = function($) {
var fontSize = parseInt($('.cdataElt').css('font-size'));
console.log(fontSize);
if (fontSize <= 10) {
$(".cdataElt").css("font-size", 30 + "px");
} else {
$(".cdataElt").css("font-size", 10 + "px");
}
};
@kgashok
kgashok / toggleSize2.js
Last active November 15, 2016 21:19
Toggling fonts in the Stack visualizer in Java Tutor
var elems = [".heapRow", ".highlightedStackFrame"];
fontSize = parseInt($(elems[0]).css('font-size'));
console.log(elems[0], fontSize);
if (fontSize <= 13) {
elems.map(elem=>$(elem).css("font-size", 30 + "px"));
} else {
elems.map(elem=>$(elem).css("font-size", 10 + "px"));
}
@kgashok
kgashok / variableSizeAndRange.html
Created November 26, 2016 17:59
CheatSheetForSizeOfVariablesInC.md
### Size and Range of Variable Types in C
For a **16-bit** processor, here's the tabulation :
|Modifier | Variable Type | sizeof | Range | Precision |
|-----------|-----------|-----------------|:-----------|:-------|
|unsigned | char | 1 | 0 to 256
| | char | 1 | -127 to 127
|short |int | 2 | `–32,767` to `32,767` |
| |int | 2 | |