Skip to content

Instantly share code, notes, and snippets.

@jsmsalt
jsmsalt / seeding.py
Last active April 28, 2024 07:33
Seeding data to database using SQLAlchemy and FastAPI
# The simplest solution I found is to set up an event for each table that executes a method after the table is created.
# Database initial data
INITIAL_DATA = {
'users': [
{
'username': 'superuser',
'email': 'superuser@example.com',
'hashed_password': hash_password('123')
@dhh
dhh / linux-setup.sh
Last active April 28, 2024 07:31
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@liuran001
liuran001 / config.yaml
Last active April 28, 2024 07:21
mihomo (Clash Meta) 懒人配置
# mihomo (Clash Meta) 懒人配置
# 版本 V1.4.1-231211
# https://gist.github.com/liuran001/5ca84f7def53c70b554d3f765ff86a33
# 作者: 笨蛋ovo (bdovo.cc)
# Telegram: https://t.me/baka_not_baka
# 关注我的 Telegram 频道谢谢喵 https://t.me/s/BDovo_Channel
# 修改自官方示例规则 https://wiki.metacubex.one/example/#meta
# 转载请保留此注释
# 尽量添加了较为详尽的注释,不理解的地方建议对照 虚空终端 (Clash Meta) Docs 进行理解
# 虚空终端 (Clash Meta) Docs 地址: https://wiki.metacubex.one
@kxzazz
kxzazz / settings.json
Created April 23, 2024 16:10
My VSCode settings ✨
{
"workbench.colorTheme": "Head in the Clouds",
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"workbench.sideBar.location": "right",
"explorer.confirmDragAndDrop": false,
"workbench.iconTheme": "Monokai Pro Icons",
"breadcrumbs.enabled": false,
"editor.minimap.enabled": false,
"editor.fontSize": 16,
@bemxio
bemxio / download_creator_levels.sh
Created April 28, 2024 07:09
A script for downloading all of a creator's levels from the LittleBigPlanet archive (https://archive.org/details/dry23db). Requires `sqlite3`, `jq` and `sed`, as well as the `dry.db` database file inside the directory where the script is located. ONLY DOWNLOADS THE ROOT LEVEL, DOES NOT GET THE USER-MADE RESOURCES.
#!/bin/bash
IFS=$'\n'
author="$@"
result=$(sqlite3 -json dry.db "SELECT name, LOWER(HEX(rootLevel)) AS checksum FROM slot WHERE npHandle = '$author'")
if [ -z "$result" ]; then
echo "No levels found made by \"$author\"!" && exit 1
fi
@shortjared
shortjared / list.txt
Last active April 28, 2024 07:20
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
@catchdave
catchdave / replace_synology_ssl_certs.sh
Last active April 28, 2024 07:17
CLI script to programmatically replace SSL certs on Synology NAS
#!/bin/bash
#
# *** For DSM v7.x ***
#
# How to use this script:
# 1. Get your 3 PEM files ready to copy over from your local machine/update server (privkey.pem, fullchain.pem, cert.pem)
# and put into a directory (this will be $CERT_DIRECTORY).
# Personally, I use this script (https://gist.github.com/catchdave/3f6f412bbf0f0cec32469fb0c9747295) to automate steps 1 & 4.
# 2. Ensure you have a user setup on synology that has ssh access (and ssh access is setup).
# This user will need to be able to sudo as root (i.e. add this line to sudoers, <USER> is the user you create):
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active April 28, 2024 07:17
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@Asjas
Asjas / reset.css
Created May 19, 2021 07:09
Modern CSS Reset - Andy Bell
// https://piccalil.li/blog/a-modern-css-reset
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default margin */
@HimDek
HimDek / Install Android apps or apk files in Windows using Windows Subsystem for Android (No Emulator).md
Last active April 28, 2024 07:15
This Guide will show you how to install and run apk files or Android apps in any Edition of Windows 11 using Windows Subsystem for Android. WSA or Windows Subsystem for Android is a Tool that allows Windows to run Android Apps directly without using any emulator.

Install Android apps or apk files in Windows using Windows Subsystem for Android

WSA or Windows Subsystem for Android is a Tool that allows Windows to run Android Apps directly without using any emulator. The problem is Windows Subsystem for Android is currently only available through preview via the Beta Channel of the Windows Insider Program. But if you follow my guide, you don't have to be in Windows Insider Program to try it out. The only thing you need is Windows 11 installed and some patience.

Prerequisites:

  • Windows Subsystem for Android or WSA must be Installed.

Click here to view the guide that shows how to install Windows Subsystem for Android in any Edition of Windows 11 (including Windows 11 Home) non Inider or stable release.

How to Install Android Apps or apk files in Windows Subsystem for Android: