Skip to content

Instantly share code, notes, and snippets.

@bketelsen
bketelsen / main.go
Created November 11, 2018 20:26
microbit cylon
package main
import (
"machine"
"time"
)
func main() {
machine.InitLEDMatrix()
@baruch
baruch / defer.h
Created May 27, 2018 19:09
Defer cleanup for C (gcc and llvm)
#define DEFER_MERGE(a,b) a##b
#define DEFER_VARNAME(a) DEFER_MERGE(defer_scopevar_, a)
#define DEFER_FUNCNAME(a) DEFER_MERGE(defer_scopefunc_, a)
#define DEFER(BLOCK) void DEFER_FUNCNAME(__LINE__)(int *a) BLOCK; __attribute__((cleanup(DEFER_FUNCNAME(__LINE__)))) int DEFER_VARNAME(__LINE__)
// Usage:
/*
void dosomething()
{
char* data = malloc(100);
@mattn
mattn / bolt.go
Last active March 30, 2019 18:05
benchmark with bolt, goleveldb, pogreb for writing
package main
import (
"fmt"
"log"
"github.com/boltdb/bolt"
)
func main() {
@ken39arg
ken39arg / copyandlink.sh
Last active December 1, 2017 11:16
ISUCON7 MSAの最終コードと自分用メモ
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active May 6, 2025 19:29
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@hyuki0000
hyuki0000 / a.rb
Last active February 27, 2017 09:27
Produce 2 files that have the same SHA-1 hash value. (based on shattered.io)
# based on shattered.io
open("1.dat", "w") do |f|
f.print "\x25\x50\x44\x46\x2d\x31\x2e\x33\x0a\x25\xe2\xe3\xcf\xd3\x0a\x0a\x0a\x31\x20\x30\x20\x6f\x62\x6a\x0a\x3c\x3c\x2f\x57\x69\x64\x74\x68\x20\x32\x20\x30\x20\x52\x2f\x48\x65\x69\x67\x68\x74\x20\x33\x20\x30\x20\x52\x2f\x54\x79\x70\x65\x20\x34\x20\x30\x20\x52\x2f\x53\x75\x62\x74\x79\x70\x65\x20\x35\x20\x30\x20\x52\x2f\x46\x69\x6c\x74\x65\x72\x20\x36\x20\x30\x20\x52\x2f\x43\x6f\x6c\x6f\x72\x53\x70\x61\x63\x65\x20\x37\x20\x30\x20\x52\x2f\x4c\x65\x6e\x67\x74\x68\x20\x38\x20\x30\x20\x52\x2f\x42\x69\x74\x73\x50\x65\x72\x43\x6f\x6d\x70\x6f\x6e\x65\x6e\x74\x20\x38\x3e\x3e\x0a\x73\x74\x72\x65\x61\x6d\x0a\xff\xd8\xff\xfe\x00\x24\x53\x48\x41\x2d\x31\x20\x69\x73\x20\x64\x65\x61\x64\x21\x21\x21\x21\x21\x85\x2f\xec\x09\x23\x39\x75\x9c\x39\xb1\xa1\xc6\x3c\x4c\x97\xe1\xff\xfe\x01\x73\x46\xdc\x91\x66\xb6\x7e\x11\x8f\x02\x9a\xb6\x21\xb2\x56\x0f\xf9\xca\x67\xcc\xa8\xc7\xf8\x5b\xa8\x4c\x79\x03\x0c\x2b\x3d\xe2\x18\xf8\x6d\xb3\xa9\x09\x01\xd5\xdf\x45\xc1\x4f\x26\xfe\xdf\xb3\xd
@saulshanabrook
saulshanabrook / README.md
Created October 19, 2016 14:20
Saving Web Crypto Keys using indexedDB

This is a working example on how to store CryptoKeys locally in your browser. We are able to save the objects, without serializing them. This means we can keep them not exportable (which might be more secure?? not sure what attack vectors this prevents).

To try out this example, first make sure you are in a browser that has support for async...await and indexedDB (latest chrome canary with chrome://flags "Enable Experimental Javascript" works). Load some page and copy and paste this code into the console. Then call encryptDataSaveKey(). This will create a private/public key pair and encrypted some random data with the private key. Then save both of them. Now reload the page, copy in the code, and run loadKeyDecryptData(). It will load the keys and encrypted data and decrypt it. You should see the same data logged both times.

@bastman
bastman / aws-cli-cognito-get-open-id-token-for-developer-identity.md
Last active May 2, 2021 15:43
aws cognito examples (bash / php): custom auth provider

Aws Cognito: Custom Auth (Developer Authenticated Identities)

How to get OpenID Token & IdentityId from AWS Cognito?

  • example: using bash (aws cli sdk)
  • example: using php (aws php sdk v3.*)

note

  • you need to add example.com as custom auth provider in aws console (cognito/federated)
@nobonobo
nobonobo / makecert.sh
Last active September 29, 2016 07:30
1行でオレオレ証明書を作る
go run $(go env GOROOT)/src/crypto/tls/generate_cert.go --host localhost