Skip to content

Instantly share code, notes, and snippets.

@LukeMathWalker
LukeMathWalker / audit.yml
Last active June 7, 2025 07:16
GitHub Actions - Rust setup
name: Security audit
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
@fkurz
fkurz / mermaid-image-export.md
Last active January 10, 2025 04:11
Mermaid Diagram Image Export

We can export a mermaid diagram to PNG very simply using the official Mermaid CLI Tool.

Installation via npm

npm i -g mermaid.cli

Usage:

@LukaGiorgadze
LukaGiorgadze / EllipticCurve.go
Last active January 21, 2025 16:41
Golang ECDSA (Elliptic Curve Digital Signature Algorithm) example, generate Private/Public key pairs, verify and test
package ec
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/md5"
"crypto/rand"
"crypto/x509"
"encoding/pem"
"errors"
@bszwej
bszwej / echo.js
Last active June 13, 2025 04:05
Pure Node.js echo server, that logs all incoming http requests (method, path, headers, body).
const http = require('http');
const server = http.createServer();
server.on('request', (request, response) => {
let body = [];
request.on('data', (chunk) => {
body.push(chunk);
}).on('end', () => {
body = Buffer.concat(body).toString();
@arthur17
arthur17 / static.py
Created April 2, 2017 20:43
Simple static file handler for Falcon
import falcon
import mimetypes
import os.path
from falcon.request import Request
from falcon.response import Response
# simple static file handler for falcon
# it is recommended to use a program like nginx to handle static files
# however this is useful for development and when performance is not a priority
@amirasaran
amirasaran / BaseThreading
Created October 27, 2016 06:36
Python threading with callback function (callback function run after thread is finished)
import time
import threading
class BaseThread(threading.Thread):
def __init__(self, callback=None, callback_args=None, *args, **kwargs):
target = kwargs.pop('target')
super(BaseThread, self).__init__(target=self.target_with_callback, *args, **kwargs)
self.callback = callback
self.method = target
(ns api-project.cors)
(def cors-headers
"Generic CORS headers"
{"Access-Control-Allow-Origin" "*"
"Access-Control-Allow-Headers" "*"
"Access-Control-Allow-Methods" "GET"})
(defn preflight?
"Returns true if the request is a preflight request"
@bigfox
bigfox / git_commit_count
Last active March 31, 2025 12:45
Git - number of commits by author (exclude merge commits)
git shortlog -s -n --all --no-merges
@ungoldman
ungoldman / curl_post_json.md
Last active May 21, 2025 09:29
post a JSON file with curl

How do you POST a JSON file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active June 14, 2025 01:46
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k