Skip to content

Instantly share code, notes, and snippets.

View jweslley's full-sized avatar

Jonhnny Weslley jweslley

View GitHub Profile
@jweslley
jweslley / Lua.lua
Created May 1, 2025 00:57
Minimalist Lua Tutorial (found somewhere in Internet)
-- Lua.lua
--
-- # Minimalist Lua Tutorial
--
print( "Hello, astronaut." )
-- this is a comment, just ignore it.
-- How to download and build Lua on Linux:
@jweslley
jweslley / kamal.sh
Created April 17, 2025 14:27
Kamal cheatsheet
# Kamal commands cheat sheet
# The init command is used to create the config and secrets files once after Kamal is added to the app.
$ kamal init
# Install Docker on all target hosts
$ kamal server
# Aliases
# Kamal defines `kamal shell` out of the box, I usually add `kamal console` to quickly access the Rails console.
@jweslley
jweslley / learn.lua
Created November 19, 2024 12:51 — forked from tylerneylon/learn.lua
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------

O Plano de Numeração é o modo de organização dos números dos serviços de telecomunicações de uso público.

A tabela abaixo tem a relação entre as faixas numéricas de telefone fixo e celular:

STFC   Telefonia Fixa Rural  57
       Telefonia Fixa        2 a 5
SMP    Telefonia Celular     9 para as Bandas A (96 a 99) e B (91 a 94)
                             8 para as Bandas D e E
                             7 Celular e Trunking (Nextel)

6 para as bandas A, B, D e E*

@jweslley
jweslley / keybase.md
Created September 17, 2014 14:44
keybase.md

Keybase proof

I hereby claim:

  • I am jweslley on github.
  • I am jweslley (https://keybase.io/jweslley) on keybase.
  • I have a public key whose fingerprint is E569 E19A 0DD4 2D47 7A64 5799 00EA A9A5 CFA5 D628

To claim this, I am signing this object:

@jweslley
jweslley / gitlab.sh
Last active December 16, 2015 12:49
Backup script to Gitlab
#!/bin/sh
# Usage:
# - Save this file in /etc/cron.daily/gitlab
# - Enable execution permission: chmod +x /etc/cron.daily/gitlab
set -e
DB_USERNAME=username
DB_PASSWORD=secret
BACKUP_DIR='/path/to/backup/'
@jweslley
jweslley / export_csv.sql
Created August 9, 2012 19:43
Dump MySQL table into CSV file
SELECT * INTO OUTFILE 'result.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM my_table;
@jweslley
jweslley / rails.logrotate
Created January 30, 2012 14:01
Logrotate for Rails
#
# File: /etc/logrotate.d/rails
# Test: logrotate -f /etc/logrotate.d/rails
#
/var/www/*/log/*.log {
daily
dateext
notifempty
missingok
rotate 30
@jweslley
jweslley / asciiplot.sh
Created December 28, 2011 18:52
ASCII plot
usage(){
echo "Usage: $(basename $0) [-c <cols>] [-r <rows>] [-p <pch>]"
exit 2
}
cols=50
rows=20
pch="*"
while getopts "c:r:p:h" option; do
case "$option" in
@jweslley
jweslley / big_o.r
Created April 12, 2011 16:58
Running time of common time complexities
big_O.plot <- function(count,log="") {
n <- seq(count)
plot(n, n*n, log=log, type='l', col='red',
ylab="Running time", xlab='n (# of elements)')
lines(n, n*log(n), col='green')
lines(n, n, col='blue')
lines(n, log(n), col='black')
title('Running time of common time complexities')