View rename_phoenix_project.sh
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 | |
set -e | |
CURRENT_NAME="PhoenixStarter" | |
CURRENT_OTP="phoenix_starter" | |
NEW_NAME="NewName" | |
NEW_OTP="new_name" |
View token_cache.ex
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
# https://rajrajhans.com/2023/02/refreshing-tokens-before-expiry-in-elixir/ | |
defmodule MyApplication.TokenCache do | |
use GenServer | |
alias MyApplication.RandomApi | |
@refresh_lead_time_ms :timer.minutes(5) | |
@token_key :random_api | |
require Logger |
View cloudflare_ddns.sh
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 | |
# run this script as a CRON job! | |
# get the current public ip address | |
printf "\n" | |
logger -s "Getting the current public IP address..." | |
current_ip=`curl -s ipinfo.io/ip` | |
update_dns_record(){ |
View framesTimecodeConverter.js
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
const FRAME_RATE = 24; | |
const framesToTimecode = (timeInFrames) => { | |
const numOfFramesPerMin = FRAME_RATE * 60; | |
const hours = Math.floor(timeInFrames / (numOfFramesPerMin * 60)); | |
const minutes = Math.floor(timeInFrames / numOfFramesPerMin) % 60; | |
const seconds = Math.floor((timeInFrames % numOfFramesPerMin) / FRAME_RATE); | |
const frames = Math.floor((timeInFrames % numOfFramesPerMin) % FRAME_RATE); | |
const timecode = { |
View contactForm.js
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
//Blog Post: https://rajrajhans.com/2020/07/using-netlify-lambda-functions-and-sendgrid-to-send-mail/ | |
import React, { Component } from "react" | |
class ContactForm extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
name:'', | |
email:'', |