Skip to content

Instantly share code, notes, and snippets.

View alganet's full-sized avatar

Alexandre Gomes Gaigalas alganet

View GitHub Profile
@alganet
alganet / scrito
Last active August 29, 2015 13:57
Prototype for Mosai Script Tools 1.0. Works on sh, bash, ksh, zsh, and cmd on Windows and Wine! No dependencies.
#!/usr/bin/env sh
scrito () ( : )
# Static version information
scrito_v () ( scrito_version )
scrito_version () ( echo "Mosai Script Tools 1.0" 1>&2 )
# Short help text
scrito_h () ( scrito_help )
@alganet
alganet / hybrid.cmd
Last active August 29, 2015 13:57
Hybrid sh/bat script and data file
rem () ( $* ) # Mosai Script Hybrid 1.0
rem : "Usage: sh hybrid.cmd (shell), hybrid.cmd (win/wine), cscript /nologo /E:vbscript hybrid.cmd"
rem echo "HELLO FROM SH!!!"
rem <<REM
'&&@echo off && cls && goto :WScript.Quit
WScript.Echo "HELLO FROM VBS!!!"
:WScript.Quit
'& echo HELLO FROM BATCH!!!
'& exit /b
rem raw scripts to be used here
@alganet
alganet / answer.sh
Created September 21, 2014 13:03
testing
answer_cr=$(printf '\r')
answer_esc=$(printf '\33')
answer_oldterm=''
answer_focused=-1
answer_total=0
answer_widgets ()
{
answer="$1"
echo "$answer" |
@alganet
alganet / arch.md
Last active August 29, 2015 14:20
@alganet
alganet / runup_builder.sh
Created May 30, 2015 04:11
runup_builder
runup_builder () {
(
tab=$(printf '\t')
line="[0-9][0-9]*${tab}"
stream_doc="/^0${tab}\(.*\)$/"
doc_line="/^${line}\(.*\)/"
doc_indent="/^${line}\(${tab}\| \)\(.*\)$/"
doc_fence="/^${line}\(~~~\|\`\`\`\)$/"
doc_direc="/^${line}\(\[@\]\:\)\([a-zA-Z0-9]*\)\s*(*\([^)]*\)\s*)*\s*$/"
cat <<-SED > foo & cat foo
@alganet
alganet / README.md
Last active August 29, 2015 14:25
runup

[ ]:my:code

This is annotated!
@alganet
alganet / TypeFileOut.py
Last active August 29, 2015 14:26 — forked from stuartlangridge/TypeFileOut.py
Sublime Text 3 Python plugin to "type" the file that's currently being edited, character by character, for screencasts.
import sublime, sublime_plugin
BLOCKLEN = 1
class TypeFileOutCommand(sublime_plugin.TextCommand):
def nextchar(self):
if self.body:
totype = []
while 1:
try:
@alganet
alganet / br_abnt.kb
Last active August 29, 2015 14:26
NohBoard custom ABNT keymap (Basic)
KBVersion 3
width 838
height 267
nKeysDefined 72
category Basic
key 8 581 9 90 43 backspace backspace 0 1
key 9 9 53 67 43 tab tab 0 1
key 13 573 97 98 43 %return% %return% 0 0
key 20 9 97 79 43 caps caps 0 1
key 32 187 185 262 43 %0% %0% 0 0
<?php
$teste = array(
array("foo" => "a", "bar" => "b", "timestamp" => 123456),
array("foo" => "a", "bar" => "b", "timestamp" => 987654),
array("foo" => "a", "bar" => "b", "timestamp" => 654789),
array("foo" => "a", "bar" => "b", "timestamp" => 456123)
);
function sortTimestamp($a, $b) {
@alganet
alganet / gist:819098
Created February 9, 2011 19:33
less javaish SplClassLoader
<?php
spl_autoload_register(
function($className) {
$fileParts = explode('\\', ltrim($className, '\\'));
if (false !== strpos(end($fileParts), '_'))
array_splice($fileParts, -1, 1, explode('_', current($fileParts)));
$file = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';