Skip to content

Instantly share code, notes, and snippets.

@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

Complete Genshin Impact Discord Quest:

First way which will work for any Quests not just Genshin, though it needs some knowledge 🤓:

  1. Accept the quest under User Settings -> Gift Inventory.
  2. Join a vc to your alt or your friend.
  3. Stream any window
  4. Press Ctrl + Shift + I to open DevTools
  5. Go to the Console tab
  6. Paste this code and press enter:
wget -nv https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get install apt-transport-https
sudo apt install snapd
sudo service snapd start
sudo snap install dotnet-sdk --classic
sudo apt-get install mono-complete
@jboner
jboner / latency.txt
Last active April 25, 2024 11:20
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jhaddix
jhaddix / cloud_metadata.txt
Last active April 25, 2024 11:19 — forked from BuffaloWill/cloud_metadata.txt
Cloud Metadata Dictionary useful for SSRF Testing
## AWS
# from http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-categories
http://169.254.169.254/latest/user-data
http://169.254.169.254/latest/user-data/iam/security-credentials/[ROLE NAME]
http://169.254.169.254/latest/meta-data/iam/security-credentials/[ROLE NAME]
http://169.254.169.254/latest/meta-data/ami-id
http://169.254.169.254/latest/meta-data/reservation-id
http://169.254.169.254/latest/meta-data/hostname
http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
@balazsbotond
balazsbotond / ABOUT.md
Last active April 25, 2024 11:19
Simple Canvas Pan And Zoom

Simple Canvas Pan And Zoom

I needed a simple way to implement dragging and scroll wheel zooming on an HTML canvas, but I couldn't find a pure JS example. The most popular one uses an SVG node to convert coordinates, but I didn't like that so I created my own version.

Try it here: https://jsfiddle.net/balazsbotond/6n2uzjkq/30/