Skip to content

Instantly share code, notes, and snippets.

View gleicon's full-sized avatar

Gleicon Moraes gleicon

View GitHub Profile
#!/usr/bin/python
# redict - redis based dictionary
# this version uses UserDict and a mostly cached redis data for low I/O impact
# almost always consistent dict. to make sure you have all latest data run __sync() periodically
# gleicon 2010 - http://zenmachine.wordpress.com - http://github.com/gleicon - http://7co.cc
import redis
from UserDict import UserDict
import time
@gleicon
gleicon / main.dart
Created January 27, 2024 14:39
Generated code from pixels2flutter.dev
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@gleicon
gleicon / make-icpbrasil-bundle.sh
Created October 31, 2023 12:07 — forked from skarllot/make-icpbrasil-bundle.sh
Download ICP-Brasil certificates and make a bundle
#!/bin/bash
HTTPADDR=http://acraiz.icpbrasil.gov.br/credenciadas/CertificadosAC-ICP-Brasil/ACcompactado.zip
DEST=/etc/ssl/certs/icp-brasil
mkdir -p ${DEST}
cd ${DEST}
rm -f *.crt
rm -f *.zip
@gleicon
gleicon / list_objects_google_storage_boto3.py
Last active October 11, 2023 14:27
How to use boto3 with google cloud storage and python to emulate s3 access.
from boto3.session import Session
from botocore.client import Config
from botocore.handlers import set_list_objects_encoding_type_url
import boto3
ACCESS_KEY = "xx"
SECRET_KEY = "yy"
boto3.set_stream_logger('')
@gleicon
gleicon / id_rsa_encryption.md
Created September 13, 2023 02:06 — forked from fcoury/id_rsa_encryption.md
Encrypt/Decrypt a File using your SSH Public/Private Key on Mac OS X

A Guide to Encrypting Files with Mac OS X

This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes.

Too Long, Didn't Read

Assuming you've already done the setup described later in this document, that id_rsa.pub.pcks8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit…

Encrypting

$ openssl rand 192 -out key

$ openssl aes-256-cbc -in secret.txt -out secret.txt.enc -pass file:key

@gleicon
gleicon / Cargo.toml
Created December 16, 2022 18:36
rust and symspell
[package]
name = "aho-exploration"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
aho-corasick = "0.7.19"
symspell = "0.4.3"
@gleicon
gleicon / gist:1831533
Created February 14, 2012 23:17
cgroups for debian/ubuntu
$ uname -a
Linux labs 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 i686 i686 i386 GNU/Linux
(vanilla kernels after .39 already have everything for cgroups, RH backported it to .35 IIRC)
# http://www.mjmwired.net/kernel/Documentation/cgroups/memory.txt
# apt-get install cgroup-bin
# reboot
login, etc..
library(readxl)
library(readr)
library(tidyverse)
library(lubridate)
library(rsiconfi)
arquivo_geral <- read_excel("HIST_PAINEL_COVIDBR_30jun2020.xlsx",
col_types = c("text", "text", "numeric",
"text", "numeric", "numeric", "numeric",
"date", "numeric", "text", "numeric",
@gleicon
gleicon / mapa_eleicoes_deformado.r
Created November 19, 2022 20:29 — forked from fernandobarbalho/mapa_eleicoes_deformado.r
Gera mapa do Brasil deformado de acordo com variação da votação do PT entre 2018 e 2022 (2º turno)
library(readr)
library(tidyverse)
library(data.table)
library(geobr)
library(cartogram)
library(sf)
library(colorspace)
@gleicon
gleicon / mobile-headers.sh
Created August 11, 2022 13:53 — forked from quarkness/mobile-headers.sh
request headers with iphone / desktop user-agent
#!/bin/sh
echo "iPhone:"
curl -I -H "User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; nl-nl) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5" $1
echo "Desktop:"
curl -I -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3" $1