Skip to content

Instantly share code, notes, and snippets.

View misternu's full-sized avatar

Manu Meixell misternu

View GitHub Profile
@misternu
misternu / zipping.rb
Created December 13, 2018 17:11
Password Zipping a File
require 'tempfile'
require 'rubygems'
require 'zip'
file = Tempfile.open('testing.txt')
file.write('this is some secret text here')
file.rewind
zipbuffer = Zip::OutputStream.write_buffer(::StringIO.new(''), Zip::TraditionalEncrypter.new('password')) do |out|
out.put_next_entry("testing.txt")
@misternu
misternu / .bash_profile
Created April 19, 2017 06:39
My whole bash profile, working in darwin kernel 16.5.0, minus some api keys of course
# # echo is like puts for bash (bash is the program running in your terminal)
# echo "Loading ~/.bash_profile a shell script that runs in every new terminal you open"
# # $VARIABLE will render before the rest of the command is executed
# echo "Logged in as $USER at $(hostname)"
# Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Path for RVM
test -d "$HOME/.rvm/bin" && PATH="$PATH:$HOME/.rvm/bin"
@misternu
misternu / wolf_duck_grain.rb
Created February 28, 2017 01:31
This solves a riddle way too explicitly, yay!
def game_rules(items)
boat_west = items[0]
wolf_west = items[1]
duck_west = items[2]
grain_west = items[3]
return false if (!wolf_west && !duck_west) && boat_west
return false if (!duck_west && !grain_west) && boat_west
return false if (wolf_west && duck_west) && !boat_west
return false if (duck_west && grain_west) && !boat_west
true
@misternu
misternu / runner.rb
Created October 14, 2016 15:27
Prim's Algorithm
# Data structure for square
class Square
attr_accessor :in, :frontier
attr_reader :walls
def initialize
@walls = (0..3).to_a
@in = false
@frontier = false
end
@misternu
misternu / six_degrees.rb
Last active August 13, 2016 23:33
Six Degrees of Separation
# Get all the tweets in an array of hashes
tweets = []
File.open('sample_input.txt') do |f|
tweets = f.map do |line|
{
user: line[/^\w+(?=:)/],
mentions: line.scan(/(?<=@)\w+/)
}
end
end
@misternu
misternu / index.html
Created July 23, 2016 23:50
1st weekend challenge
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<article>
<img src="" alt="">
@misternu
misternu / ReportCardData.R
Created March 23, 2016 02:22
Chi Hack Night March 22
# This script examines school report card data 2014-2015
# Data downloaded from https://github.com/dailyherald/SchoolReportCards
setwd(dir = "~/Desktop/")
me <- read.csv(file = "me2015.csv")
dem <- read.csv(file="rc2015dem.csv")
# head(me) #query headers
# summary(me) #query summary
# str(dem) #query structure
colnames(me)
together <- merge(x=me,
@misternu
misternu / .travis.yml
Created January 26, 2016 17:03
Travis CI
notifications:
slack: islandfoxes2016:rvZVP0uhyIWkffUwuBAusagy
language: ruby
rvm:
- 2.1.7
services:
- postgresql
$(document).ready(function() {
getNewHorsePage()
.done(makeHiddenForm);
$('#new-horse').on('click', function() {
event.preventDefault();
toggleForm();
});
$('body').on('submit', '#horse-form', function() {
<head>
<link rel="stylesheet" href="/css/normalize.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css">
<link rel="stylesheet" href="/css/application.css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js"></script>
<script src="/js/application.js"></script>