Skip to content

Instantly share code, notes, and snippets.

@foloinfo
foloinfo / generate_migration.sh
Last active June 18, 2025 01:56
Prisma rollback shell script
#!/bin/bash
# prisma does not generate rollback (down script by default)
# this script will generate the down script for each migration
name=$1
dir=$(pwd)
if [ -z "$name" ]
then
pip install -e packages/markitdown[all]
pip install pyinstaller
create a bootstrap file:
markitdown-main\packages\markitdown\src\runme.py
content:
import markitdown.__main__
Two pointers: one input, opposite ends
```python3
def fn(arr):
left = ans = 0
right = len(arr) - 1
while left < right:
# do some logic here with left and right
if CONDITION:
@deefdragon
deefdragon / migrate.configmap.yaml
Last active June 18, 2025 01:51
Migrating Kubernetes PVC/PVs from one storage class to another
apiVersion: v1
kind: ConfigMap
metadata:
# any name can be used; Velero uses the labels (below)
# to identify it rather than the name
name: change-storage-class-config
# must be in the velero namespace
namespace: velero
# the below labels should be used verbatim in your
# ConfigMap.
@rebane2001
rebane2001 / glass-with-controls.html
Last active June 18, 2025 01:50
glass effect test css/svg thing (messy) - demo: https://codepen.io/rebane2001/details/OPVQXMv
<div style="position:absolute;top:-999px;left:-999px">
<svg
id="effectSvg"
width="200"
height="200"
viewBox="0 0 200 200"
xmlns="http://www.w3.org/2000/svg">
<filter id="displacementFilter4">
http://www.mysqltutorial.org/import-csv-file-mysql-table/
------------------------------------------------------------
Import CSV File Into MySQL Table
This tutorial shows you how to use the LOAD DATA INFILE statement to import CSV file into MySQL table.
@wojteklu
wojteklu / clean_code.md
Last active June 18, 2025 01:39
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@anthonyec
anthonyec / gamepad_debugger.gd
Last active June 18, 2025 01:39
Godot gamepad input visualisation for debugging (GDScript 2)
@tool
extends Control
@export var device: int = 0
func _process(delta: float) -> void:
queue_redraw()
func _draw() -> void:
# Set the size, the layout isn't dynamic and based on something I sketched!
@mwakaba2
mwakaba2 / system_design_numbers_cheat_sheet.md
Last active June 18, 2025 01:38
Updated easy to remember system design numbers for back-of-the-envelope calculations

Updated, easy to remember numbers for back-of-the-envelope calculations in system design interviews

Powers of two table

Power    Approx Value (Bytes)       Bytes
-----------------------------------------
10                 1 thousand        1 KB
16                65 thousand       64 KB
20                  1 million        1 MB
30 1 billion 1 GB