Skip to content

Instantly share code, notes, and snippets.

View derekstavis's full-sized avatar
🚀

Derek Stavis derekstavis

🚀
View GitHub Profile
@derekstavis
derekstavis / DigitalClock.java
Created October 15, 2012 18:43
DigitalClock HH:MM for Android
package com.derekstavis;
public class DigitalClock extends TextView {
private int hours;
private int minutes;
private int seconds;
private Timer clockTimer;
private final TimerTask clockTask = new TimerTask() {
@Override
@derekstavis
derekstavis / iscc
Last active February 27, 2022 18:16
Compile InnoSetup scripts on unices
#!/bin/sh
# For installation and usage, please refer to my blog post:
# http://derekstavis.github.io/posts/creating-a-installer-using-inno-setup-on-linux-and-mac-os-x/
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Derek Willian Stavis
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@derekstavis
derekstavis / bench.svg
Last active August 29, 2015 14:14
Kivy Clock performance with and without input enabled
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@derekstavis
derekstavis / cpfvalidate.py
Last active September 24, 2020 20:22
Validação de CPF em Python
def validate_cpf(cpf):
''' Expects a numeric-only CPF string. '''
if len(cpf) < 11:
return False
if cpf in [s * 11 for s in [str(n) for n in range(10)]]:
return False
calc = lambda t: int(t[1]) * (t[0] + 2)
d1 = (sum(map(calc, enumerate(reversed(cpf[:-2])))) * 10) % 11
### Keybase proof
I hereby claim:
* I am derekstavis on github.
* I am derekstavis (https://keybase.io/derekstavis) on keybase.
* I have a public key whose fingerprint is 44FA 9853 A0AF 85F6 0998 8033 50B0 3710 6C38 6A9D
To claim this, I am signing this object:
@derekstavis
derekstavis / completion.fish
Created September 9, 2015 01:22
omf completion
# SYNOPSIS
# Completions for Oh My Fish CLI
complete -c omf -f -d "Oh My Fish"
complete -c omf -f -n "__fish_seen_subcommand_from q query" -a (printf "%s " (set | awk '{ printf $1"\n"; }'))
complete -c omf -f -n "__fish_seen_subcommand_from r rm remove" -a (printf "%s " (omf.list_local_packages) (omf.list_installed_themes))
complete -c omf -f -n "__fish_seen_subcommand_from d desc describe" -a (printf "%s " (omf.list_db_packages))
complete -c omf -f -n "__fish_seen_subcommand_from c cd" -a (printf "%s " (omf.list_db_packages))
complete -c omf -f -n "__fish_seen_subcommand_from i install" -a (printf "%s " (omf.list_db_packages "skip installed packages"))

Oh My Fish Plugins

ansible: Ansible development package for Oh My Fish

apt: Short and friendly command wrapper for APT

battery: OS X and Linux compatible battery utilities

brew: Oh My Fish plugin to integrate Homebrew paths into shell.

@derekstavis
derekstavis / LICENSE.md
Last active February 23, 2017 20:07
Integrate Github Pull Requests into Travis by overriding environment

The MIT License (MIT)

Copyright (c) 2015 Derek Willian Stavis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

var Q = require('q')
, R = require('ramda');
function play(message) {
return Q.Promise(function (resolve, reject) {
setTimeout(function () {
console.log('Playing ' + message)
resolve();
}, 3000);
});
@derekstavis
derekstavis / stream-byter-rules.txt
Created February 28, 2016 23:49
Alesis DM6 floortom Stream Byter rules for MidiBridge
# source http://audeonic.boards.net/thread/144/midibridge-small-brain
# DM6/GB floortom
N9 2B = XA 29
N9 = XX +B