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 / 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
@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 / 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 / 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 / megasena.py
Created May 29, 2019 15:10 — forked from berlotto/megasena.py
Numeros da MegaSena
# -*- encoding: utf-8 -*-
#
# Python Script - Numeros da Megasena
# Faz o download do arquivo da Caixa Economica Federal, com todos os resultados
# da Mega já obtidos. Faz uma contagem simples e mostras, em ordem decrescente,
# a quantidade de vezes que os nros já foram sorteados.
#
# Author: Sergio Berlotto <sergio.berlotto@gmail.com>
# Author website: http://berlotto.github.io
# Licence: GPLv3
@ricalamino
ricalamino / .htaccess
Last active May 15, 2019 12:51 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
// Portguese(pt) localization of ps.waltheri.net
// Localized name: Portuguese
{
// Top navigation
nav: {
pattern_search: "Busca por padrões",
database: "Navegar no banco de dados",
about: "Sobre",
facebook: "Página do Facebook"
@ricalamino
ricalamino / auth.component.html
Created October 16, 2018 13:59
Auth0 Auth custom
<input class="sign-up__form-input" type="email" name="email" id="email" placeholder="{{ 'Email' }}"
[(ngModel)]="email" (keyup.enter)="keytab($event)">
<input class="sign-up__form-input" type="password" name="password" id="password" placeholder="{{ 'Password' }}"
[(ngModel)]="password" (keyup.enter)="keytab($event)">
<button >{{ 'ForgotPassword' }}?</button>
<button id="login_submit" class=""
(click)="loginNoLock(email, password)">
{{ 'SignInLogin' }}
</button>
@ricalamino
ricalamino / AjaxContactForm.md
Last active October 5, 2018 18:09 — forked from patotoma/AjaxContactForm.md
Simple Asynchronous Contact Form with jQuery and PHP

Simple Ajax Contact Form with jQuery and PHP

Files:

  • index.html
  • style.css
  • js.js
  • mailer.php

Use:

@ricalamino
ricalamino / signUpNoLock.js
Created October 4, 2018 21:19
Sign Up Without Lock - Auth0
public signUpNoLock(username: string, password: string, name: string) {
const postData = {
client_id: environment.Auth0.clientID,
email: username,
password,
connection: 'Username-Password-Authentication',
user_metadata: { name }
};
const req = this.http.post('https://' + environment.Auth0.domain + '/dbconnections/signup', postData, {