Skip to content

Instantly share code, notes, and snippets.

@gutierri
gutierri / quake-terminal.ahk
Last active November 20, 2020 00:29
quake style terminal for Windows, write on ahk (key press F12)
; quake-terminal ~ quake-style terminal drop down
; Copyright (C) 2020 Gutierri Barboza
;
; This program is free software: you can redistribute it and/or modify it under
; the terms of the GNU General Public License as published by the Free Software
; Foundation, either version 3 of the License, or (at your option) any later
; version.
;
; This program is distributed in the hope that it will be useful, but WITHOUT
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@gutierri
gutierri / win-ratpoison-like.ahk
Last active May 11, 2020 14:58
ratpoison like on Windows 10 (s+j)
; reference for key-binds default
; nongnu ratpoison ~ https://www.nongnu.org/ratpoison/doc/Default-Key-Bindings.html
powered() {
Input, OutputVar, L1 m
Switch Asc(OutputVar) {
; ctlr-j |
Case 124:
; TODO: only maximized
WinRestore, A
@gutierri
gutierri / migrate-django.md
Created February 25, 2019 20:46 — forked from sirodoht/migrate-django.md
How to migrate Django from SQLite to PostgreSQL

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

@gutierri
gutierri / fix_permissions.py
Last active April 18, 2018 14:58 — forked from magopian/fix_permissions.py
Django admin command to "fix permissions" (create them properly for proxy models).This is needed because of the following bug in Django (not fixed as of 1.6): https://code.djangoproject.com/ticket/11154 (Work with Django > 1.6 and <= 1.9.X)
# -*- coding: utf-8 -*-
"""Add permissions for proxy model.
This is needed because of the bug https://code.djangoproject.com/ticket/11154
in Django (as of 1.6, it's not fixed).
When a permission is created for a proxy model, it actually creates if for it's
base model app_label (eg: for "article" instead of "about", for the About proxy
model).
@gutierri
gutierri / html_dom_writter_ajax.js
Created December 2, 2017 16:53
for .. of .. obj
$(document).ready(function() {
let print_selectors = [
{selector: '.graphs_alfa', url: 'https://httpbin.org/uuid'},
{selector: '.graphs_beta', url: 'https://httpbin.org/uuid'},
{selector: '.graphs_gama', url: 'https://httpbin.org/uuid'}
];
for (let _obj_print_selectors of print_selectors) {
$.ajax({
url: _obj_print_selectors.url,
(defn fizzbuzz [start finish]
(map (fn [n]
(cond
(zero? (mod n 15)) "FizzBuzz"
(zero? (mod n 3)) "Fizz"
(zero? (mod n 5)) "Buzz"
:else n))
(range start finish)))
(fizzbuzz 1 100)
@gutierri
gutierri / range.ts
Last active March 20, 2020 06:57
Range like python on TypeScript
function range(_p: number, _t?: number, _s?: number): Array<number> {
/**
* @param <_p> Return a list integers of zero until <_p> value.
* @param <_t> Return a list integers of <_t> until <_p> value.
* @param <_s> Return a list integers of <_t> until <_p> with steps <_s> value.
* @return Return a array list
*/
let start: number = (_t) ? _p : 0;
let stop: number = (_t) ? _t : _p;
@gutierri
gutierri / unstart.py
Created March 5, 2017 16:18
unstart all github profile with splinter (python)
from splinter import Browser
while True:
with Browser() as browser:
browser.visit('https://github.com/gutierri?tab=stars')
button = browser.find_by_css('.btn.btn-sm.js-toggler-target')
if not button:
break
language github url
Python https://github.com/charliewolf/pynder
Python https://github.com/ayush1997/Xvision
C https://github.com/coreboot/coreboot
C https://github.com/jwerle/progress.c
C++ https://github.com/arybczak/ncmpcpp
null https://github.com/ggomaeng/awesome-js
Python https://github.com/celery/celery
C https://github.com/jgamblin/Mirai-Source-Code
Shell https://github.com/jgamblin/curluseragent
@gutierri
gutierri / validate_cpf.js
Last active August 29, 2015 13:57 — forked from fabiomontefuscolo/gist:1095584
Validação de CPF
function validate_cpf(cpf) {
var sum, summod11;
cpf = cpf.replace(/[^0-9]/g, '');
if(cpf.length != 11 || cpf.match(/^([0-9])\1+$/)) {
return false;
}
// 9 primeiros digitos do cpf
var digit = Array.prototype.slice.call(cpf, 0, 9);