Skip to content

Instantly share code, notes, and snippets.

@xbee
xbee / dynamic-data-table-google-material-mdl.markdown
Created February 10, 2021 12:11
Dynamic Data Table Google Material #mdl

Dynamic Data Table Google Material #mdl

Add or remove data table rows dynamically in html view.

A Pen by DHCS on CodePen.

License.

@xbee
xbee / c99.l
Created January 26, 2020 15:00 — forked from codebrainz/c99.l
C99 Lex/Flex & YACC/Bison Grammars
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E ([Ee][+-]?{D}+)
P ([Pp][+-]?{D}+)
FS (f|F|l|L)
IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U))
%{
#include <stdio.h>
@xbee
xbee / single.swift
Created August 3, 2019 04:50
Swift 3 single instance process #swift
func applicationDidFinishLaunching(aNotification: NSNotification) {
/* Check if another instance of this app is running. */
let bundleID = Bundle.main.bundleIdentifier!
if NSRunningApplication.runningApplications(withBundleIdentifier: bundleID).count > 1 {
/* Show alert. */
let alert = NSAlert()
alert.addButton(withTitle: "OK")
let appName = Bundle.main.object(forInfoDictionaryKey: kCFBundleNameKey as String) as! String
alert.messageText = "Another copy of \(appName) is already running."
alert.informativeText = "This copy will now quit."
@xbee
xbee / single.rs
Created August 3, 2019 04:47
Rust single instance process #rust #single instance
use std::net::TcpListener;
fn create_app_lock(port: u16) -> TcpListener {
match TcpListener::bind(("0.0.0.0", port)) {
Ok(socket) => {
socket
},
Err(_) => {
panic!("Couldn't lock port {}: another instance already running?", port);
}
@xbee
xbee / circle.tex
Created July 25, 2019 06:12
A complicated network circle #latex #tikz
% A complete graph
% Author: Quintin Jean-Noël
% <http://moais.imag.fr/membres/jean-noel.quintin/>
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary[topaths]
% A counter, since TikZ is not clever enough (yet) to handle
% arbitrary angle systems.
\newcount\mycount
\begin{document}
@xbee
xbee / spiderweb.tex
Last active July 17, 2019 10:45
SpiderWeb diagram with latex #latex #spiderweb #tex
% Spiderweb Diagram
%
% Author: Dominik Renzel
% Date; 2009-11-11
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
@xbee
xbee / defer.rs
Last active July 7, 2019 15:25
Golang like defer in Rust #rust #defer
// from: https://stackoverflow.com/questions/29963449/golang-like-defer-in-rust
//
struct ScopeCall<F: FnOnce()> {
c: Option<F>
}
impl<F: FnOnce()> Drop for ScopeCall<F> {
fn drop(&mut self) {
self.c.take().unwrap()()
}
}
@xbee
xbee / whitepapers.tsv
Last active July 7, 2019 13:54 — forked from blockchainvc/whitepapers.tsv
WHITEPAPERS: Smart Contract Protocols #blockchain #smartcontract
Name Link Whitepaper title
Achain (previously thinkyoung) https://www.achain.com/Achain%20Whitepaper%202.0_EN.pdf Achain Blockchain Whitepaper: build to be boundless
Aergo (by blocko) https://www.aergo.io/paper/ multiple
Aion https://aion.network/media/en-aion-network-technical-introduction.pdf Aion: enabling the decentralized Internet
Ark https://ark.io/Whitepaper.pdf A Platform for Consumer Adoption
Avalanche https://ipfs.io/ipfs/QmUy4jh5mGNZvLkjies1RWM4YuvJh5o2FYopNPVYwrRVGV Snowflake to Avalanche: a novel metastable consensus protocol family for cryptocurrencies
Blink https://blink.network/media/blink-protocol.pdf Proof-of-stake distrbuted consensus protocol
Byteball https://byteball.org/Byteball.pdf A Decentralized System for Storage and Transfer of Value
Cardano https://whitepaperdatabase.com/cardano-ada-whitepaper/ Ouroboros: A provably secure proof-of-stake blockchain protocol
Celer Network https://www.celer.network/doc/CelerNetwork-Whitepaper.pdf Celer Network: Bring Internet Scale to Every Blockchai
@xbee
xbee / gist:a4db8404f3fbba7f0b3fa5ce34ff04d1
Last active March 8, 2020 15:43 — forked from matthieu/gist:b07c5ba27bc99188a15f
Create and send a Bitcoin transaction using the BlockCypher Transaction API #bitcoin #shell
# In this example we're sending some test bitcoins from an address we control to a brand new test
# address. We'll be sending the coins using the following address, public and private keys (please
# don't abuse).
# address : mtWg6ccLiZWw2Et7E5UqmHsYgrAi5wqiov
# public : 03bb318b00de944086fad67ab78a832eb1bf26916053ecd3b14a3f48f9fbe0821f
# private : 1af97b1f428ac89b7d35323ea7a68aba8cad178a04eddbbf591f65671bae48a2
# 1. generate a one-shot dummy address we're going to send money to
$ curl -X POST http://api.blockcypher.com/v1/btc/test3/addrs
{
@xbee
xbee / keybase.md
Created October 8, 2017 13:12
Keybase proof

Keybase proof

I hereby claim:

  • I am xbee on github.
  • I am hfeeki (https://keybase.io/hfeeki) on keybase.
  • I have a public key ASBDrB24S_bT5duyk7y5e2GGKVl6AGjV6tf1bMATawyg2Ao

To claim this, I am signing this object: