Skip to content

Instantly share code, notes, and snippets.

View jbiason's full-sized avatar
💭
Rewrite it in Rust!

Julio Biason jbiason

💭
Rewrite it in Rust!
View GitHub Profile
@jbiason
jbiason / silly_name_generator.py
Created April 28, 2010 14:11
When discussing about the silliness of the name "Meego", @hisham_hm came with this silly name generator
#!/usr/bin/python
# created by @hisham_hm
import random
silly_consonants=["p", "t", "fl", "g", "gl", "l", 'j', "b", "n", "m", "bl", "z"]
silly_vowels=["a", "e", "ee", "ii", "o", "oo", "u"]
print (random.choice(silly_consonants) +
random.choice(silly_vowels) +
@jbiason
jbiason / Comments.php
Created May 20, 2010 20:45
Comparing comments created in VIM and Gedit
/**
* This comment was created with VIM.
* Notice the the lead comment is repeated and aligned.
* VIM automagically adds it.
* It also automagically removes the space if I type a "/" to finish the
* comment block.
*/
/**
This is a comment create inside Gedit.
#!/bin/bash
for file in *; do
# echo -n $file
new_file=$(echo $file|sed -e 's/[^A-Za-z0-9._-]/_/g')
if [ "$file" = "$new_file" ]; then
# echo " not messing..."
continue
fi
echo "$file => $new_file"
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Beaker translator"""
def meep(word):
syllables = len(word) / 2
return 'meep' * syllables
def meepmeep(phrase):
@jbiason
jbiason / ether.c
Created November 6, 2015 11:06
ether functions do not work with -std=c11
#include "netinet/ether.h"
#include "net/ethernet.h"
#include "stdio.h"
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
struct ether_addr address;
char buffer[30];
from collections import namedtuple
VerifyResult = namedtuple('VerifyResult', ['can_login', 'redirect_url'])
return VerifyResult(True, URL)
VerifyResult(can_login=True, redirect_url='URL')
result.can_login
result.redirect_url
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Testing stuff."""
class People(object):
"""A people!"""
reorder = lambda eq: '+'.join(sorted(eq.split('+'), key=int))
# (’3+2+1+1’), ’1+1+2+3’
# (’1+2+3’), ’1+2+3’
# (’2+2’), ’2+2’
# (’1+3+2+3+2+1+3+2+3+1+2’), ’1+1+1+2+2+2+2+3+3+3+3’
@jbiason
jbiason / requests_mock.py
Created April 27, 2017 18:45
Mocking requests.
# This is the "mockator":
def _mock_requests_method(responses, url, *dummy1, **dummy2):
"""Check the URL and return the expected response."""
if url not in responses:
raise AssertionError('URL doesnt exist: {}', url)
(status, text) = responses[url]
response = Response()
response.status_code = status
response.raw = StringIO.StringIO(text)
return response
@jbiason
jbiason / fujam.py
Last active August 17, 2017 13:57
from __future__ import print_function
import random
import argparse
CONSONANTS = ['f', 'j', 'c', 'l', 'n']
PASSPHRASE = '{}u{}am para as {}o{}i{}as'