Skip to content

Instantly share code, notes, and snippets.

View mritd's full-sized avatar

mritd mritd

View GitHub Profile
@myl7
myl7 / req.sh
Last active February 14, 2022 06:51
Zero-dependency HTTP request script from https://www.v2ex.com/t/811424
#!/bin/bash
set -euo pipefail
# From https://www.v2ex.com/t/811424
function __curl() {
read proto server path <<<$(echo ${1//// })
DOC=/${path// //}
HOST=${server//:*}
PORT=${server//*:}
@superseb
superseb / k3s-etcd-commands.md
Last active July 10, 2024 03:06
k3s etcd commands

k3s etcd commands

etcd

Setup etcdctl using the instructions at https://github.com/etcd-io/etcd/releases/tag/v3.4.13 (changed path to /usr/local/bin):

Note: if you want to match th etcdctl binaries with the embedded k3s etcd version, please run the curl command for getting the version first and adjust ETCD_VER below accordingly:

curl -L --cacert /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --cert /var/lib/rancher/k3s/server/tls/etcd/server-client.crt --key /var/lib/rancher/k3s/server/tls/etcd/server-client.key https://127.0.0.1:2379/version
@rlam3
rlam3 / disable-cleanmymac.md
Created August 21, 2019 01:26
Mac disables "Setapp CleanMyMac-setapp.HealthMonitor" launchd services

sudo vim /private/var/db/launchd.db/com.apple.launchd/overrides.plist

Add the following code,as entries like:

<key>com.macpaw.CleanMyMac-setapp.HealthMonitor</key>
<dict>
<key>Disabled</key>
<true/>
@aojea
aojea / force cgo resolver
Last active May 31, 2022 09:43
localhost resolution in go
GODEBUG=netdns=cgo+2 go run listen.go
GOOS: linux
go package net: using cgo DNS resolver
go package net: hostLookupOrder(localhost) = cgo
net.LookupHost addrs: [::1 127.0.0.1] err: <nil>
go package net: hostLookupOrder(localhost) = cgo
Listener address: 127.0.0.1:8080
go package net: hostLookupOrder(localhost) = cgo
Dial remote address: 127.0.0.1:8080
@Rand01ph
Rand01ph / geektime.user.js
Created September 4, 2018 08:41
让极客时间的内容可以复制
// ==UserScript==
// @name geektime copy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 让极客时间的内容可以复制!
// @author Rand01ph
// @match https://time.geekbang.org/column/*
// @grant none
// @require http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js
// ==/UserScript==

1:设置

sudo vi /etc/sysctl.conf
net.ipv4.ip_forward=1
sudo sysctl -p

2:安装

https://www.wireguard.com/install/
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 22, 2024 06:03
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@codref
codref / go-ssh-reverse-tunnel.go
Last active October 23, 2023 13:32
Go SSH reverse tunnel implementation (SSH -R)
/*
Go-Language implementation of an SSH Reverse Tunnel, the equivalent of below SSH command:
ssh -R 8080:127.0.0.1:8080 operatore@146.148.22.123
which opens a tunnel between the two endpoints and permit to exchange information on this direction:
server:8080 -----> client:8080
@denji
denji / README.md
Last active July 15, 2024 14:43 — forked from Cubixmeister/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@andystanton
andystanton / JVM DNS TTL Policy.md
Last active November 15, 2022 08:17
A script that inspects the DNS TTL for a JVM in a supplied Docker image.

A script that inspects the DNS TTL for a JVM in a supplied Docker image. The image must also contain a JDK.

It does this by generating a Docker image containing a Java program that outputs the JVM's DNS TTL and executing this, then cleaning up the container, image and temporary files.

Usage

$ ./jvm-dns-ttl-policy.sh openjdk:8