Skip to content

Instantly share code, notes, and snippets.

@sposmen
sposmen / config_add
Created August 8, 2024 20:53
Git options for rebase
[rebase]
autoStash = true
rebaseMerges = true
updateRefs = true
@sposmen
sposmen / Readme.md
Last active June 8, 2022 20:33
Node Server Body Parser

Run

node server_body_parser.js

Setup in your endpoint

http://localhost:8888

Change port

Change the variable port in the code. 8888 is the default

@sposmen
sposmen / excel_to_csv_commands.sh
Created March 2, 2022 17:44
Large Excel to split CSV helpers
# Command to convert the large Excel to csv. this is based on gnumeric
# To install it in Mac could be through `brew install gnumeric`
ssconvert -O "sheet=SHEET_NAME" EXCEL_FILENAME.xlsx CSV_FILENAME.csv
# Command to split the large csv in chunks of lines through parallel command.
# This case is 30K lines each file and each file will be numbered based on the `{#}` addition in the filename
# To install parallel in MAC `brew install parallel`
cat CSV_FILENAME.csv | parallel --header : --pipe -N30000 'cat > CSV_FILENAME_{#}.csv'
@sposmen
sposmen / .env.example
Last active October 6, 2021 03:52
Github PR Tree
#GITHUB_ACCESS_TOKEN=
GH_OWNER=rew-ca
GH_REPO=rewportal
SHOW_DOT=true
@sposmen
sposmen / Readme.md
Last active September 1, 2021 16:15
JS Array vs Object performance

JS Array vs Object performance

The intention of this code is to have some personal persistance and point of view comparing JS objects and arrays mapping some values for its later search.

Recently (2021-09-01) is very common that people try to use a "fancy" way to compound structures when not in all scenarios could the most performant. Usage of find, map, reduce and is good use them when it merits, but on other cases, organize the data based on an Object by keys can increase the performance.

Here is another point of view and

@sposmen
sposmen / Temp Table Schema Fn.sql
Created July 2, 2021 18:05
Postgres temporarily function to get a table schema.
CREATE OR REPLACE FUNCTION pg_temp.generate_create_table_statement(p_table_name varchar)
RETURNS text AS
$BODY$
DECLARE
v_table_ddl text;
column_record record;
BEGIN
FOR column_record IN
SELECT
b.nspname as schema_name,
@sposmen
sposmen / gist:08f36b3de8f3469e0e4c2bd8ab14200b
Last active May 4, 2020 22:04
FFMpeg Image and Audio to Video
ffmpeg installation working in Mac Catalina
brew tap varenc/ffmpeg
brew tap-pin varenc/ffmpeg
brew install ffmpeg $(brew options ffmpeg --compact)
ffmpeg -loop 1 -i Lo\ que\ Aprendí.png -c:v libx264 -t 73 -pix_fmt yuv420p -vf scale=1280:720 Lo\ que\ Aprendí.mp4
ffmpeg -i Lo\ que\ Aprendí.mp4 -i Lo\ que\ Aprendí.mp3 Lo\ que\ Aprendí.mkv -c copy
@sposmen
sposmen / convert.sh
Created November 25, 2019 20:48
This small script is to memoize a fast convertion of ffmpeg
#!/usr/bin/env bash
for i in *.MP4;
do name=`echo $i | cut -d'.' -f1`;
FILE="small/${name}_small.MP4"
if [ -f "$FILE" ]; then
echo "$FILE exist"
else
echo "$FILE does not exist. Creating..."
ffmpeg -i "$i" "${FILE}";
@sposmen
sposmen / Flatten.rb
Last active August 6, 2019 20:27
Flatten example
data_array = [[1,2,[3]],4]
def manual_flatten(arr)
new_array = []
arr.each do |elm|
if elm.kind_of?(Array)
new_array.concat(manual_flatten(elm))
else
new_array << elm
end
@sposmen
sposmen / Claro Tecnicolor TC8305C.md
Last active May 13, 2024 19:28
Claro Tecnicolor TC8305C