This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("Hello World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LAST_VERSION_NUMBER=$(curl -s "https://go.dev/dl/?mode=json" | jq ".[0].version" | sed 's/"//g' | sed 's/go//') | |
DOWNLOAD_URL="https://go.dev/dl/go${LAST_VERSION_NUMBER}.linux-amd64.tar.gz" | |
BASE_DIR="/opt/go" | |
FOLDER_NAME="go-${LAST_VERSION_NUMBER}" | |
UNPACK_DST="${BASE_DIR}/${FOLDER_NAME}" | |
if [ -d "${UNPACK_DST}" ]; then | |
echo "Already installed last version ${LAST_VERSION_NUMBER}!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import htmx from "htmx.org"; | |
class ExtensionName { | |
/** @private @type {WeakMap<HTMLElement, ExtensionName>} */ | |
static _elementInstances = new WeakMap(); | |
/** @private @type {HTMLElement} */ _rootElement; | |
/** | |
* @param {HTMLElement} element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Stash -> Pull -> Pop | |
git stash | |
git pull | |
git stash pop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GENERIC_DOWNLOAD_URL='https://discord.com/api/download?platform=linux&format=deb' | |
FILE_DOWNLOAD_URL=$(curl -v -L -I "$GENERIC_DOWNLOAD_URL" 2>&1 | grep -o -i -E "'https://dl.discordapp.net/.*?'" | sed "s/'//g") | |
FILE_NAME=$(basename $FILE_DOWNLOAD_URL) | |
FILE_DEST=/tmp/$FILE_NAME | |
echo "[*] Installing new Discord '$FILE_NAME' from '$FILE_DOWNLOAD_URL' to '$FILE_DEST'..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Breadth-First Search: check if there are any routes between two points in graph | |
package main | |
import ( | |
"errors" | |
"fmt" | |
) | |
var airports = [...]Node{"PHX", "BKK", "OKC", "JFK", "LAX", "MEX", "EZE", "HEL", "LOS", "LAP", "LIM"} | |
var routes = [...]*Edge[Node]{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remap gets the array you want to process and the callback function, passing to it the same properties as a map. | |
// The data returned by the callbackFn will be filtered out if undefined, or mapped in if something else. | |
// Everything at the cost of only one loop pass. | |
function remap<T, R>(array: T[], callbackFn: (value: T, index: number, array: T[]) => R | undefined): R[] { | |
const result = new Array<R>(); | |
for (let i = 0; i < array.length; i++) { | |
const data = callbackFn(array[i], i, array); | |
if (data !== undefined) result.push(data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name source: https://brasil.io/dataset/genero-nomes/files | |
Code: https://gist.github.com/D1360-64RC14/ac018f8a26eae81f27ad4cf4de5dcae1 | |
MarIA | |
AntonIA | |
MarcIA | |
PatricIA | |
LeticIA | |
JulIA | |
VitorIA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
NAME = 0 | |
FREQUENCY = 1 | |
file = open("nomes.csv", "r") | |
name_reader = csv.DictReader(file) | |
# CATIA -> CatIA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sudoas { | |
local LAST_COMMAND=$(history 2 | head -n 1 | sed -E 's/ [[:digit:]]+ //') | |
echo "> sudo $LAST_COMMAND" | |
sudo $LAST_COMMAND | |
} |
NewerOlder