Skip to content

Instantly share code, notes, and snippets.

@BaronKimaru
BaronKimaru / InconsistentMigrationHistory.md
Last active May 20, 2024 09:39
Solution for this Error: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default
Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'

Answer:

  • There's a django_migrations table in your database after your previous migration which is the cause of this inconsistency.
  • Solution: Deleting the django_migrations table from your database and then perform python manage.py makemigrations plus python manage.py migrate again.
@chris-schra
chris-schra / next.config.js
Last active May 20, 2024 09:38
Custom bootstrap for next js server
let entryModified = false;
module.exports = {
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
if(dev && config.entry && !entryModified)
{
require('@babel/register')({
extensions: ['.js', '.jsx', '.ts', '.tsx']
})
@loilo
loilo / pass-slots.md
Last active May 20, 2024 09:37
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`
    }

const B = {

@parties
parties / renameReactJsToJsx.sh
Last active May 20, 2024 09:36
rename all *.js files containing React markup to *.jsx
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@stan-dot
stan-dot / rst_to_md.py
Created May 20, 2024 09:33
Convert restructured text documentation tomarkdown
import os
import re
import subprocess
def git_mv_rst_to_md(directory):
for root, dirs, files in os.walk(directory):
for filename in files:
if filename.endswith('.rst'):
old_file_path = os.path.join(root, filename)
new_file_path = os.path.join(root, filename[:-4] + '.md')
@padeoe
padeoe / README_hfd.md
Last active May 20, 2024 09:33
CLI-Tool for download Huggingface models and datasets with aria2/wget+git

🤗Huggingface Model Downloader

Considering the lack of multi-threaded download support in the official huggingface-cli, and the inadequate error handling in hf_transfer, this command-line tool smartly utilizes wget or aria2 for LFS files and git clone for the rest.

Features

  • ⏯️ Resume from breakpoint: You can re-run it or Ctrl+C anytime.
  • 🚀 Multi-threaded Download: Utilize multiple threads to speed up the download process.
  • 🚫 File Exclusion: Use --exclude or --include to skip or specify files, save time for models with duplicate formats (e.g., *.bin or *.safetensors).
  • 🔐 Auth Support: For gated models that require Huggingface login, use --hf_username and --hf_token to authenticate.
  • 🪞 Mirror Site Support: Set up with HF_ENDPOINT environment variable.
@Dlfaith
Dlfaith / gist:0d43be3dfb296bb6260af75ef082faa8
Created December 6, 2022 02:51
Free Windows Server 2022 Product Key
Free Windows Server 2022 Standard Product Key
HP9DJ-NK2X6-4QPCH-8HY8H-6X2XY
RRNMT-FP29D-CHKCH-GWQP2-DDDVB
44QN4-X3R72-9X3VK-3DWD6-HFWDM
Free Windows Server 2022 Datacenter Product Key
WX4NM-KYWYW-QJJR4-XV3QB-6VM33
Download windows Sever 2022 Evaluation edition:
Windows Server 2022 Evaluation English