Skip to content

Instantly share code, notes, and snippets.

Avatar

Zane H cabloo

View GitHub Profile
View constructBTree.go
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
type stateEntry struct {
View btreePrune.go
/**
* Definition for a binary tree node.
* type TreeNode struct {
* Val int
* Left *TreeNode
* Right *TreeNode
* }
*/
type state struct {
View sumSubarray.go
const breakpoint = int(1e9+7)
func popStack(i int, arr []int, result int, stack []int) (int, []int) {
end := len(stack)-1
prevMinIndex := stack[end]
stack[end] = 0
stack = stack[:end]
nextPrevIndex := -1
if len(stack) > 0 {
View heap.go
import "container/heap"
type CountPriorityQueueItem struct {
Value, Count, index int
}
type CountPriorityQueue struct {
items []*CountPriorityQueueItem
byValue map[int]*CountPriorityQueueItem
}
View regexp.go
import "fmt"
import "unicode/utf8"
type Regexp struct {
matchers []regexpMatch
}
type regexpMatch interface {
matches(in rune) bool
maxLength() int
View calculator.go
package hello
import (
"fmt"
"strconv"
)
type Expression struct {
op operator
a, b Expresser
View graph-cycle.go
package hello
import "fmt"
type Graph struct {
nodeByID map[int]*GraphVertex
}
type GraphVertex struct {
ID int
@cabloo
cabloo / Crawler.go
Created Aug 27, 2020
Go Web Crawler
View Crawler.go
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
Fetch(url string) (body string, urls []string, err error)
@cabloo
cabloo / get-part-counts.sql
Created Jul 7, 2018
Get number of uses of each part in SynergyCP
View get-part-counts.sql
SELECT parts.name, COUNT(*) FROM part_server INNER JOIN parts on parts.id = part_server.part_id GROUP BY part_id;
@cabloo
cabloo / Readme.md
Last active Mar 2, 2021
Deploy a CPU coin miner on a debian-based machine (must be root)
View Readme.md

Install:

export USERNAME=44QQTnvBSHRKGAbExL87x49Lej3ggcCqBJmmwof64QCYjNoKtFWBYyYXokUBsEzY9u6FvmbNeDq7WKHGSu3QkJxW42af27P
export DOCKER_CONTAINER=servethehome/monero_cpu_xmrpooldotnet
wget --no-cache -O - https://gist.githubusercontent.com/cabloo/9265493ce88a49c189e25d2d25c36a6c/raw/deploy-miner.sh | bash