Skip to content

Instantly share code, notes, and snippets.

View akwiatkowski's full-sized avatar

Aleksander Kwiatkowski akwiatkowski

View GitHub Profile
@akwiatkowski
akwiatkowski / cleaner.rb
Created December 27, 2011 09:12
script for downloading shots from webcams
require 'digest/md5'
def clean_directory(d)
path = File.join('pix', d)
to_delete = Array.new
files = Array.new
Dir.new(path).each do |f|
if not File.directory? File.join('pix', d, f)
file_path = File.join(path, f)
@akwiatkowski
akwiatkowski / co_ja_kodze.rb
Created January 13, 2012 09:37
Co ja kodze
=begin
.',,,.
...,,,,,.
..'',;;;:;'.
.,,,;;,,,;:c,'
... .,;,;:;,,,,;:c;,.
;c:;,'.... ..,:lc:::::;,,,,,;c:'.
.;'.'''...','. ..;coddo:ccc:::;,,,,;:c:'.
.'',''...',,'''.. ..''... ...;coxxxxoc:llc:::;;;;;::cl;.
.';;,'....',,;,,,,,.... ....';;;:oxxxxddol:,,:::c::coxkOOdlclollc::;;;;;;;;::'.
@akwiatkowski
akwiatkowski / asound.conf
Created January 15, 2012 13:40
Dell Vostro 3555 linux asound.conf
#pcm.!default {
#type hw
#card 1
#}
ctl.!default {
type hw
card 1
}
@akwiatkowski
akwiatkowski / rubywrap.sh
Created April 17, 2012 13:02 — forked from alexpc/rubywrap.sh
Small wrapper for Ruby scripts running on RVM Single-User installations
#!/bin/bash
# Change those for valid ones
HOMEDIR=/home/yourlogin
RUBYVER="1.9.2-p318"
# Adding to $PATH paths for rvm and ruby executables
PATH=$PATH:$HOMEDIR/.rvm/bin:$HOMEDIR/.rvm/rubies/ruby-$RUBYVER/bin/
# Creating variable containing path to installed gems
RUBYLIB=$HOMEDIR/.rvm/gems/ruby-$RUBYVER/gems/:$HOMEDIR/.rvm/gems/ruby-$RUBYVER@global/gems/
@akwiatkowski
akwiatkowski / xorg.conf
Created April 19, 2012 08:37
vostro 3555 xorg.conf - working skype
Section "ServerLayout"
Identifier "aticonfig Layout"
Screen 0 "aticonfig-Screen[0]-0" 0 0
EndSection
Section "Module"
EndSection
Section "Monitor"
Identifier "aticonfig-Monitor[0]-0"
@akwiatkowski
akwiatkowski / make_it_so.rb
Created May 26, 2012 21:09
graphs for wind turbine
data = Array.new
f = File.new('power_calculator.txt')
f.each_line do |l|
if l =~ /(\d*);(\d*);(\d*\.?\d*);(\d*\.?\d*)/
data << {
time_from: $1.to_i,
time_to: $2.to_i,
energy: $3.to_f,
utilization: $4.to_f,
url = "http://blitzortung.net/Images/image_b_pl.png"
ref = "http://blitzortung.net"
agent = "Internet Explorer 8.0"
interval = 10*60
sleep_interval = 20
next_download_t = Time.now.to_i
Dir.mkdir('data') unless File.exists?('data')
loop do
@akwiatkowski
akwiatkowski / application_helper.rb
Created November 15, 2012 18:00
Simple model details view table for Bootstrap Rails app
module ApplicationHelper
# Usage:
# use in view with bootstrap
# = simple_model_details(User.first)
#
# Keep in mind:
# * it uses only locales in format like this 'en.user.email'
#
# Custom attributes:
# = simple_model_details(User.first, attrs: ["email", "name"])
@akwiatkowski
akwiatkowski / disable_double_click.js
Last active December 21, 2015 07:09
Disable doubled clicks (js)
function do_nothing() {
return false;
}
// http://stackoverflow.com/questions/1681679/disabling-links-to-stop-double-clicks-in-jquery
// prevent a second click for 10 seconds. :)
$('.one_click').live('click', function(e) {
$(e.target).attr("disabled", "disabled");
$(e.target).click(do_nothing);
setTimeout(function(){
@akwiatkowski
akwiatkowski / downloader.cr
Last active October 13, 2015 15:00
crystal attribute declaration problem
require "yaml"
require "logger"
class WebcamDownloader::Downloader
def initialize
@logger = Logger.new(STDOUT)
@webcam_array = WebcamArray.new
end