Skip to content

Instantly share code, notes, and snippets.

View andersonbosa's full-sized avatar
🥑

Anderson Bosa andersonbosa

🥑
View GitHub Profile
@andersonbosa
andersonbosa / jwtRS256.sh
Created March 4, 2023 19:06 — forked from Holger-Will/jwtRS256.sh
generate public private key pair (RSA RS256) for use with koa-jwt jasonwebtoken etc.
# generate private key
openssl genrsa -out private.pem 2048
# extatract public key from it
openssl rsa -in private.pem -pubout > public.pem
############################################################################################################
################## #############################
################## #############################
This Gist collection contains all localstack related examples
################## #############################
################## #############################
############################################################################################################
@andersonbosa
andersonbosa / project-ideas01.md
Created February 24, 2023 03:09 — forked from MWins/project-ideas01.md
Back end Projects - list

Project Ideas

Ok. I'm going to list off some ideas for projects. You will have to determine if any particular idea is good enough to include in a portfolio. These aren't creative ideas. They likely already exist. Some are way too advanced while others are simplistic.

I will recommend to post any project you make to github and make a github project page for it. Explain in as much detail as possible how you made it, how it can be improved etc. Document it.

If you pick an advanced idea, setup a development roadmap and follow it. This will show some project management skills.

Another piece of advice for those who are design challenged. Use different front end frameworks and use different themes for those frameworks to provide appealing designs without looking like yet another bootstrap site.

@andersonbosa
andersonbosa / crypt.rb
Created September 20, 2022 16:50 — forked from ChunAllen/crypt.rb
Encryption using AES-256-CBC with Rails
module Crypt
class << self
ENCRYPTION_KEY = Rails.application.secrets[:encryption_key]
ALGO = 'aes-256-cbc'.freeze
def encrypt(value)
crypt(:encrypt, value)
end
@andersonbosa
andersonbosa / gist:d0f0d7cb102b5dcfcf14c692827be8f3
Created September 20, 2022 16:50 — forked from ericchen/gist:3081968
ruby openssl AES encrypt and decrypt
require 'base64'
require 'digest'
require 'openssl'
module AESCrypt
def AESCrypt.encrypt(password, iv, cleardata)
cipher = OpenSSL::Cipher.new('AES-256-CBC')
cipher.encrypt # set cipher to be encryption mode
cipher.key = password
@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
@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 / 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

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 / 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).