Skip to content

Instantly share code, notes, and snippets.

View diegogslomp's full-sized avatar
🛸

Diego Gobbi Slomp diegogslomp

🛸
View GitHub Profile
const puppeteer = require('puppeteer');
require('dotenv').config();
class Browser {
constructor() {
this.url = 'https://ssi.caxias.rs.gov.br';
this.user = process.env.USER;
this.password = process.env.PASSWORD;
this.browserOptions = {
headless: false,
#!/usr/bin/env bash
# Fix amdgpu ubuntu missing files and screen tearing
# Show missing files
cat /var/log/**/*.log | grep -i amdgpu
# Download and copy missing files to system location
cd ~/repos/
git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
sudo cp -r ~/repos/linux-firmware/amdgpu/* /lib/firmware/amdgpu/
# Update
sudo update-initramfs -k all -u -v
A0bJGwAsKrdQaRehGkbKMaVaBvCMJNMguUbINqX0DaLGQeQcVbEOqKp3SqEGAlWpg0jJQlI9pCpNREq5SLARyEeRGimSkyJWAlXJTJK6iaqdJH4qGYrkKFKqWkpVPaVMVVyF1FalgK9IqZwFqmItUqq8VQq6qxSyV/qrFA2GUIdBi1E8RqnJSHVZZTOgz6gYTZXTqqxWCvQaqDJbVbcJZbeo30TDgbIc8RzKdOE6SrZD9R2C8UjhPFBZjxTth5C7d2p0GJCBBOvUwiMHo1Pz7nG8qAJA1RAePbwqKGRAo0YOjBUwnsyd2mXI/KveqEGaR15cp3YZMv/KNBo1zuUj8HdqIePEsE6NQyRCeLQ9cux4MtdSy5/Q3lKGlrqGPZpXRaTVMDDIfplTBalRk8wGjx0PPxCBYpe6x/GiCkrTaozMLGwxGzx2PPwoib14MtdooWfVICvkEMgGz39grIDxZK5eC/jBe5mTOkgHESh2xob/quw1CASvTA2Hn3Vs+SXp1EhBWx8fFZLmgyRCoVQ7QAUokCtS1TgFiVDIKB8RYN9FKiQk1L4tkCtS1ZiCkJE1DSASATSAhgRA2rcFckWoRk3s5ScGwTo17NG8KgCA1mjUxCR+BOvUhI+jQZsgyWZhvhALBhJe4kdqsyi1ABonfBwN2gRJNgtz+ppZvFoAjdMcd6+NRw6GDgkv8SM1fc0s3p+kU+OEj6MTCpLL4fQ1s3h/kk6N46IcqiZ8HA3apD4Ed8QXYsFAwkv8SE1fM4t3wsfRCQXJ5XD6mlm84+5btxXVhI+jQZt++Oi8xI/U9DWzeLUAGid8HJ1QkFwOp6+ZxasF0DiUA2x9auoDhq8Hg5f4kZq+ZhavFkDjhI+jEwqSy+H0NbN4tQAah3KoWprnJX6kNotSC6BxwsfRCQXJ5XCzKLUAGgcQaY4rquksIBDjJX6kNovyJ+nUOJ5PyU8/4mZRagE0jovstBr/CJFkntgRFS/xI7VZlOMfIZLMEzsCcPqaWbzTnFbTJYbprAiZ
from django.core.cache import cache
def populateDropdown(request):
dropList = cache.get('droplist')
if not dropList: # check if droplist has expired in cache
database = cx_Oracle.connect('username', 'password', 'host')
cur = database.cursor()
cur.execute("select distinct(item) from MY_TABLE")
dropList = simplejson.dumps({"dropList": list(cur)})
cache.set('droplist', dropList, 600) # 10 minutes
@diegogslomp
diegogslomp / treesize.sh
Last active September 4, 2020 14:29
A simple “treesize” shell script for Linux
#/bin/sh
# https://blog.aclarke.eu/2011/09/21/a-simple-treesize-shell-script-for-linux/
[ $# -eq 1 ] || { echo 'Needs folder/file argument! Exiting..'; exit 1 ;}
du -k --max-depth=1 "$1" | sort -nr | awk '
BEGIN {
split("KB,MB,GB,TB", Units, ",");
}
{
@diegogslomp
diegogslomp / local-install-and-dns-cache.rst
Created August 28, 2020 16:20
Samba Active Directory Domain Controller install with Dnsmasq cache

samba-ad-dc

Samba Active Directory Domain Controller install with Dnsmasq cache

Centos7 install

  1. Samba dependences:
@diegogslomp
diegogslomp / wait-db.py
Last active April 25, 2019 21:42
Python script to wait db connection for docker-compose
#!/usr/bin/env python
import socket
import time
import os
if __name__ == '__main__':
port = int(os.environ["DB_PORT"]) # 5432
host = os.environ["DB_HOST"] # db
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
while True:
@diegogslomp
diegogslomp / .gitignore
Last active August 22, 2018 12:57
Expressjs Example
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
@diegogslomp
diegogslomp / grower.ino
Last active August 27, 2018 14:46
[arduino] Grower with lcd menu, temp/moisture sensors - under dev
/*
Temperature and moisture sensors displayed at 16x9 lcd.
Menu navigation using 2-axis joystick.
The circuit:
* LCD RS pin to digital pin 6
* LCD Enable pin to digital pin 7
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
@diegogslomp
diegogslomp / 2axis_lcd_main_menu.ino
Last active February 10, 2025 05:24
[arduino] 2-axis joystick and lcd menu
/*
16x9 lcd menu navigation using 2-axis joystick.
The circuit:
* LCD RS pin to digital pin 6
* LCD Enable pin to digital pin 7
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2