Skip to content

Instantly share code, notes, and snippets.

@KoryNunn
KoryNunn / handshake-airdrop.md
Last active March 12, 2024 07:03
Handshake airdrop for github users.

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 December 10, 2023 13:32
Makefile for transpiling with Babel & Flow in a Node app, or in a client- or server-side shared library
# 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 October 5, 2014 22:32
Monosnap Custom S3 Bucket - IAM Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowGroupToSeeBucketListInTheConsole",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Effect": "Allow",
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 February 15, 2024 23:31
Oauth2 Explanation

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 October 18, 2013 15:53
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.
//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 June 5, 2013 07:22
golang sample of json/rpc over websocket
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"
)
upstream some_app_server {
server 127.0.0.1:9393;
}
server {
listen 80;
server_name my-upload-endpoint.com ;
@Nurdok
Nurdok / python_conversion.md
Last active December 16, 2022 03:45
Python Conversion

Python Number Conversion Chart

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