Skip to content

Instantly share code, notes, and snippets.

View lildata's full-sized avatar

Programming is fun lildata

View GitHub Profile
@miguelmota
miguelmota / README.md
Last active January 21, 2025 09:10
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
@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
@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;
@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 {
// 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:
@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)
@maciejmatu
maciejmatu / add-page-visit.js
Created May 3, 2018 21:24
Lambda function that connects to mongo database and increments a number
const { MongoClient } = require('mongodb');
const DB_URL = process.env.DB_URL || 'mongodb://localhost:27017';
const DB_NAME = 'serverless-smoothielicious';
function errorResponse(callback, err) {
console.error(err);
callback(null, {
statusCode: 500,
@nakajo2011
nakajo2011 / index.html
Last active May 11, 2018 17:48
uPort Simple Application
<!doctype html>
<html>
<head>
<title>uPort Sample App</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script>
<script src="https://unpkg.com/uport-connect/dist/uport-connect.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
main { padding: 10px 30px; }
@exupero
exupero / clipboard.clj
Created September 22, 2017 18:32
Clojure code to interact with the system clipboard
(refer-clojure :exclude '[slurp spit])
(import '[java.awt.datatransfer DataFlavor StringSelection Transferable])
(defn clipboard []
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)))
(defn slurp []
(try
(.getTransferData (.getContents (clipboard) nil) (DataFlavor/stringFlavor))
(catch java.lang.NullPointerException e nil)))