Skip to content

Instantly share code, notes, and snippets.

View halink0803's full-sized avatar
🇻🇳
Busy running

Ha Link halink0803

🇻🇳
Busy running
View GitHub Profile
import { ethereum } from '@graphprotocol/graph-ts';
import { PubSub } from '@google-cloud/pubsub';
import { Block } from '../../generated/schema';
export function handleBlock(block: ethereum.Block): void {
let id = block.hash.toHex()
let blockEntity = new Block(id)
blockEntity.number = block.number
blockEntity.timestamp = block.timestamp
@halink0803
halink0803 / main.go
Created March 9, 2022 09:37
test binance roundtrip
package main
import (
"context"
"encoding/json"
"log"
"os"
"sort"
"time"
@halink0803
halink0803 / rename.md
Last active March 8, 2022 08:04
rename multiple files with padding 0
  1. install rename
brew install rename (osx)
sudo pacman -S perl-rename (arch linux)
  1. rename
@halink0803
halink0803 / regex.md
Last active March 3, 2022 01:56
Regular expression

// Find all \n without precede by \n and followed by \n

(?<!\n)\n(?!\n)
[
{
"timestamp": 1618410797000,
"block_number": 6560905,
"tx_hash": "0x74d75409850edbcde10de7a36ba4fa71e5b796065cf670d0302883b8005f3433",
"token_info": {
"src_addr": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"src_symbol": "BNB",
"dst_addr": "0x55d398326f99059ff775485246999027b3197955",
"dst_symbol": "USDT"
	CREATE OR REPLACE FUNCTION get_erc20_transfer(text, text, integer, integer) RETURNS text AS 
$$
DECLARE
query_final text;
wallet ALIAS FOR $1;
token ALIAS FOR $2;
from_time ALIAS FOR $3;
to_time ALIAS FOR $4;
BEGIN
@halink0803
halink0803 / fix_onedrive.sh
Created November 1, 2018 03:33 — forked from drblue/fix_onedrive.sh
Fix OneDrive for Mac CPU usage
#!/bin/bash
find ~/Library/Group\ Containers/ -type d -name OfficeFileCache -exec rm -r {} +
CREATE CONTINUOUS QUERY "wallet_fee" ON "trade_logs"
RESAMPLE EVERY 1h FOR 1d
BEGIN
SELECT SUM("amount") as "sum_amount"
INTO "hourly_wallet_fees"
FROM "wallet_fees"
GROUP BY "reserve_addr", "wallet_addr", time(1h)
END
CREATE CONTINUOUS QUERY "wallet_fee_1d" ON "trade_logs"
@halink0803
halink0803 / Clear Chrome synced data.md
Last active October 15, 2018 06:24
Clear Chrome synced data

From device

  1. Go to chrome://settings/people.
  2. Click turn off sync data.
  3. At the pop up, check into Clear bookmark, history, password and more from this device.
  4. Click turn off.

=> all your synced data will be cleared from the device.

From cloud

err = db.View(func(tx *bolt.Tx) error {
        return tx.ForEach(func(name []byte, _ *bolt.Bucket) error {
            fmt.Println(string(name))
            return nil
        })
    })