Skip to content

Instantly share code, notes, and snippets.

@cghiban
cghiban / uwgi-medium-post.ini
Created April 5, 2025 15:34 — forked from sumitsk20/uwgi-medium-post.ini
uwsgi configuration with most commonly sused options for highly scalable website (medium blog post)
[uwsgi]
# telling user to execute file
uid = bunny
# telling group to execute file
gid = webapps
# name of project you during "django-admin startproject <name>"
project_name = updateMe
@cghiban
cghiban / unmarshal_interface.go
Created March 24, 2025 01:02 — forked from tkrajina/unmarshal_interface.go
Unmarshal JSON to specific interface implementation
package main
import (
"encoding/json"
"fmt"
"reflect"
)
type Something interface{}
@cghiban
cghiban / erdiagram
Created March 11, 2025 11:53
transportation booking system
erDiagram
Providers {
int provider_id PK
varchar name
varchar contact
}
Vehicles {
int vehicle_id PK
int provider_id FK
varchar vehicle_type
@cghiban
cghiban / celeryd.sh
Created February 26, 2025 13:37 — forked from arturataide/celeryd.sh
CeleryD Daemon
#!/bin/sh -e
# ============================================
# celeryd - Starts the Celery worker daemon.
# ============================================
#
# :Usage: /etc/init.d/celeryd {start|stop|force-reload|restart|try-restart|status}
# :Configuration file: /etc/default/celeryd
#
# See http://docs.celeryproject.org/en/latest/userguide/daemonizing.html
@cghiban
cghiban / SuperSimpleRedisCircularBufferWrittenOnGO.md
Created March 8, 2024 19:54 — forked from cn0047/SuperSimpleRedisCircularBufferWrittenOnGO.md
Super simple Redis circular-buffer written on GO

Super simple Redis circular-buffer on GO

Here you can find super simple redis based circular-buffer implementation written on golang:

package main

import (
	"fmt"

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@cghiban
cghiban / bookmarklet.txt
Created March 7, 2023 18:49
bookmarklet - load from js website
javascript:(function(){let d = document, s = d.createElement('script'); d.getElementsByTagName('head')[0].innerHTML += '<meta http-equiv="Content-Security-Policy" content="default-src gap://ready file://* *; style-src \'self\' http://* https://* \'unsafe-inline\'; script-src \'self\' http://* https://* \'unsafe-inline\' \'unsafe-eval\'">'; s.src = "https://thinky.home.lan/trans.js"; d.head.appendChild(s);})();
@cghiban
cghiban / reflection.go
Created August 2, 2022 15:25 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Location struct {
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
@cghiban
cghiban / chill-zoom.sh
Created November 16, 2021 00:52 — forked from abraithwaite/chill-zoom.sh
Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/bash -xe
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice"
[Slice]
AllowedCPUs=0-4
MemoryHigh=6G
EOF
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop"