Skip to content

Instantly share code, notes, and snippets.

View skozin's full-sized avatar
🌊
Passing

Sam Kozin skozin

🌊
Passing
View GitHub Profile
@nicklockwood
nicklockwood / gist:21495c2015fd2dda56cf
Last active August 13, 2020 13:57
Thoughts on Swift 2 Errors

Thoughts on Swift 2 Errors

When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.

So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.

Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?

I'm going to cover three things in this post:

/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
@libitte
libitte / gist:cbde168d26bc5faf9bf9fef648091b42
Last active October 23, 2024 17:09
FIX warning: ignoring broken ref refs/remotes/origin/HEAD

warning: ignoring broken ref refs/remotes/origin/HEAD


➜   ✗ g symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/develop
➜   ✗ g fetch --prune
➜   ✗ g gc

@andywer
andywer / talk-proposal.md
Last active December 23, 2020 17:22
Reactive Conf 2017 ⚡️ Talk Proposal - Memory Leak Hunt 2017 Style

This is a proposal for lightning talk at Reactive Conf. Please 🌟 this gist to push the proposal!

Memory Leak Testing in 2017

Hi, I am Andy, creator of leakage - the node-powered memory leak testing library.

Instead of manual debugging it provides a structured approach to fix or even prevent memory leaks.

@guillaumef
guillaumef / aes256-compat-openssl-enc-dec.py
Last active April 11, 2023 03:19
Python - AES 256 crypt/decrypt compatible with 'openssl enc' format
#!python
"""OpenSSL enc compatible script by Python.
"""
""" Based on:
https://gist.github.com/chrono-meter/d122cbefc6f6248a0af554995f072460
Added: base64
Need: python3-crypto
# Encrypt
python3 ./aes256-compat-openssl-enc-dec.py -in <filein> -e -salt -aes-256-cbc