Skip to content

Instantly share code, notes, and snippets.

def change a
smallcase = 'a'..'z' # smallcase.to_a.size #=> 26
zeros = ("%026d" % 0).chars # creates array of 26 zeros
check = Hash[smallcase.zip(zeros)] #create hash map of alphabet to zeros
b = a.chars.each {|x| x.downcase!}
b.each do |x|
if check.include?(x)
check[x] = 1
end
@lolptdr
lolptdr / RPS.rb
Created August 5, 2014 22:11
RPS ruby with terminal client program
class RPS
# Rock, Paper, Scissors
# Make a 2-player game of rock paper scissors. It should have the following:
#
# It is initialized with two strings (player names).
# It has a `play` method that takes two strings:
# - Each string reperesents a player's move (rock, paper, or scissors)
# - The method returns the winner (player one or player two)
# - If the game is over, it returns a string stating that the game is already over
# It ends after a player wins 2 of 3 games
@lolptdr
lolptdr / sha1_breaker.rb
Created September 10, 2014 01:51
Why you shouldn't use SHA1 to store your passwords!
require 'digest/sha1'
class SHA1Breaker
@@chars = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ".split("")
@@nums = "1234567890".split("")
@@lower = "abcdefghijklmnopqrstuvwxyz".split("")
def self.breaker(hash)
self.guesser(hash, @@chars)
end
@lolptdr
lolptdr / short.js
Created November 19, 2014 23:07
short circuit examples - gilbert
// Short-circuit examples
var one = 10 || 20
console.log("1.", one)
var two = false || 30
console.log("2.", two)
var three = true || 40 || 50
console.log("3.", three)
@lolptdr
lolptdr / dotfiles.rb
Created December 2, 2014 16:01
Dotfile and system setup with developer's environment
#!/usr/bin/env ruby
require 'fileutils'
require 'mkmf'
USERNAME = `whoami`.chomp
HOME_DIR = File.expand_path('~/')
DOT_DIR = File.expand_path('~/.mks-dotfiles')
MKS_DIR = File.expand_path('~/code/mks')
DOT_FILES = ['.gitignore', '.gitconfig', '.zshrc']
How to write the perfect pull request
January 21, 2015 Keavy McMinn keavy Engineering
As a company grows, people and projects change. To continue to nurture the culture we want at GitHub, we've found it useful to remind ourselves what we aim for when we communicate. We recently introduced these guidelines to help us be our best selves when we collaborate on pull requests.
Approach to writing a Pull Request
Include the purpose of this Pull Request. For example:
This is a spike to explore…
This simplifies the display of…

ECMAScript 6 git.io/es6features

Introduction

ECMAScript 6 is the upcoming version of the ECMAScript standard. This standard is targeting ratification in June 2015. ES6 is a significant update to the language, and the first update to the language since ES5 was standardized in 2009. Implementation of these features in major JavaScript engines is underway now.

See the draft ES6 standard for full specification of the ECMAScript 6 language.

ES6 includes the following new features:

@lolptdr
lolptdr / thpsetup.py
Last active August 29, 2015 14:16 — forked from oaass/thpsetup.py
#!/bin/bash
echo ""
echo "=========================================================================="
echo "= Pentest Attack Machine Setup ="
echo "= Based on the setup from The Hacker Playbook ="
echo "=========================================================================="
echo ""
# Prepare tools folder