Skip to content

Instantly share code, notes, and snippets.

Verifying that +destenson2 is my blockchain ID.
https://onename.com/destenson2

Keybase proof

I hereby claim:

  • I am destenson on github.
  • I am destenson (https://keybase.io/destenson) on keybase.
  • I have a public key whose fingerprint is 9AA9 91EB 1925 F7E2 211A 2869 F5C4 42A6 D8ED 84A6

To claim this, I am signing this object:

@destenson
destenson / commit-howto.md
Last active August 21, 2016 10:12
How to commit to git

To really use the power of git, the maintainer/development team should follow these instructions:

After making several changes including several features that you want to check into git:

  • commit them all at once using stash as the commit message
  • Rename the current branch stash
  • Then branch the previous commit once for each "feature" or series of commits dependent upon each other, then on each new branch:
  • cherry pick from the stash, but don't commit yet
  • instead, curate the commit into just the code you want, deleting and staging files as necessary for the feature
  • then commit it to the appropriate branch (if it asks to save a stash or discard it before switching, discard it, we've already saved our own stash)
  • Once that's finished, branch the original commit as master
@destenson
destenson / README.md
Created November 22, 2016 04:03 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

Installing recovery patch to system partition
Warning: could not find SYSTEM/build.prop in <built-in function zip>
using prebuilt recovery.img from BOOTABLE_IMAGES...
using prebuilt boot.img from BOOTABLE_IMAGES...
Traceback (most recent call last):
File "./build/tools/releasetools/make_recovery_patch", line 53, in <module>
main(sys.argv[1:])
File "./build/tools/releasetools/make_recovery_patch", line 49, in main
common.MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img)
File "/home/spezi77/android/bs6/build/tools/releasetools/common.py", line 1443, in MakeRecoveryPatch
@destenson
destenson / 0_reuse_code.js
Created July 15, 2017 19:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@destenson
destenson / scanScope.txt
Created August 1, 2017 23:44 — forked from DorkForce/scanScope.txt
Console script - Search breakpoint model for value. SYNTAX: scanScope($scope.model, 'Fred');
console.log("Usage Syntax: scanScope(objectToScan, 'scanFor', ['whatToIgnore']); (whatToIgnore is optional and can be a string, or an array of strings)");
var callStack = 0,
errArray = [],
funArray = [],
scanLoop = function (whatToScan, scanValue, whatToIgnore, parentTree) {
scanValue = scanValue.toLowerCase();
if (Array.isArray(whatToIgnore)) {
whatToIgnore.forEach(function (ignoreVal) {
ignoreVal = lowerCase(ignoreVal);
});
{ "state": {
"0xae34861d342253194ffc6652dfde51ab44cad3fe": {"balance": "0x194608686316bd8000", "nonce": "0x"},
"0xe6115b13f9795f7e956502d5074567dab945ce6b": {"balance": "0x152d02c7e14af6800000", "nonce": "0x"},
"0x9d069197d1de50045a186f5ec744ac40e8af91c6": {"balance": "0x6c6b935b8bbd400000", "nonce": "0x"},
"0x1895a0eb4a4372722fcbc5afe6936f289c88a419": {"balance": "0x3154c9729d05780000", "nonce": "0x"},
"0x2d5b42fc59ebda0dfd66ae914bc28c1b0a6ef83a": {"balance": "0x2bc8b59fdcd836638000", "nonce": "0x"},
"0x4a81abe4984c7c6bef63d69820e55743c61f201c": {"balance": "0x36401004e9aa3470000", "nonce": "0x"},
"0x4989e1ab5e7cd00746b3938ef0f0d064a2025ba5": {"balance": "0x6c6b935b8bbd400000", "nonce": "0x"},
"0xf114ff0d0f24eff896edde5471dea484824a99b3": {"balance": "0xbe202d6a0eda0000", "nonce": "0x"},
"0x92c13fe0d6ce87fd50e03def9fa6400509bd7073": {"balance": "0x22b1c8c1227a00000", "nonce": "0x"},
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
using System;
namespace mc.DevelopmentAttributes
{
using System.Collections.Generic;
using static System.Linq.Enumerable;
using NI = NotImplementedAttribute;
using DST = System.Diagnostics.DebuggerStepThroughAttribute;
@destenson
destenson / utils.js
Last active November 21, 2018 19:42
Some random etherscan/uniswap code
const apiKeys = {etherscan:'GCGR1C9I17TYIRNYUDDEIJH1K5BRPH4UDE'} // EtherDelta's API key
const apiKey = (document.URL||'').includes('etherscan.io') ? 'YourApiKeyToken' : apiKeys.etherscan;
const uniswap = {factory:'0xc0a47dfe034b400b47bdad5fecda2621de6c4d95'};
const factoryAddress = uniswap.factory;
function select(n) {return x => x[n]}
function addrId(a) {const x=4, y=3, z=2; return `${a.substr(z,x+z)}:${a.substr(a.length-y)}`}
function topicToAddr(n) {return logEvent => '0x'+logEvent.topics[n].substring(logEvent.topics[n].length-40)}