Skip to content

Instantly share code, notes, and snippets.

View Tougee's full-sized avatar
🏠
Working from home

touge Tougee

🏠
Working from home
View GitHub Profile
@crazygit
crazygit / parseTransaction.go
Last active May 9, 2024 13:22
Parse Ethereum Transaction, Decode input data, Decode output data
package main
import (
"context"
"encoding/hex"
"fmt"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
@wishsagarks
wishsagarks / index.html
Created April 25, 2022 05:09
Paginated Photo Gallery - Vanilla JavaScript
<div class="gallery">
<header>
<h1>Photo Gallery</h1>
</header>
<main id="image-gallery" class="images"></main>
<footer id="gallery-pagination">
<button id="btnPrevious">&larr; <span class="sr-only">Previous</span></button>
<div>
<div id="gallery-dots"></div>
<span id="page"></span>
@paulmillr
paulmillr / BLS_Signature.md
Last active March 2, 2024 14:44
BLS Signature for Busy People

BLS Signature for Busy People

Summary

  • BLS stands for

    • Barreto-Lynn-Scott: BLS12, a Pairing Friendly Elliptic Curve.
    • Boneh-Lynn-Shacham: A Signature Scheme.
  • Signature Aggregation

  • It is possible to verify n aggregate signatures on the same message with just 2 pairings instead of n+1.

DAO

负责SQL CRUD

  • insert
    • single insertX(x:X)
    • multiple insertXxList(xxs:List<X>)
  • update updateXXbyYY(xx:X,yy:Y)
  • delete
    • single deleteX(x:X)
    • multiple deleteByYY(yy:Y)
  • read
@objcode
objcode / ConcurrencyHelpers.kt
Last active May 2, 2024 08:05
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@nickbutcher
nickbutcher / LICENSE
Last active October 6, 2020 11:14
Fun with gradients and AnimatedVectorDrawables. Illustration by the wonderful https://twitter.com/VPoltrack
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@ferrerojosh
ferrerojosh / AndroidWorkerInjection.kt
Created May 30, 2018 06:40
androidx workmanager injector temporary impl
import androidx.work.Worker
object AndroidWorkerInjection {
fun inject(worker: Worker) {
checkNotNull(worker, { "worker" })
val application = worker.applicationContext
if (application !is HasWorkerInjector) {
throw RuntimeException("${application.javaClass.canonicalName} does not implement ${HasWorkerInjector::class.java.canonicalName}")
}
@LouisCAD
LouisCAD / LifecycleCoroutines.kt
Last active July 3, 2022 11:47
CoroutineScope and Job integration with Lifecycle for Android. Meant to be used for your coroutines in lifecycle aware components. OUTDATED. See up to date implementation here: https://github.com/LouisCAD/Splitties/tree/master/modules/lifecycle-coroutines
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY
import android.arch.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.Job
import kotlinx.coroutines.experimental.android.Main
fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job {
@nickbutcher
nickbutcher / IconView.kt
Last active July 30, 2023 22:05
A prototype implementation of a shadow effect inspired by the Google Play Games app (https://play.google.com/store/apps/details?id=com.google.android.play.games).
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@mhawksey
mhawksey / GoogleAppsScript2GitHub.gs
Last active June 14, 2023 15:32
Example script that demonstrates how you can commit files to Github using Google Apps Script. If copying into a script project remembers to add a oAuth2 library https://github.com/googlesamples/apps-script-oauth2. More info in this post https://mashe.hawksey.info/?p=17293
/*
To use you need to create an application on Github at https://github.com/settings/developers
The callback in this needs to be set to https://script.google.com/macros/d/{SCRIPT ID}/usercallback
Where {SCRIPT ID} is the ID of the script that is using this library. You can find your script's ID in the Apps Script code editor by clicking on the menu item "File > Project properties".
In this example code I've stored the apllicaitons clientId and clientSecret in the Script Properties:
- git_clientId
- git_clientSecret