Skip to content

Instantly share code, notes, and snippets.

View ricalamino's full-sized avatar
♦️
Piece of peace

Ricardo Alamino ricalamino

♦️
Piece of peace
View GitHub Profile
@ricalamino
ricalamino / kaprekar.js
Last active August 28, 2019 17:13 — forked from slawrence/kaprekar.js
kaprekar.js
var num = "174";
kaprekar(num);
function kaprekar(num){
s1 = parseInt(num.split("").sort().join(""));
s2 = parseInt(num.split("").sort(function(a,b){return b-a}).join(""));
n = (s1 > s2) ? s1 -s2 : s2 - s1;
(s1 > s2) ? console.log(s1 + " - " + s2 + " = " + n) : console.log(s2 + " - " + s1 + " = " + " = " + n);
if(n === parseInt(num)){
@ricalamino
ricalamino / fetch_kindle.js
Last active April 11, 2020 13:37 — forked from yangchenyun/fetch_kindle.js
Get back my books from Kindle
/*
* @fileoverview Program to free the content in kindle books as plain HTML.
*
* This is largely based on reverse engineering kindle cloud app
* (https://read.amazon.com) to read book data from webSQL.
*
* Access to kindle library is required to download this book.
*/
// The Kindle Compression Module copied from http://read.amazon.com application
@ricalamino
ricalamino / notion2blog.js
Created July 22, 2020 12:36 — forked from mayneyao/notion2blog.js
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@ricalamino
ricalamino / index.js
Created July 27, 2021 19:22
Convert Roam Research Daily Notes to YYYY_MM_DD.md and replace old references in files
// READ THIS BEFORE RUNNING!
// Run just ONCE in a Roam daily Notes folder with ONLY files such as: December 31st, 2016.md or April 1st, 2016.md
// Do not include any other files in the folder (source_path)!
//
// DISCLAIMER: I am not responsible for any loss of information or files. Use this at your own risk.
const fs = require('fs');
const replace = require("replace");
const source_path = './obsidian/journals'; // Source Daily Notes folder