Skip to content

Instantly share code, notes, and snippets.

View andersonbosa's full-sized avatar
🥑

Anderson Bosa andersonbosa

🥑
View GitHub Profile
function interceptNetworkRequests(ee) {
const open = XMLHttpRequest.prototype.open;
const send = XMLHttpRequest.prototype.send;
const isRegularXHR = open.toString().indexOf('native code') !== -1;
// don't hijack if already hijacked - this will mess up with frameworks like Angular with zones
// we work if we load first there which we can.
if (isRegularXHR) {
@andersonbosa
andersonbosa / neomuttrc
Last active July 27, 2021 20:31 — forked from VladimirPal/neomuttrc
Minimal neomutt config for gmail imap
set imap_user="$PRV_GMAIL_USER"
set imap_pass="$PRV_GMAIL_PASSWRD"
set folder=imaps://imap.gmail.com/
set spoolfile=+INBOX
set record="+[Gmail]/Sent Mail"
set postponed="+[Gmail]/Drafts"
# https://www.neomutt.org/guide/reference search sleep_time for additional info
set sleep_time=0 # be faster
@andersonbosa
andersonbosa / CK 62 Layers Fix (SmileY).ahk
Created September 10, 2021 23:49 — forked from SmileYzn/CK 62 Layers Fix (SmileY).ahk
Motospeed CK 62 Layers Fix by SmileY v0.5
;-----------------------------------------------------------------------
; Motospeed CK 62 Layers Fix by SmileY v0.5
;-----------------------------------------------------------------------
;-----------------------------------------------------------------------
; Inativar a tecla caps lock
;-----------------------------------------------------------------------
SetCapsLockState, AlwaysOff
;-----------------------------------------------------------------------
@andersonbosa
andersonbosa / gist:4666c8f73e02080e93af0fa342b90985
Created November 5, 2021 17:58 — forked from khakimov/gist:3558086
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@andersonbosa
andersonbosa / argparse_optional_argument.py
Created December 4, 2021 18:50 — forked from pknowledge/argparse_optional_argument.py
Python, argparse, and command line arguments example
import argparse
if __name__ == '__main__':
# Initialize the parser
parser = argparse.ArgumentParser(
description="my math script"
)
# Add the parameters positional/optional
parser.add_argument('-n','--num1', help="Number 1", type=float)
@andersonbosa
andersonbosa / pyargs.md
Created December 4, 2021 18:51 — forked from dideler/pyargs.md
Parsing Command-Line Argument in Python

Command-line arguments in Python show up in sys.argv as a list of strings (so you'll need to import the sys module).

For example, if you want to print all passed command-line arguments:

import sys
print(sys.argv)  # Note the first argument is always the script filename.

Command-line options are sometimes passed by position (e.g. myprogram foo bar) and sometimes by using a "-name value" pair (e.g. myprogram -a foo -b bar).

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@andersonbosa
andersonbosa / bookmark.js
Created January 19, 2022 18:05 — forked from oilvier/bookmark.js
Javascript to add a bookmark - Cross Browser
/**
*
* Add to bookmark
* Several tests are necessary in order for this "simple" action to work in most of the browsers
*
*/
// First, we define the element where the "Add to bookmark" action will trigger
var triggerBookmark = $(".js-bookmark"); // It must be an `a` tag
@andersonbosa
andersonbosa / TMUX_COPY_PASTE_BUFFER
Created March 31, 2022 18:57 — forked from ekiara/TMUX_COPY_PASTE_BUFFER
Copy and Paste Buffers in TMUX
#### http://awhan.wordpress.com/2010/06/20/copy-paste-in-tmux/
#### emacs style copy in tmux
1) enter copy mode using Control+b [
2) navigate to beginning of text, you want to select and hit Control+Space
3) move around using arrow keys to select region
4) when you reach end of region simply hit Alt+w to copy the region
5) now Control+b ] will paste the selection
#### vim/vi style copy in tmux
@andersonbosa
andersonbosa / url_encode.rb
Created May 18, 2022 13:10 — forked from vills/url_encode.rb
Percent encoding for URI conforming to RFC 3986. Ref: http://tools.ietf.org/html/rfc3986#page-12
require 'liquid'
require 'uri'
# Percent encoding for URI conforming to RFC 3986.
# Ref: http://tools.ietf.org/html/rfc3986#page-12
module URLEncoding
def url_encode(url)
return URI.escape(url, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
end
end