Skip to content

Instantly share code, notes, and snippets.

View paralax's full-sized avatar

jose nazario paralax

View GitHub Profile
@paralax
paralax / texas_hold_em.elm
Last active August 29, 2015 14:21
prototype of texas hold 'em core in Elm
import Basics
import Graphics.Element exposing (..)
import Graphics.Input.Field as Field
import List exposing (..)
import Random exposing (..)
import String
type Face = Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | Jack | Queen | King | Ace | Joker
type Suit = Diamonds | Hearts | Clubs | Spades | Brand
type alias Card = { suit:Suit, face:Face }
import Graphics.Element exposing (..)
import Graphics.Input.Field as Field
import List
import String
{-- http://www.reddit.com/r/dailyprogrammer/comments/2qxrtk/20141231_challenge_195_intermediate_math_dice/cnawmtn --}
{--
based on https://hackage.haskell.org/package/split-0.1.1/docs/Data-List-Split.html
Michael Bublé,Jason Mraz,光田康典,The National,Sarah McLachlan,Claude Debussy,Lady Gaga,周杰倫,植松伸夫,Indochine,Rise Against,City and Colour,Radiohead,Red Hot Chili Peppers,Alexisonfire,Bebo & Cigala,The Mars Volta,Chick Corea & Hiromi,Theory of a Deadman,Cantaloupe Island,Adam's Apple,A Brighter Day,Afrodisia,Mambo De La Pinta,Greg Osby,James Newton,Testify,Art Blakey,Caravan,Tsuyoshi Sekito,Mira,Temptation,A Night In Tunisia,Serj Tankian,Winter,Duke Pearson,Cantaloop (Flip Fantasia),Cæcilie Norby,El Cumbanchero,You Don't Know What Love Is,Death Letter,Art Taylor,Closer to Home,Indio Gitano,Solomon Ilori and his Afro-Drum Ensemble,Black Byrd,Far West,Hi-Heel Sneakers,Congalegra,There Is The Bomb
The Beatles,Chase Coy,Stephen Jerzak,nevershoutnever!,Taylor Swift,The Maine,All Time Low,Boys Like Girls,McFly,Owl City,Glee Cast,Brokencyde,Ke$ha,Relient K,Cobra Starship,Jason Mraz,Across The Universe Soundtrack,Romance On A Rocketship,Hellogoodbye,Avril Lavigne,Show Me The Skyline,Hey Monday,Sterling Knight,Kate Nash,Plai
@paralax
paralax / simple_cipher.py
Created June 16, 2015 14:57
simple LCG-based stream cipher
import sys
# def xor(b, s): return "".join(map(lambda x: chr(x^b), map(lambda x: ord(x), s)))
def xor(b, s): return map(lambda x: x^b, map(lambda x: ord(x), s))
M = sys.maxsize
M = 128
def lcg(m, a, c, x): return (a*x + c) % m
@paralax
paralax / generate_describe.py
Last active August 29, 2015 14:23
describe honeypot tools for awesome list
import csv
import re
import urllib
with open('/Users/josen/Downloads/Honeynet Project Tools - Sheet1.csv', 'rb') as csvfile:
reader = csv.reader(csvfile)
pots = {}
for tool, typ, _, _, _, url, _ in reader:
pots[typ.strip()] = ['[%s](%s)' % (tool, url)] + pots.get(typ.strip(), [])
@paralax
paralax / arp.scala
Last active August 29, 2015 14:23
scala to get arp mappings
import scala.sys.process._
val IP_PAT="(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})".r
val MAC_PAT="([a-f0-9]{1,2}:[a-f0-9]{1,2}:[a-f0-9]{1,2}:[a-f0-9]{1,2}:[a-f0-9]{1,2}:[a-f0-9]{1,2})".r
val res = "arp -na" !!
(IP_PAT + "[^\\d]* .+ " + MAC_PAT).r.findAllMatchIn(res).map(_.subgroups).map(x => (x.head, x.last)).toMap // cala.collection.immutable.Map[String,String] = Map(192.168.0.102 -> 80:e6:50:25:xx:xx, ...)
@paralax
paralax / 220E.scala
Created June 22, 2015 20:39
sentence mangler
def getNonLetters(s:String): List[Int] = s.map(_.isLetter).zipWithIndex.filter(_._1==false).map(_._2).toList
def getUpperCase(s:String): List[Int] = s.map(_.isUpper).zipWithIndex.filter(_._1==true).map(_._2).toList
def makeLetters(s:String): List[Char] = s.toList.filter(_.isLetter == true)
def mkUpper(upps:List[Int], s:String): String = {
def loop(is:List[Int], s:String): String = {
is match {
case Nil => s
@paralax
paralax / garland.scala
Last active August 29, 2015 14:24
[2015-07-13] Challenge #223 [Easy] Garland words
def garland(word:String): Int = {
def loop(word:String, n:Int, sofar:Int): Int = {
//println(word.slice(0, n))
if (n+1 == word.length) {return sofar}
word.endsWith(word.slice(0,n)) match {
case false => loop(word, n+1, sofar)
case true => loop(word, n+1, n)
}
}
loop(word, 1, 0)
from sys import argv
move_space = "abcdefg"
gameboard = [['.' for x in range(7)] for x in range(6)]
def place_move(column, player):
col = move_space.index(column.lower())
for row in range(6):
if gameboard[row][col] == '.':
gameboard[row][col] = player
@paralax
paralax / robtex_passive_dns.py
Last active November 3, 2019 13:18
recon-ng modules for using Robtex passive DNS
from recon.core.module import BaseModule
from datetime import datetime
import re
import socket
from BeautifulSoup import BeautifulSoup
# for https://bitbucket.org/LaNMaSteR53/recon-ng/
class Module(BaseModule):