Skip to content

Instantly share code, notes, and snippets.

@sheldonth
sheldonth / isValidSfId.js
Created January 19, 2023 15:55 — forked from step307/isValidSfId.js
Javascript check salesforce id validity
function isValidSfId(str) {
// https://stackoverflow.com/a/29299786/1333724
if (typeof str !== 'string' || str.length !== 18) {
return false;
}
let upperCaseToBit = (char) => char.match(/[A-Z]/) ? '1' : '0';
let binaryToSymbol = (digit) => digit <= 25 ? String.fromCharCode(digit + 65) : String.fromCharCode(digit - 26 + 48);
let parts = [
@sheldonth
sheldonth / nvm_sudo.sh
Created February 25, 2019 02:28
get nvm to work for sudo
n=$(which node); \
n=${n%/bin/node}; \
chmod -R 755 $n/bin/*; \
sudo cp -r $n/{bin,lib,share} /usr/local
// Never rewrite this stupid block again
// const result = await promise_cmd("hostname")
// result = [int code, Buffer stdout, Buffer stderr]
const {spawn} = require('child_process')
const promise_cmd = (cmd) => {
const job = spawn(cmd)
let stdout = Buffer.from([])
let stderr = Buffer.from([])
cd /Library/Preferences
sudo rm com.sophos.sav.plist

cd /Library/Application\ Support/Sophos/cloud/Installer.app/Contents/MacOS/tools/
sudo ./InstallationDeployer —force_remove
2017-03-15 23:17:25 Bitcoin version v0.14.0
2017-03-15 23:17:25 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2017-03-15 23:17:25 Assuming ancestors of block 00000000000000000013176bf8d7dfeab4e1db31dc93bc311b436e82ab226b90 have valid signatures.
2017-03-15 23:17:26 Default data directory /Users/sheldonthomas/Library/Application Support/Bitcoin
2017-03-15 23:17:26 Using data directory /Volumes/External/btc/Bitcoin
2017-03-15 23:17:26 Using config file /Volumes/External/btc/Bitcoin/bitcoin.conf
2017-03-15 23:17:26 Using at most 125 automatic connections (2560 file descriptors available)
2017-03-15 23:17:26 Using 32 MiB out of 32 requested for signature cache, able to store 1048576 elements
2017-03-15 23:17:26 Using 4 threads for script verification
2017-03-15 23:17:26 Using BerkeleyDB version Berkeley DB 4.8.30: (April 9, 2010)
pjson = require '../../package.json'
blessed = require 'blessed'
moment = require 'moment'
contrib = require 'blessed-contrib'
{Logger} = require '../logger'
logger = new Logger()
path = require 'path'
font_path = path.join process.cwd(), 'fonts/gohufont-11.json'
bold_font_path = path.join process.cwd(), 'fonts/gohufont-11b.json'
@sheldonth
sheldonth / gist:a8346b1ca31ffee82f7a
Last active October 16, 2015 17:49
Building dynamic link libraries in OSX
{
"targets": [
{
"target_name": "NodeActiveTickAddon",
"sources": [ "NodeActiveTickAddon.cpp",
"NodeActiveTick.cpp",
"Requestor.cpp",
"import/atfeed-cppsdk/example/Helper.cpp",
"AtEnumConverter.cpp",
"protobuf/messages.pb.cc"
### Keybase proof
I hereby claim:
* I am sheldonth on github.
* I am sheldonth (https://keybase.io/sheldonth) on keybase.
* I have a public key whose fingerprint is 07CD 0766 CFE6 05BE D9DD 0902 C117 9A44 7F4E 7B46
To claim this, I am signing this object: