Skip to content

Instantly share code, notes, and snippets.

View azendal's full-sized avatar

Fernando Trasviña azendal

View GitHub Profile
@azendal
azendal / demo.js
Last active November 11, 2022 20:14
filter, map, reduce intro
/*
Applications filter -> Map -> Reduce and how it relates to functional
(Not a functional programming talk)
But a lil functional code
*/
@azendal
azendal / sets.js
Created November 16, 2022 17:51
using sets in javascript
// utility fns
var getUid = function(length) {
var i, uid, min, max;
length = length || 32;
uid = '';
min = 0;
max = getUid.codes.length - 1;
for (i = 0; i < length; i++) {
@azendal
azendal / sample.py
Created January 14, 2023 05:18
test
print("hello world")
@azendal
azendal / bootstrap.sh
Created January 23, 2023 17:43
bootstrap deploy to a heroku container
#!/bin/bash
# Check if Heroku CLI is installed
if ! command -v heroku &> /dev/null; then
echo "Heroku CLI is not installed, please install it before running this script"
exit 1
fi
# Check if user is logged in
if ! heroku auth:whoami &> /dev/null; then
@azendal
azendal / chat1
Created February 28, 2023 14:56
exported chats
**message:** If I have a CSV file one record per line how can I get an md5 of the columns, title, ref, description, url
**message:** You can use a programming language like Python to read the CSV file, extract the values of the columns title, ref, description, and url for each record, concatenate them into a single string, and then calculate the MD5 hash of the string.Here is some sample Python code that demonstrates how to do this using the built-in csv and hashlib modules:pythonCopy codeimport csv
import hashlib
filename = "example.csv" # replace with the name of your CSV file
with open(filename, "r") as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
@azendal
azendal / dynamo.js
Last active February 28, 2024 01:07
//npm install aws-sdk aws-sdk-mock --save-dev
/*
if (process.env.NODE_ENV === 'development') {
require('./mockDynamoDB');
}
*/
/*
4. Running Your Server