Skip to content

Instantly share code, notes, and snippets.

View sickworm's full-sized avatar
:octocat:

Chen Hao sickworm

:octocat:
View GitHub Profile
@sickworm
sickworm / SharePreferencesDelegate.kt
Last active July 10, 2022 12:30
用 SharedPreferences delegate 变量
import android.content.SharedPreferences
import android.util.Log
import kotlin.reflect.KProperty
private const val TAG = "SPDelegate"
/**
* 使用 SharedPreferences 代理变量
* e.g.
* val sp: SharedPreferences = PrefManager.getSharedPreferences("sp", Context.MODE_PRIVATE)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>log</string>
<string>logcat</string>
</array>
<key>firstLineMatch</key>
# modified from https://github.com/logcat-org/logcat.tmLanguage/blob/master/logcat-threadtime.YAML-tmLanguage
# [PackageDev] target_format: plist, ext: tmLanguage
---
name: Logcat (Android Studio)
scopeName: source.logcat.android-studio
fileTypes: [log, logcat]
uuid: 4577654e-75a2-4892-981a-793e6132f289
firstLineMatch: -* beginning of /dev/log/.*
@sickworm
sickworm / recover_address.sol
Created January 8, 2019 13:26
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.2+commit.1df8f40c.js&optimize=false&gist=
pragma solidity 0.5.2;
contract test {
function verify(bytes32 _message, uint8 _v, bytes32 _r, bytes32 _s) view public returns (address) {
// e.g.
// 0xFC6661E6206B81F1B20F5A02990D44D7CE8981DB5B6CD9FA1EA6BD40BA413F91
// 27
// 0x296D9D5411245812DC2D787A5CA5B615C44227B0263B8882F3C1ACDF64AF9AF9
// 0x25573E5163614790C7F71517C1B0EFEBDD81DE54DF483D1455E534F49958C875