Skip to content

Instantly share code, notes, and snippets.

@wudi
wudi / docker-compose.yaml
Created May 29, 2023 05:14 — forked from nobbynobbs/docker-compose.yaml
kafka and kafka-ui, without zookeeper
View docker-compose.yaml
version: '2.4'
services:
kafka:
image: bitnami/kafka:3.1.0
container_name: kafka
command:
- 'sh'
- '-c'
- '/opt/bitnami/scripts/kafka/setup.sh && kafka-storage.sh format --config "$${KAFKA_CONF_FILE}" --cluster-id "lkorDA4qT6W1K_dk0LHvtg" --ignore-formatted && /opt/bitnami/scripts/kafka/run.sh' # Kraft specific initialise
environment:
@wudi
wudi / cloudflare_dyn_dns.sh
Created February 27, 2022 07:16 — forked from chappy84/cloudflare_dyn_dns.sh
CloudFlare Dynamic DNS Shell Script
View cloudflare_dyn_dns.sh
#!/bin/sh
#
# CloudFlare Dynamic DNS
#
# Updates CloudFlare records with the current public IP address
#
# Takes the same basic arguments as A/CNAME updates in the CloudFlare v4 API
# https://www.cloudflare.com/docs/client-api.html#s5.2
#
# Use with cron jobs etc.
@wudi
wudi / MoveFile.go
Created May 24, 2021 11:15 — forked from var23rav/MoveFile.go
GoLang: os.Rename() give error "invalid cross-device link" for Docker container with Volumes. MoveFile(source, destination) will work moving file between folders
View MoveFile.go
import (
"fmt"
"io"
"os"
)
/*
GoLang: os.Rename() give error "invalid cross-device link" for Docker container with Volumes.
MoveFile(source, destination) will work moving file between folders
*/
@wudi
wudi / golang-tls.md
Created March 21, 2021 07:41 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
View golang-tls.md

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@wudi
wudi / aes-256-cbc-test.js
Created January 24, 2021 04:50 — forked from brettscott/aes-256-cbc-test.js
AES 256 CBC encryption between Golang and Node JS
View aes-256-cbc-test.js
// Node v6.9.0
//
// TEST FILE (cut down for simplicity)
// To ensure Golang encrypted string can be decrypted in NodeJS.
//
let crypto;
try {
crypto = require('crypto');
@wudi
wudi / main.go
Created January 23, 2021 15:31 — forked from yingray/main.go
Golang: aes-256-cbc examples (with iv, blockSize)
View main.go
package main
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"encoding/hex"
"fmt"
)
@wudi
wudi / cmd.sh
Created January 5, 2021 06:25 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
View cmd.sh
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@wudi
wudi / Paint slack black.md
Created September 10, 2020 03:56 — forked from tadast/Paint slack black.md
Update the Mac Desktop slack CSS
View Paint slack black.md

In the console

export SLACK_DEVELOPER_MENU=true
open /Applications/Slack.app

In slack UI

right-click on anything -> inspect element

@wudi
wudi / github.css
Created August 17, 2020 02:02 — forked from tuzz/github.css
Github Markdown Stylesheet
View github.css
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@wudi
wudi / gist:1e1a12f034fd7232f362e1c33241329c
Created August 5, 2020 09:52 — forked from mattd/gist:1006398
nginx try_files with a proxy_pass
View gist:1e1a12f034fd7232f362e1c33241329c
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;