Skip to content

Instantly share code, notes, and snippets.

@zbroyar
zbroyar / sign_message.ml
Created March 8, 2011 21:11
Sign a message with OCaml Cryptokit sha256 & RSA
let (>>) x f = f x ;;
let hash = hash_string (Hash.sha256()) ;;
let sign_of_message key msg =
msg >> hash >>
(pkcs1v1pad key) >>
(RSA.sign key) >>
strrev
;;
@owainlewis
owainlewis / binaryTree.ml
Created October 3, 2012 20:11
OCaml Trees
(* Unbalanced Binary Tree *)
type 'a tree =
Node of 'a * 'a tree * 'a tree
| Leaf;;
(* e.g Node (5, Leaf, Leaf) *)
(* val insert : ’a -> ’a btree -> ’a btree = <fun> *)
let insert x s = Node (x, Leaf, s);;
@sporsh
sporsh / rpcserver.py
Created October 23, 2012 19:49
A Twisted example to demo deferreds, client/server protocols and endpoints
import time
from twisted.python import failure
from twisted.internet import reactor, defer, task
from twisted.internet.protocol import Protocol
# Define some messages for our protocol
MSG_REQUEST = '>'
MSG_REQ_ACK = ':'
MSG_REQ_SUCCEEDED = '='
@patrickleet
patrickleet / gist:6312627
Created August 22, 2013 20:51
meteor.js cheatsheet
// Assuming the following directory structure
/*
app/
.meteor/
client/
server/
collections/
*/
// 1. Create a collection
@DavidVaini
DavidVaini / round.go
Created April 9, 2014 19:58
Arggh Golang does not include a round function in the standard math package. So I wrote a quick one.
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@koistya
koistya / React-Directory-Layout.md
Last active April 7, 2024 19:01
File and folder naming convention for React.js components

File and folder naming convention for React.js components

Directory Layout #1

/actions/...
/components/common/Link.js
/components/common/...
/components/forms/TextBox.js
/components/forms/TextBox.res/style.css
@denji
denji / golang-tls.md
Last active March 29, 2024 03:03 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@royshouvik
royshouvik / remoteDebugging.md
Last active January 5, 2024 07:32
Describes how to setup remote debugging on an Android device using Chrome

Remote Debugging on Android with Chrome

The way your web content behaves on mobile can be dramatically different from the desktop experience. Remote debugging with Chrome DevTools lets you debug live content on your Android device from your development machine.

Debugging Chrome for Android using the Chrome Developer Tools

Remote debugging on Android supports:

  • Debugging websites in browser tabs.
  • Debugging WebViews in native Android apps.
@bajcmartinez
bajcmartinez / erc20-token-sample.sol
Last active October 13, 2023 22:58
Necessary code to generate an ERC20 Token
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Sample token contract
//
// Symbol : LCST
// Name : LCS Token
// Total supply : 100000
// Decimals : 2
// Owner Account : 0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe