Skip to content

Instantly share code, notes, and snippets.

@truth3
truth3 / ETH 2.0 RPi Setup Notes
Created October 14, 2021 02:09
Setup notes for RPi based ETH 2.0 validator, beacon chain, and ETH 1 node.
Shopping List
1) USB 3.0 to SATA cable or equivalent 2.5 case with no on / off switch
- https://www.amazon.com/gp/product/B00HJZJI84/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1
2) RPi Power Supply
- https://www.amazon.com/gp/product/B07TYQRXTK/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1
3) Class 10 MicroSD (64GB)
- https://www.amazon.com/gp/product/B07FCMBLV6/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1
4) 1 TB SSD internal 2.5 inch drive
- https://www.amazon.com/gp/product/B08QBJ2YMG/ref=ppx_od_dt_b_asin_title_s00?ie=UTF8&psc=1
5) RPi Case with Fan
<?php
$inFile = "encrypted.xml";
$outFile = "decrypted.xml";
$privateKeyFile = "private_key.pem";
$header = '<?xml version="1.0" encoding="UTF-8"?>';
//-----------------------------------------------
function rsaDecryptWithKeyString($encryptedData, $rsaPrivKey){
@truth3
truth3 / crypto-prices.js
Created July 8, 2019 23:44
The modified code which is tuned to request data from your own server instead of coin market cap directly
function get_curr_coinmarketcap_price(crypto_id, unused_param) {
// note that the unused_param is to to force the function to rerun
// and recalcuate the functions results when the function is called with
// new input
// https://stackoverflow.com/questions/17341399/refresh-data-retrieved-by-a-custom-function-in-google-spreadsheet
// create a string that is the first part of our API calls url
var url1 = 'https://yourserver.com/crypto-prices.php?crypto_id=';
@truth3
truth3 / crypto-prices.php
Created July 8, 2019 23:42
Used to fetch the latest crypto prices from Coin Market cap and avoid the rate limiting issues when requesting from Google
<?php
$cryptoID = $_GET["crypto_id"];
$requestUrl ='https://api.coinmarketcap.com/v1/ticker/' . $cryptoID . '/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $requestUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
@truth3
truth3 / SlackOpportunityPublisherTest.cls
Created June 4, 2018 00:48
Test case that goes with the slack publisher code
@isTest
private class SlackOpportunityPublisherTest {
static testMethod void testPostToSlack() {
SlackOpportunityPublisher.Oppty opt = new SlackOpportunityPublisher.Oppty();
opt.opptyOwnerName = 'Test';
opt.acctName = 'Test';
opt.acctIndustry = 'Test';
opt.opptyItems = 'https://www.zerionsoftware.com';
@truth3
truth3 / SlackOpportunityPublisher.cls
Created June 4, 2018 00:45
Publishing financial data to Slack from Salesforce
public with sharing class SlackOpportunityPublisher {
// Production business channel
// private static final String slackURL = 'https://hooks.slack.com/services/######';
// Private channel for testing
// private static final String slackURL = 'https://hooks.slack.com/services/#####';
public class Oppty {
@truth3
truth3 / private_key.pem
Created October 25, 2017 12:15
Digital Signature Validation
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA0cCM/xT5c6Czor3573pXlPEFbEzk4rm/iq15eWntOWMl3Bkb
dZY9Zbm8TOjh0YrHFH4ZrQmREXyxVQxZNQ7zwITmwyrMyb1/ravbSpuj9HIpY4hn
5sregUJZUtWTSvtlXSSKa60bva5qG8MHi+hK7qWayJwfriDung+T9jss6k8ANmin
2BPjpjTlMbbJbRyr+27XYov3nD9U1KYeBnGgyj8aplb/1e75Iuk7oCwVm+kTsPKI
/ZeATf/kfS93tQrw0/gozP4iVubyKBVG05BzerFcb3QUzLSo3LIJ/8VYuGHnz6y+
J6xy02EOhzJMPLUt3GQo7yUDOPls/W2tCBUebwIDAQABAoIBADmS9eDKnBI+CTDh
nqo6VbH/WnK4xJbrT4U8Sryl88Stz2WTyrLDE4VJr0MZJWsEAdNBLcEOgDBhnrdu
lUn4GbY9hK4LoHy7tEEyjBX1lNJzR6MXfRWfl+W5FZWkJDMPwGoJrqkRsiylpGCM
bxTbJT5OXKc2G4gLaBQgyIdtBM4nc7F/TraswmuU940NsVSKBIpeqsgh4jeV6p8T
@truth3
truth3 / iForm-Page-JavaScript-Location.js
Last active August 1, 2016 17:02
PREFILL ADDRESS OR STREET USING GOOGLE API
function getStreetNumber(lat, lng) {
var json = getRGeocodeJSON(lat, lng);
var obj = JSON.parse(json);
try { return obj.results[0].address_components[0].short_name; }
catch(e) { return ''; }
}
function getStreetName(lat, lng) {
var json = getRGeocodeJSON(lat, lng);
@truth3
truth3 / iFormBuilder-API-AccessToken(Python).py
Created June 16, 2016 18:05
CREATE JWT AND ACCESS TOKEN USING PYTHON LIBRARY'S
import jwt, base64, os, uuid, sys, urllib, urllib2, json, collections, traceback, time, datetime
from datetime import timedelta
#############################################################################
get an jwt then make call to get access token ##
#############################################################################
def GetAccessToken(iFormUrl, iFormClientKey, iFormClientSecret):
expTime = datetime.datetime.utcnow() + datetime.timedelta(seconds=600)
nowTime = datetime.datetime.utcnow()
payload = {"iss": iFormClientKey,
@truth3
truth3 / iForm-PageJavascript-Weather.js
Last active September 15, 2021 16:04
GET CURRENT WEATHER FOR USER LOCATION
function getCurrentWeather(lat, lng) {
var json = getCurrentConditions(lat, lng);
var obj = JSON.parse(json);
var currentWeather = obj.currentobservation.Weather;
var tempF = obj.currentobservation.Temp;
var currentWindSpeed = obj.currentobservation.Winds;
var currentWindDirection = obj.currentobservation.Windd;
var currentWindGust = obj.currentobservation.Gust;
var currentHumidity = obj.currentobservation.Relh;