Skip to content

Instantly share code, notes, and snippets.

@dashohoxha
dashohoxha / org.css
Created July 12, 2013 01:51
This CSS file is used for displaying HTML files generated by org-mode of Emacs.
body {
margin: 1em;
border-right: 5px solid #bbb;
border-bottom: 5px solid #bbb;
padding: 0;
background: #ddd none repeat scroll 0 0;
border: 1px solid #000;
margin: 0;
padding: 2em;
color: #000;
@dashohoxha
dashohoxha / install_wifi_access_point.sh
Last active October 12, 2022 22:43
How to setup a Wifi Access Point on Ubuntu 12.04 (or its derivatives).
#!/bin/bash
### Setup a wifi Access Point on Ubuntu 12.04 (or its derivatives).
### make sure that this script is executed from root
if [ $(whoami) != 'root' ]
then
echo "
This script should be executed as root or with sudo:
sudo $0
"
# Problem A. Consonants, of Round 1C 2013, of CodeJam
# https://code.google.com/codejam/contest/2437488/dashboard#s=p0
$vowels = ['a', 'e', 'i', 'o', 'u']
def vowel?(c)
$vowels.include?(c)
end
# Problem A. Consonants, of Round 1C 2013, of CodeJam
# https://code.google.com/codejam/contest/2437488/dashboard#s=p0
$vowels = ['a', 'e', 'i', 'o', 'u']
def vowel?(c)
$vowels.include?(c)
end
def consonant?(c)
@dashohoxha
dashohoxha / osmos.rb
Last active December 17, 2015 00:19
Solution for Problem A (Osmos), of Round1B, CodeJam 2013: https://code.google.com/codejam/contest/2434486/dashboard#s=p0
# Solution for Problem A (Osmos), of Round1B, CodeJam 2013:
# https://code.google.com/codejam/contest/2434486/dashboard#s=p0
def solve(a, mots)
# If the list of mots is empty, we are done.
return 0 if mots == []
# If a is 1, the only way to make it solvable
# Solution to the problem B of Round1B of CodeJam:
# https://code.google.com/codejam/contest/2434486/dashboard#s=p1
# Number of diamonds on a piramid of 'i' full layers.
def f(i)
2*i*i + 3*i + 1
end
# Find the layers of the full piramid.
def find_i(n)
@dashohoxha
dashohoxha / energy-2.rb
Created May 4, 2013 12:43
This is a fast, linear solution (complexity O(N)) of Problem B, Manage your Energy, of Round 1B 2013 on Google CodeJam. * Problem description: https://code.google.com/codejam/contest/2418487/dashboard#s=p1&a=1 * Solution description: https://code.google.com/codejam/contest/2418487/dashboard#s=a&a=1
#####################################################################
#
# This is a fast, linear solution (complexity O(N)) of Problem B,
# Manage your Energy, of Round 1B 2013 on Google CodeJam.
#
# * Problem description:
# https://code.google.com/codejam/contest/2418487/dashboard#s=p1&a=1
# * Solution Description:
# https://code.google.com/codejam/contest/2418487/dashboard#s=a&a=1
#
@dashohoxha
dashohoxha / energy-1.rb
Last active December 16, 2015 23:59
This is a recursive solution of Problem B, Manage your Energy, of Round 1B 2013 on Google CodeJam. * Problem description: https://code.google.com/codejam/contest/2418487/dashboard#s=p1&a=1 * Solution Description: https://code.google.com/codejam/contest/2418487/dashboard#s=a&a=1
#####################################################################
#
# This is a recursive solution of Problem B, Manage your Energy,
# of Round 1B 2013 on Google CodeJam.
#
# * Problem description:
# https://code.google.com/codejam/contest/2418487/dashboard#s=p1&a=1
# * Solution Description:
# https://code.google.com/codejam/contest/2418487/dashboard#s=a&a=1
#