Skip to content

Instantly share code, notes, and snippets.

View anataliocs's full-sized avatar
🎓
Completed Polkadot Blockchain Academy Cohort 7 Bali

Chris Anatalio anataliocs

🎓
Completed Polkadot Blockchain Academy Cohort 7 Bali
View GitHub Profile
@anataliocs
anataliocs / shut-down-process.sh
Last active December 4, 2025 06:11
Search for and kill processes running on a certain port with a specific command name
#!/bin/bash
set -e
port="9944"
printf "\nSearches for processes running on port %s and performs a kill 9 on each pid" "$port"
printf "\n------------------------- \n"
printf "\nPrinting output from command: lsof -i :%s \n" "$port"
lsof -i :$port
@anataliocs
anataliocs / start-docusaurus.sh
Last active December 3, 2025 14:32
Start docusaurus and export logs to file
#!/bin/bash
set -e
touch docs.log
chmod 775 docs.log
nohup yarn start --port 3000 > docs.log 2>&1 & echo $! > run.pid
echo "Docusaurus running on process: $(cat run.pid)"
echo "Docusaurus running on port 3000"
echo ""
@anataliocs
anataliocs / quote-json-keys.js
Created November 24, 2025 17:52
When you console.log() a JSON config, the object keys may not be quoted. This script will take in a file and wrap all the object keys in double quotes
// Utility script: Wrap all unquoted parameter names (object keys) with double quotes
// Usage: quote-json-keys.js
const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, 'config.json');
let text = fs.readFileSync(filePath, 'utf8');
@franciscoaguirre
franciscoaguirre / generate-xcm.ts
Last active September 9, 2025 00:19
Interacting with the XCM precompile with Hardhat
import {
passetHub,
XcmV3MultiassetFungibility,
XcmV3WeightLimit,
XcmV5AssetFilter,
XcmV5Instruction,
XcmV5Junction,
XcmV5Junctions,
XcmV5WildAsset,
XcmVersionedXcm,
@anataliocs
anataliocs / git.md
Last active May 14, 2025 06:28
Stellar Toronto Builder Summit—EasyA Consensus Hackathon 2025 Helpful Scripts

Reset Repo and Re-choose front-end framework

Reset vanillajs and

git add . && git stash && rm -rf node_modules && rm -rf snapchain-vanillajs/target

Reset astro

@ChristopherA
ChristopherA / Mermaid_on_Github_Examples.md
Last active December 3, 2025 13:11
Mermaid on Github Examples

Mermaid on Github Examples

All of these diagrams are dynamically rendered during html display by Github, the images generated from text inside the Github-Flavored Markdown. None are static images. Mermaid support was released for Github on 2022-02-14

Pros & Cons:

  • Pro: You don't need to care about the layout.
  • Con: You cannot control the layout.

Notes:

  • Not all the features of Mermaid (in particular symbols B-->C[fa:fa-ban forbidden], hyperlink and tooltips) are supported by Github.
@eneko
eneko / list-of-curl-options.txt
Last active November 28, 2025 16:04
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@hediet
hediet / main.md
Last active December 1, 2025 20:53
Proof that TypeScript's Type System is Turing Complete
type StringBool = "true"|"false";


interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };

type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];
@zircote
zircote / run_dynamodb_local.sh
Created February 8, 2015 02:06
A quick run script to get a AWS DynamoDB Local instance going
#!/bin/sh
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
RUN_DIR=${DIR}/.dynamodb
DYNAMODB_LOCAL="http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz"
PORT=8000
ARGS="-inMemory -port ${PORT}"
install_dynamo_db(){
mkdir -p $1
curl -L $2 | tar xvz -C $1
@mattpodwysocki
mattpodwysocki / eventsource.js
Last active May 7, 2025 11:05
Adding support for server-sent events for RxJS
if (!!root.EventSource) {
/**
* This method wraps an EventSource as an observable sequence.
* @param {String} url The url of the server-side script.
* @param {Observer} [openObserver] An optional observer for the 'open' event for the server side event.
* @returns {Observable} An observable sequence which represents the data from a server-side event.
*/
dom.fromEventSource = function (url, openObserver) {
return new AnonymousObservable(function (observer) {