Skip to content

Instantly share code, notes, and snippets.

View robertmarsal's full-sized avatar

Robert Marsal robertmarsal

View GitHub Profile
@robertmarsal
robertmarsal / gist:9feaa9150926efa4175a
Created December 17, 2014 21:09
Install f.lux on Ubuntu 14.10
sudo apt-get install python-glade2 python-appindicator
git clone https://github.com/Kilian/f.lux-indicator-applet.git
cd f.lux-indicator-applet
chmod +x setup.py
sudo ./setup.py install
fluxgui
@robertmarsal
robertmarsal / README.md
Last active March 20, 2022 02:26 — forked from mtowers/README.md
Google Analytics Real Time Visitors Widget for Dashing with OAuth2 Authentication
@robertmarsal
robertmarsal / linux_cheat_sheet
Last active December 17, 2015 01:49
Linux Cheat Sheet
---
Compression
---
# Create folder.tar.bz2 from folder
tar -cvjf folder.tar.bz2 folder/*
---
Mysql
---
# Dump selected table
[remote "origin"]
url = git@bitbucket.org:username/reponame.git
fetch = +refs/heads/*:refs/remotes/origin/*
@robertmarsal
robertmarsal / bitbucket_repo_original_conf.sh
Created May 11, 2012 09:00
Git original repo configuration
[remote "origin"]
url = https://username@bitbucket.org/username/reponame.git
fetch = +refs/heads/*:refs/remotes/origin/*
<?php
$default_form_data = array ('disabled_select' => true);
$my_form = new my_form($default_form_data);
$my_form->display();
@robertmarsal
robertmarsal / disable_moodle_form.php
Created May 9, 2012 14:28
Moodle form that is disabled based on customdata parameters
<?php
require_once($CFG->dirroot.'/lib/formslib.php');
class my_form extends moodleform{
function definition() {
//check if the select must be disabled
isset($this->_customdata['disabled_select'])
@robertmarsal
robertmarsal / recycler.rb
Created April 15, 2012 12:31
Problem C: Recycled Numbers
file = File.new("input", "r")
max = file.gets
counter = 1
while (line = file.gets)
result = 0
raw_range = line.split(" ")
range = raw_range[0].to_i..raw_range[1].to_i
computed = Hash.new
@robertmarsal
robertmarsal / googlerese-translator.rb
Created April 15, 2012 12:21
Problem A: Speaking in Tongues
#googlerese to english
mapping = { "a" => "y", "b" => "h", "c" => "e", "d" => "s", "e" => "o",
"f" => "c", "g" => "v", "h" => "x", "i" => "d", "j" => "u",
"k" => "i", "l" => "g", "m" => "l", "n" => "b", "o" => "k",
"p" => "r", "q" => "z", "r" => "t", "s" => "n", "t" => "w",
"u" => "j", "v" => "p", "w" => "f", "x" => "m", "y" => "a",
"z" => "q"}
file = File.new("input", "r")
max = file.gets
@robertmarsal
robertmarsal / dancing-googlers.rb
Created April 15, 2012 12:19
Problem B: Dancing With the Googlers
file = File.new("input", "r")
max = file.gets
counter = 1
while (line = file.gets)
data = line.split(" ")
#num of cases
cases = data[0].to_i
#num of surprising cases
s = data[1].to_i
#min result