Skip to content

Instantly share code, notes, and snippets.

View cbfn's full-sized avatar

Christian Nascimento cbfn

View GitHub Profile
@cbfn
cbfn / docker_console.sh
Last active March 2, 2023 17:09
Getting docker container id
# Don't forget to change <text> with the search term
#!/bin/bash
DOCKER_CONTAINER_NAME="container name or other text"
DOCKER_CONTAINER="$(docker ps | grep $DOCKER_CONTAINER_NAME | awk '{print $1;}')"
DOCKER_RUN_CONSOLE="docker exec -it $DOCKER_CONTAINER /bin/bash"
ascii_name() {
cat <<"EOT"
_ _ _
@cbfn
cbfn / us-phone-format.js
Last active October 2, 2017 17:05
Phone format
function formatPhone(phone) {
var regex = phone.match(/(\d{3})(\d{4})(\d+)/);
return '(' + regex[1] + ') ' + regex[2] + '-' + regex[3];
}
var phone = '4031234789';
formatPhone(phone);
// Result: (403) 1234-789
@cbfn
cbfn / image-resize.js
Created December 5, 2018 18:48
Image resize using node.js
const im = require('imagemagick');
const fs = require('fs');
const mime = require('mime-types');
fs.readdir('./uploads/', (err, filenames) => {
if (err) throw err;
filenames.forEach((filename) => {
if (mime.lookup(filename) && mime.lookup(filename).includes('image')) {
fs.readFile('./uploads/' + filename, (err, data) => {
if (!filename) {

Install Android SDK CLI Arch Linux WSL2 (Work in Progress)

Install openjdk

sudo pacman -Ss jdk

sudo pacman -S jdk-openjdk

Android SDK