Skip to content

Instantly share code, notes, and snippets.

@alexdantas
alexdantas / autoscroll.lua
Last active January 3, 2022 04:10 — forked from mason-larobina/autoscroll.lua
Autoscroll script for the Luakit browser
-- Autoscroll script for luakit (luakit.org).
-- Originally by @mason-larobina
-- (https://gist.github.com/mason-larobina/726550)
--
-- Install instructions:
-- * Add to rc.lua before window spawning code
-- Or
-- * Save to $XDG_CONFIG_HOME/luakit/autoscroll.lua and
-- add `require "autoscroll"` to your rc.lua
----------------------------------------------------------------
@alexdantas
alexdantas / wget-all.sh
Created April 24, 2014 22:28
Downloads all files with a specified extension from a website
#!/usr/bin/bash
#
# wget-all: gets all files from a specified file extension
# on a remote host
function usage() {
echo 'Usage:'
echo ' $ wget-all.sh <remote-host> <filename-extension>'
echo
echo 'Example:'
Private Sub CommandButton1_Click()
Dim cpfs As Range
Set cpfs = ThisWorkbook.Worksheets("pdf").Range("B3:B169")
Dim cpf As Range
Dim new_cpfs As Range
Set new_cpfs = ThisWorkbook.Worksheets("09").Range("C2:C194")
@alexdantas
alexdantas / hello.asm
Created December 6, 2013 20:04
"Hello, World" in IA-32 (NASM, Linux)
;; My first IA-32 program!
;;
;; It shows "Hello, World" and exits normally
section .data
msg db "Hello, World!", 0xA ; Message to show
size EQU $ - msg ; Length of the message
global _starting_here ; Global entry for `ld`
@alexdantas
alexdantas / triangle-fractal.rb
Created September 30, 2013 14:04
Implementation of The Chaos Game in Ruby
#!/usr/bin/env ruby
#
# A test on fractals, implementing The Chaos Game
# http://math.bu.edu/DYSYS/chaos-game/node1.html
#
# UGLY CODE IS UGLY
require 'sdl'
# Global SDL screen pointer
@alexdantas
alexdantas / uva-difficulty-searcher.rb
Created September 18, 2013 00:26
Shows a list of UVa problems ordered by difficulty level (uses Ruby and Nokogiri).
#!/usr/bin/env ruby
#
# Gets problems from the UVa website, in order of solvability.
#
# Sample page:
# http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3
require 'nokogiri'
require 'open-uri'
@alexdantas
alexdantas / test.rb
Created September 18, 2013 00:23
RubySDL test.
# Awesome test on 'rubysdl' gem
# Complete reference:
#
# http://www.kmc.gr.jp/~ohai/rubysdl_ref_2.en.html
require 'sdl'
begin
SDL.init(SDL::INIT_EVERYTHING)
screen = SDL::Screen.open(200, 200, 0, SDL::HWSURFACE)
@alexdantas
alexdantas / circle.rb
Created September 8, 2013 01:32
Shows circles around the screen with ruby Curses' console interface.
require 'curses'
# Hell yeah
DANI_NUMERO_CIRCULOS = 4
DANI_LIMPAR_TELA = false
# All possible colors.
Colors = {
@alexdantas
alexdantas / pipes.rb
Created September 6, 2013 03:15
Shows a nice screensaver on the terminal with Ruby Curses.
#!/usr/bin/env ruby
#
# pipes.rb: Displays a nice animation on the terminal,
# based on an old screensaver.
#
# If you want to see some action, scroll to the bottom.
# The main code is between "begin" and "end".
#
# This code uses Ruby and it's Curses module to display
# characters on the terminal.
@alexdantas
alexdantas / github-zipball.sh
Created June 3, 2013 18:31
Gets the archived zipball of a GitHub repository
#!/bin/bash
# Gets the archived zipball of a GitHub repository
# $1 user
# $2 repo
LINK="https://github.com/$1/$2/archive/master.zip"
ZIPFILE="$2.zip"
echo "Downloading project '$2' from GitHub user '$1'..."