Skip to content

Instantly share code, notes, and snippets.

View raid5's full-sized avatar

Adam McDonald raid5

View GitHub Profile
@rishipr
rishipr / wonderland_time_machine.py
Last active November 23, 2022 13:11
Rebase Awards Tracker for Wonderland $TIME Staking (MEMO) 🧙‍♂️
'''
🐸 : Created by @0xRishi
🧙‍♂️ : Generates CSV of MEMO (staked TIME) balances every 8 hours since first MEMO transaction + overlays all non-rebase MEMO transactions
🕐 : Used to create wonderland-apy.vercel.app (historical implied APY chart)
(🎩, 🎩) : How to
1) Input your AVAX wallet address into `personal_avax_addr`, your Snowtrace API key into `snowtrace_key`, and your Moralis API key into `moralis_key`
2) Run with `python3`
🐇 : Sample output
@apalepu23
apalepu23 / bankruptcy_and_liquidation_px_calc.ipynb
Created October 1, 2020 15:42
Bankruptcy and Liquidation Price Calculator
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@brennanMKE
brennanMKE / RxExtensions.swift
Created May 25, 2018 17:46
Missing functionality from RxSwift
import RxSwift
extension PrimitiveSequence where Trait == CompletableTrait, Element == Never {
public func asMaybe() -> Maybe<Never> {
return Maybe.create { maybe in
return self.subscribe(
onCompleted: { maybe(.completed) },
onError: { error in maybe(.error(error)) })
}
@kakajika
kakajika / flatMapCompletable.swift
Created February 16, 2018 10:02
Single::flatMapCompletable in RxSwift
extension PrimitiveSequenceType where Self: ObservableConvertibleType, Self.TraitType == SingleTrait {
func flatMapCompletable(_ selector: @escaping (E) -> Completable) -> Completable {
return self
.asObservable()
.flatMap { e -> Observable<Never> in
selector(e).asObservable()
}
.asCompletable()
}
pragma solidity ^0.4.8;
contract Rubik {
enum Color {Red, Blue, Yellow, Green, White, Orange}
Color[9][6] state;
address public owner = msg.sender;
uint8 constant FRONT = 0;
@mbuchetics
mbuchetics / codeableEnum.swift
Created June 30, 2017 09:30 — forked from reckenrode/codeableEnum.swift
Implement Codable on an enum
struct User: Codable {
var name: String
var email: String
var id: String
var metadata: [String: MetadataType]
enum CodingKeys: String, CodingKey {
case name, email, id, metadata
}
}
@yeradis
yeradis / oclint-xcode-build-phases_run_script.sh
Created April 29, 2017 07:04
OCLint + XCPretty + XCode integration as and Aggregate target
source ~/.bash_profile
cd ${SRCROOT}
xcodebuild clean
xcodebuild | tee xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json
maxPriority=15000
oclint-json-compilation-database -- -report-type xcode -max-priority-1=$maxPriority -max-priority-2=$maxPriority -max-priority-3=$maxPriority
@sgr-ksmt
sgr-ksmt / ObservableType+compose.swift
Last active May 3, 2023 03:01
compose operator for RxSwift
struct ComposeTransformer<T, R> {
let transformer: (Observable<T>) -> Observable<R>
init(transformer: @escaping (Observable<T>) -> Observable<R>) {
self.transformer = transformer
}
func call(_ observable: Observable<T>) -> Observable<R> {
return transformer(observable)
}
}
@nestserau
nestserau / AtomicInteger.swift
Last active October 6, 2022 12:12
Atomic way to operate on integers in Swift. Inspired by Java's AtomicInteger
/// This is free and unencumbered software released into the public domain.
///
/// Anyone is free to copy, modify, publish, use, compile, sell, or
/// distribute this software, either in source code form or as a compiled
/// binary, for any purpose, commercial or non-commercial, and by any
/// means.
///
/// In jurisdictions that recognize copyright laws, the author or authors
/// of this software dedicate any and all copyright interest in the
/// software to the public domain. We make this dedication for the benefit
@gonzalezreal
gonzalezreal / A.LICENSE.md
Last active January 26, 2023 19:43
Using Realm with Value Types

Copyright 2017 Guillermo Gonzalez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE U