Skip to content

Instantly share code, notes, and snippets.

@tosone
tosone / redis_cheatsheet.bash
Created January 31, 2023 00:45 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@tosone
tosone / pprof.md
Created January 29, 2023 06:19 — forked from slok/pprof.md
Go pprof cheat sheet

Enable profiling

Default http server

import (
    _ "net/http/pprof"
    "net/http"
)
@tosone
tosone / main.go
Created March 20, 2022 02:36
maven server tutorial
package main
import (
"crypto/sha1"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
// This shows an example of how to generate a SSH RSA Private/Public key pair and save it locally
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"io/ioutil"
@tosone
tosone / genpass.c
Created June 4, 2021 07:42 — forked from fabiomontefuscolo/genpass.c
Password generator
#include <getopt.h>
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void showHelp(char *biname) {
printf("%s [-l length] [-f 'regex'] [-n]\n", biname);
printf(" -l, --length\n");
printf(" Password length\n");
CCFiles := $(wildcard *.cc)
.PHONY: cc
cc: $(CCFiles)
.PHONY: $(CCFiles)
$(CCFiles):
@echo Running `echo $@ | cut -d. -f1`:
@echo
@$(CXX) -std=c++17 -lm -Os -g3 -fsanitize=address,signed-integer-overflow \
Go 19 hrs 30 mins ██████████▋░░░░░░░░░░ 50.9%
YAML 12 hrs 38 mins ██████▉░░░░░░░░░░░░░░ 33.0%
Other 2 hrs 1 min █░░░░░░░░░░░░░░░░░░░░ 5.3%
Docker 1 hr 35 mins ▊░░░░░░░░░░░░░░░░░░░░ 4.1%
Bash 55 mins ▌░░░░░░░░░░░░░░░░░░░░ 2.4%
@tosone
tosone / exact.go
Last active October 25, 2020 06:50
exactcover problem
package main
import (
"fmt"
)
func tester(input [9]byte) bool {
return false
}
@tosone
tosone / Makefile
Created October 25, 2020 06:45
分析其中 data race 问题,并预估输出结果。
TARGET = main.test
CFLAGS += -std=c11 -I. -Os -pthread
LDFLAGS +=
CPPFLAGS += -Wall
all: main.o adding.o
$(CC) -o $(TARGET) $? $(LDFLAGS) $(LDLIBS)
test:
@tosone
tosone / app.go
Last active October 25, 2020 06:42
请完成其中 Tester 的 io.Reader interface 相关函数
package main
import (
"io"
"log"
"os"
"github.com/gin-gonic/gin"
)