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 / Sample.elm
Last active April 30, 2016 23:47
Modification of Rundberget's version at (https://gist.github.com/rundis/8b5a0fd09c3eb348dfc2aa7e862436b4) to use String as a stack
import SStack as Stack exposing (..)
import Html exposing (..)
reverseString : String -> String
reverseString str =
Stack.reverse str
main : Html.Html
main =
@ctran
ctran / fizzbuzz.elm
Last active May 6, 2016 12:11
Fizz Buzz in elm
import Graphics.Element (Element, flow, down)
import List (map)
import Text (asText)
main : Element
main =
let fizzBuzz n = case (n % 3, n % 5) of
(0, 0) -> "FizzBuzz"
(0, _) -> "Fizz"
(_, 0) -> "Buzz"
@ahmedahamid
ahmedahamid / C++Example.cpp
Last active May 10, 2016 02:57
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
{
@ahmedahamid
ahmedahamid / C#Example.cs
Last active May 10, 2016 02:58
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}
};
//
@junjiah
junjiah / bellman_ford.py
Created August 30, 2015 14:03
solved 'Breadth First Search: Shortest Reach' on hackerrank https://www.hackerrank.com/challenges/bfsshortreach
from collections import namedtuple
# A reasonable large number to represent infinity.
INF = (1 << 31)
UNIT_LENGTH = 6
# Struct for edges.
Edge = namedtuple('Edge', ['src', 'dest'])
def calculate_shortest_distances(node_num, edges, src):
@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 / 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/
*)
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]();
@Gunio
Gunio / Parsing HTML in Python
Created October 18, 2011 18:33
Parsing HTML in Python with LXML
import requests
import lxml
from lxml import html
r = requests.get('http://gun.io')
tree = lxml.html.fromstring(r.content)
elements = tree.get_element_by_id('frontsubtext')
for el in elements:
print el.text_content()
@joewalnes
joewalnes / home-yet.py
Created December 14, 2012 03:12
Am I home yet?
#!/usr/bin/env python
"""A tiny script that polls your location on Google Latitude, and updates
the color of a Blink1 LED. http://shop.thingm.com/blink1/
Red = At work
Blue = At home
Green = On my way
Should work on Windows, OS-X and Linux. Requires Python 2.7 or later.