Skip to content

Instantly share code, notes, and snippets.

View lildata's full-sized avatar

Programming is fun lildata

View GitHub Profile
@th3m477
th3m477 / emojihash.swift
Created September 13, 2018 16:22
Emoji hash example in Swift
func emojiHash(_ input: String) -> String {
// HashEmoji.txt is a line separated file of 256 emojis (1 per byte)
// https://gist.github.com/th3m477/c0b306fd7992459f366e1a49fe0520d2
guard let path = Bundle.main.path(forResource: "HashEmoji", ofType: "txt"),
let emojiData = try? String(contentsOfFile: path, encoding: .utf8)
else {
preconditionFailure("HashEmoji resource not available")
}
let emojis = emojiData.components(separatedBy: .newlines)
// both web3 and your contract have be defined
if(web3js && contract)
{
const yourEvent = contract.YourEventName();
yourEvent.watch(function(error, result) {
if (!error) {
// Callback return
// Object - An event object as follows:
@RichardMarks
RichardMarks / Toast.css
Last active July 10, 2022 14:39
React Hooks Toast Example
.toasts-container {
position: fixed;
z-index: 65535;
right: 0;
max-width: 250px;
display: flex;
flex-direction: column-reverse;
}
.toasts-container > .toast-container {
@ericelliott
ericelliott / use-fortmatic.js
Created January 17, 2020 01:30
A React hook for Fortmatic integration.
import { useState, useEffect, useRef } from 'react';
import Web3 from 'web3';
import Fortmatic from 'fortmatic';
const usePromise = () => {
const ref = [];
const container = useRef(ref);
ref[0] = new Promise((resolve, reject) => {
ref[1] = resolve;
@theKAKAN
theKAKAN / notify-mqtt.sh
Last active January 21, 2025 15:30
Checks for MQTT subbed-topic in Termux or linux and sends push notifications on receiving a message
#!/usr/bin/env bash
IP="10.0.0.1" #Change to IP of server
TOPIC="torrent/finished" # Change to your liking
VERSION="mqttv5"
if [ -n "$(command -v mosquitto_sub)" ]; then
echo "Found mosquitto"
if [ "$( uname )" == "Linux" ]; then
if [ -n "$( command -v termux-notification )" ]; then
echo "Running in termux"
mosquitto_sub -h "$IP" -V "$VERSION" -t "$TOPIC" | while read OUTPUT; do termux-notification -c "$OUTPUT"; done
@miguelmota
miguelmota / README.md
Last active August 17, 2025 22:59
Web-based terminal sharing programs

Comparison of web-based terminal sharing programs

In no particular order:

web app TLS support basic authentication support self-host storage multiple process support replay write from web 2-way read custom share urls webrtc support requires SSH client open source server open source language stars
gotty go 14k
ttyd C 2.7k
wetty JS 2.5k
ttycast JS
@melMass
melMass / README.md
Last active July 28, 2025 18:04
Nushell syntax for bat