Skip to content

Instantly share code, notes, and snippets.

View walbon's full-sized avatar
💭
I may be slow to respond.

Gustavo Walbon walbon

💭
I may be slow to respond.
View GitHub Profile
import random
adjectives = [
"blue", "red", "green", "yellow", "purple", "orange",
"happy", "sad", "angry", "calm", "sleepy", "hungry",
"big", "small", "tall", "short", "wide", "narrow",
"soft", "hard", "rough", "smooth", "hot", "cold",
]
nouns = [
@walbon
walbon / remover.py
Created March 23, 2023 19:18
Scripting to remove part of image in PDF that belongs a text, just taking of the last 20 pixels of image.
import PyPDF2
import sys
import os
def remover(target, file_name):
print(f"!Removing assinature of \"{target}\" from {file_name}")
try:
pdf_file = open(file_name,'rb')
except:
@walbon
walbon / .vimrc
Created June 18, 2018 21:20
Setting VIM variables
colo delek
syntax on
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
"Invisible character colors
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
@walbon
walbon / cscope-find-kernel-files.sh
Created June 17, 2018 12:05
Searching for cscope files
#!/bin/sh
#
# Source: http://cscope.sourceforge.net/large_projects.html
#
# Modified by Gustavo Walbon<[email protected]>
#
DIR_KERNEL=${1:-.}
find ${DIR_KERNEL} \
@walbon
walbon / tmux.conf - guest
Last active December 11, 2018 18:32
tmux.conf - guest
# ♦︎ ♠︎ ♣︎ ♚ ♛ ♜ ♝ ♞ ♟ ⚛ ⚔ 🃁 ❀
######################
### DESIGN CHANGES ###
######################
## source : http://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred
@walbon
walbon / tmux.conf - host
Last active January 28, 2021 14:29
TMUX configuration
# cat << EOF > /dev/null
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# /!\ do not edit this file
# instead, override settings in ~/.tmux.conf.local, see README.md
# -- general -------------------------------------------------------------------
@walbon
walbon / choosing.sh
Last active October 27, 2015 13:34
#!/bin/bash
#alias .CHOOSE='if [[ $FILES ]] ; then ~/.choosing.sh ${FILES} | while read line; do for item in $line; do echo $item; done | xargs ${COM} ; done ; fi; FILES=""; COM=""'
# Usage :
# FILES=$(ls *.txt); COM="egrep -i walbon"; .CHOOSE
#
pkglist=""
pkglist2=""
n=1
@walbon
walbon / .bashrc_update.sh
Last active January 1, 2016 12:29
Hack pra mostrar no prompt o branch atual do Git e também se esta com modificações no stage, mais alguns aliases do git.
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@walbon
walbon / SOAP_Request_WebRequest.cs
Created November 18, 2013 17:23
Workaround pra funcionamento de uma chamada SOAP que tem no response um cabeçalho diferente do que é definido no WSDL do serviço. Isso geralmente ocasiona o erro de mensagem NULA invés de erro. Para isso faço uma chamada via webrequest passando o XML como o BODY da mensagem, é claro tendo que encapsular dentro do ENVELOPE da mesma forma que a ap…
private static string WebRequestPostData(string url, string postData)
{
System.Net.WebRequest req = System.Net.WebRequest.Create(url);
req.ContentType = "text/xml";
req.Method = "POST";
string postDataBody = @"<?xml version=""1.0"" encoding=""utf-8""?><soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><soap:Body><xml><![CDATA[";
postDataBody += postData;
postDataBody += "]]></xml></soap:Body></soap:Envelope>";
@walbon
walbon / psPro.py
Last active November 13, 2017 19:00
Analyser process
#!/usr/bin/env python
# Try to determine how much RAM is currently being used per program.
# Note the per program, not per process. So for example this script
# will report mem used by all httpd process together. In detail it reports:
# sum(all RSS for process instances) + max(shared mem for any process instance)
#
# The shared calculation below will factor out shared text and
# libs etc. within a program, but not between programs. So there