Skip to content

Instantly share code, notes, and snippets.

@tomassole
tomassole / pgsql_backup.sh
Created April 25, 2024 11:34 — forked from sirbrillig/pgsql_backup.sh
Postgresql daily backup script.
#!/bin/bash
#
# Backup a Postgresql database into a daily file.
#
BACKUP_DIR=/pg_backup
DAYS_TO_KEEP=14
FILE_SUFFIX=_pg_backup.sql
DATABASE=
USER=postgres
@AkdM
AkdM / Edit_Repack_ISO_tutorial.md
Last active April 25, 2024 11:34
Edit and repack .iso bootable image

On Linux

Installing mkisofs

apt-get install mkisofs

Editing ISO image

mkdir /tmp/custom_iso

@ishu3101
ishu3101 / gist_to_github_repo.md
Created November 24, 2015 08:35
Transfer a gist to a GitHub repository

Transfer a gist to a GitHub repository

clone the gist

git clone https://gist.github.com/ishu3101/6fb35afd237e42ef25f9

rename the directory

mv 6fb35afd237e42ef25f9 ConvertTo-Markdown

change the working directory to the newly renamed directory

cd ConvertTo-Markdown

@arkatsy
arkatsy / zustand-internals.jsx
Last active April 25, 2024 11:32
How zustand works internally
import { useSyncExternalStore } from "react";
// For more on the useSyncExternalStore hook, see https://react.dev/reference/react/useSyncExternalStore
// The code is almost identical to the source code of zustand, without types and some features stripped out.
// Check the links to see the references in the source code.
// The links are referencing the v5 of the library. If you plan on reading the source code yourself v5 is the best way to start.
// The current v4 version contains lot of deprecated code and extra stuff that makes it hard to reason about if you're new to this.
// https://github.com/pmndrs/zustand/blob/fe47d3e6c6671dbfb9856fda52cb5a3a855d97a6/src/vanilla.ts#L57-L94
function createStore(createState) {
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<title>Rebane's Discord Colored Text Generator</title>
<meta charset="UTF-8">
<meta name="description" content="Rebane's Discord Colored Text Generator">
<meta name="author" content="rebane2001">
<style>
/*
@scottwater
scottwater / backup.sh
Created February 22, 2024 18:40
SQLite Backup Script
#!/bin/bash
set -e
s3_key=$BACKUP_S3_KEY
s3_secret=$BACKUP_S3_SECRET
bucket=$BACKUP_S3_BUCKET
backup_db_passphrase=$BACKUP_S3_DB_PASSPHRASE
data_directory=$SQLITE_DATABASE_DIRECTORY
# ensure each backup has the same date key
date_key=$(date '+%Y-%m-%d-%H-%M-%S')
@ohld
ohld / code_to_media_id.py
Created February 19, 2020 20:14
Convert Instagram media URL to media_id
# This is Python port of this Javascript method:
# https://github.com/notslang/instagram-id-to-url-segment/blob/master/lib/index.coffee
url = "https://www.instagram.com/p/B8iwlG9pXHI/"
# ----> use regexp to extract code from url
code = "B8iwlG9pXHI"
charmap = {
'A': '0',
'B': '1',
@devops-school
devops-school / ansible-playbook-example-windows.md
Last active April 25, 2024 11:27
15 Ansible Playbooks Example for Windows Administration

1. Copying Files

---
- hosts: win

  tasks:
  - name: Copy File
    win_copy:
      src: C:\output.pdf
@Xynonners
Xynonners / HHAA-D.gdshader
Last active April 25, 2024 11:26
gdshader HHAA implementation (spatial/depth AA)
shader_type spatial;
render_mode unshaded;
void vertex() {
POSITION = vec4(VERTEX, 1.0);
}
uniform sampler2D BackBufferTex : hint_screen_texture, repeat_disable, filter_nearest;
uniform sampler2D DepthBufferTex : source_color, hint_depth_texture, filter_nearest;
@karpathy
karpathy / stablediffusionwalk.py
Last active April 25, 2024 11:25
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4