Skip to content

Instantly share code, notes, and snippets.

View ruda's full-sized avatar
🐵
INFINITE PAGE FAULT. CPU HALTED.

Rudá Moura ruda

🐵
INFINITE PAGE FAULT. CPU HALTED.
View GitHub Profile
@ruda
ruda / waste.txt
Created September 19, 2012 01:39
WASTE (ASCII Art)
______//
(__) \\
W.A.S.T.E.
@ruda
ruda / ghp.txt
Created September 19, 2012 01:40
GHP Mascot (ASCII Art)
GO HORSE
/\___
| --'-------,
| o . /
,--| - ---
,--| \
,-/| \
,-/| \
PROCESS
@ruda
ruda / apple.txt
Created September 21, 2012 00:36
Apple (ASCII art)
../..
( (
\_._/
Apple
@ruda
ruda / buffer.el
Last active October 12, 2015 08:48
Kill all buffers.
(defun kill-all-buffers ()
"Kill all buffers."
(interactive)
(dolist (buffer (buffer-list))
(kill-buffer buffer)))
@ruda
ruda / listchars.vim
Last active March 5, 2024 09:00
Vim: listchars samples
set listchars=tab:→\ ,trail:␣,extends:…,eol:⏎
set listchars=tab:→\ ,trail:␣,precedes:«,extends:»,eol:⏎
set listchars=tab:→\ ,trail:·,precedes:«,extends:»,eol:¶
set listchars=tab:‣\ ,trail:·,precedes:«,extends:»,eol:¬
set listchars=tab:␋\ ,trail:␠,precedes:«,extends:»,eol:␤
set listchars=tab:>-,trail:.,precedes:<,extends:>,eol:$
@ruda
ruda / trees.py
Created January 18, 2015 16:47
Generic tree and binary tree in Python.
# Trees:
# http://en.wikipedia.org/wiki/Tree_(data_structure)
# http://en.wikipedia.org/wiki/Tree_traversal
# http://en.wikipedia.org/wiki/Binary_tree
class BinaryTree(object):
"""Binary tree."""
def __init__(self, name='', left=None, right=None):
self.name = name
self.left = left
@ruda
ruda / arduinoscopio.md
Last active November 10, 2022 23:28
Arduino = Osciloscópio

Arduino = Osciloscópio

Use o seu Arduino como um osciloscópio rudimentar.

Através da porta analógica do Arduino (ANALOG0), alguns fios e software é possível visualizar os dados da entrada analógica (de 0V a 5V) do Arduino, como um osciloscópio. Ideal para quem está treinando em lógica digital com TTL.

Lista de material:

  • Um Arduino (eu uso um Duemilanove);
  • Arduino IDE e Processing instalados no computador;
  • Software de osciloscópio pro Arduino, são dois um pro Arduino (que obtém os dados) outro pro Processing (que visualiza os dados);
  • Software para descobrir em qual porta serial o Arduino está conectado (logo abaixo), necessário somente uma vez.
@ruda
ruda / blackflag.txt
Created May 22, 2015 03:08
⚑ BLACK FLAG ⚑
B L A C K
### ###
### ### ### ###
### ### ### ###
### ### ### ###
### ### ### ###
### ###
F L A G
@ruda
ruda / interpolation_search.py
Created May 26, 2015 01:09
Interpolation Search
# From http://data.linkedin.com/blog/2010/06/beating-binary-search
def interpolation_search(key, array, min, max):
"""
Interpolation search.
>>> a = [7, 28, 28, 41, 45, 50, 59, 68, 74, 96]
>>> k = 59
>>> print interpolation_search(k, a, 0, 99)
6
"""
// pwmanager.js - RSTM
var crypto = require('crypto');
function encrypt(plaintext, keyword) {
var cipher = crypto.createCipher('aes-256-ctr', keyword);
var ciphertext = cipher.update(plaintext, 'utf8', 'hex');
ciphertext += cipher.final('hex');
return ciphertext;
};