Skip to content

Instantly share code, notes, and snippets.

@KoryNunn
KoryNunn / handshake-airdrop.md
Last active Apr 3, 2022
Handshake airdrop for github users.
View handshake-airdrop.md

Had 15 github followers in 2019? You can get about $4kAUD of crypto for minimal effort.

Explain this scam

That's legitimately a good default position to hold, however, in this case, the free money is a function of time, and not only charity.

In February 2020, in order to promote Handshake (HNS) to developers, an airdrop was offered to any Github user with more than 15 followers. The Airdrop would give you 4246HNS, at the time worth around at $0.08USD per coin, for a total of $339.68USD, pretty generous!

Today, 4246HNS is worth around $4000 dollarydoos, and there are plenty of github users who haven't claimed theirs.

@hallettj
hallettj / Makefile
Last active Oct 28, 2021
Makefile for transpiling with Babel & Flow in a Node app, or in a client- or server-side shared library
View Makefile
# Makefile for transpiling with Babel in a Node app, or in a client- or
# server-side shared library.
.PHONY: all clean
# Install `babel-cli` in a project to get the transpiler.
babel := node_modules/.bin/babel
# Identify modules to be transpiled by recursively searching the `src/`
# directory.
@phlipper
phlipper / monosnap-s3-iam-policy.json
Created Oct 5, 2014
Monosnap Custom S3 Bucket - IAM Policy
View monosnap-s3-iam-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowGroupToSeeBucketListInTheConsole",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Effect": "Allow",
View bt_client.py
import socket
import struct
def ip2long(ip):
packedIP = socket.inet_aton(ip)
return struct.unpack("!I", packedIP)[0]
# Handshake
message = struct.pack('!qii', 0x41727101980, 0, 1)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
@mziwisky
mziwisky / Oauth2.md
Last active Feb 9, 2022
Oauth2 Explanation
View Oauth2.md

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.

@lrvick
lrvick / angular-socket.js
Created Oct 18, 2013
AngularJS service to connect to a websocket server (SockJS or pure WebSocket), manage reconnection, and allow the rest of the angular application to easily send/retrieve data from an open socket.
View angular-socket.js
//TODO: make this a module
/**
* # SockJS socket management service
*
* Creates SockJS socket connection to server, re-connects on disconnection,
* and exports hooks to map handlers for various data interactions.
*
*/
angular.module('app').factory
@grafov
grafov / gist:5712165
Created Jun 5, 2013
golang sample of json/rpc over websocket
View gist:5712165
package main
import (
"code.google.com/p/go.net/websocket"
//"github.com/garyburd/go-websocket/websocket"
//"github.com/zhangpeihao/gowebsocket"
"net/http"
"net/rpc"
"net/rpc/jsonrpc"
)
View sample-site.conf
upstream some_app_server {
server 127.0.0.1:9393;
}
server {
listen 80;
server_name my-upload-endpoint.com ;
View python_conversion.md

Python Number Conversion Chart

From To Expression
@kstep
kstep / ptml.py
Created Aug 29, 2012
Simple Python HTML template DSL (improved Python 3 version)
View ptml.py
#
# Python Template Markup Language
# Simple Python DSL for HTML and (a little) CSS templating.
#
# Example:
#
# from ptml import *
#
# with html5 as out:
# with head: