This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3.2 | |
# -*- coding: UTF-8 -*- | |
import sys | |
import re | |
import subprocess | |
COMMAND = "./extract.sh" | |
class ETL: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateIban (iban) { | |
const ibanValidationModulo = 97; | |
// On force les caractères alphabétiques en majuscule | |
iban = iban.toUpperCase(); | |
// on supprime les espaces | |
iban = iban.replace(new RegExp(" ", "g"), ""); | |
// le code iban doit faire plus de 4 caractères | |
if (iban.length < 5) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Password | |
CHARS = [*('A'..'Z'), *('a'..'z'), *(0..9), '$'] | |
def self.generate(size = 4) | |
chunks = [] | |
size.times do | |
chunks << create_chunk | |
end | |
chunks.join('-') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
formula = "%d.0 + 13 * %d.0 / %d.0 + %d.0 + 12 * %d.0 - %d.0 - 11 + %d.0 * %d.0 / %d.0 - 10" | |
combinations = (1..9).to_a.permutation.map(&:join) | |
combinations.each do |combination| | |
expr = format(formula, *combination.split('')) | |
result = eval(expr) | |
puts expr.gsub(/\.0/, '') if result == 66.0 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Network | |
# Create a new network | |
# @param address [String] the address of the network formatted as | |
# "10.0.0.0/16" or "10.0.0.0/255.255.255.0" | |
def initialize(address) | |
@address = address | |
@ip = to_binary(address.split("/")[0]) | |
@mask = to_binary(address.split("/")[1]) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "xml/xml" | |
def payload | |
%(<note> | |
<to>Tove</to> | |
<from>Jani</from> | |
<heading>Reminder</heading> | |
<body>Don't forget me this weekend!</body> | |
</note>) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Comments start with a hash | |
# First and foremost: Everything is an object. | |
# Numbers are objects | |
3.class # => Int32 | |
3.to_s # => "3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# requires imgcat (https://github.com/gnachman/iTerm2/blob/master/tests/imgcat) | |
xkcd_issue=$1 | |
TMP_FILE=$(mktemp /tmp/xkcd-$xkcd_issue.json.XXXXXXXX) | |
curl -s http://xkcd.com/$xkcd_issue/info.0.json > $TMP_FILE | |
imgurl=$(jq '.img' $TMP_FILE | tr -d \") | |
imgtitle=$(jq '.title' $TMP_FILE | tr -d \") | |
imgalt=$(jq '.alt' $TMP_FILE | tr -d \") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
settings = | |
lang: 'fr' | |
# Locale Strings | |
locale = | |
en: | |
weekdays: [ | |
'Sunday' | |
'Monday' | |
'Tuesday' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import json | |
import os | |
def find_nodes(node, key, debug=False): | |
if isinstance(node, unicode) or isinstance(node, list): | |
return |
OlderNewer