Skip to content

Instantly share code, notes, and snippets.

@marty0678
marty0678 / example_usage.py
Created March 8, 2024 21:57
Django Rest Framework Base Model CRUD Class
# Views
class UserProfileViewSet(BaseModelViewSet):
"""View set for the UserProfile."""
ENABLE_LIST = True
ENABLE_RETRIEVE = True
ENABLE_PARTIAL_UPDATE = True
ENABLE_PAGINATION = True
LIST_CACHE_KEY = "users:user-profiles-list"
@jonrau1
jonrau1 / get_vulncheck_kev_cves.py
Created September 7, 2024 18:20
Retrieve unique CVE IDs from Vulncheck KEV
from os import environ
import logging
import requests
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
VULNCHECK_TOKEN = environ.get("VULNCHECK_TOKEN")
def retrieve_vulncheck_kev() -> list[dict]:
@while0pass
while0pass / dash-avc264 command lines
Created June 14, 2019 09:47 — forked from ddennedy/dash-avc264 command lines
Use ffmpeg and mp4box to prepare DASH-AVC/264 v1.0 VoD
See my DASH-IF presentation from October, 2014:
https://s3.amazonaws.com/misc.meltymedia/dash-if-reveal/index.html#/
1. encode multiple bitrates with keyframe alignment:
ffmpeg -i ~/Movies/5D2_Portrait.MOV -s 1280x720 -c:v libx264 -b:v 1450k -bf 2 \
-g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 32000 out.mp4
My input was 30 fps = 3000 ms. If it were 29.97, then a GOP size of 90 frames will yield a base segment
size of 3003 milliseconds. You can make the segment size some multiple of this, e.g.: 6006, 9009, 12012.
@JoshDevHub
JoshDevHub / my-lazy-vim.md
Created May 6, 2023 03:05
My LazyVim Setup

Basic LazyVim Setup with Ruby/Rails

A very basic setup for ruby/rails development using LazyVim

Prerequisites

First, you'll of course need neovim. I personally just use the stable release over nightly just because I dislike when things randomly break, and I have to stop working to deal with it. But do whatever you like.

Probably a good idea to start it and run :checkhealth to make sure everything works before proceeding.

@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@JerryLokjianming
JerryLokjianming / Crack Sublime Text Windows and Linux.md
Last active September 7, 2024 19:45
Crack Sublime Text 3.2.2 Build 3211 and Sublime Text 4 Alpha 4098 with Hex

How to Crack Sublime Text 3.2.2 Build 3211 with Hex Editor (Windows | Without License) ↓

  1. Download & Install Sublime Text 3.2.2 Build 3211
  2. Visit https://hexed.it/
  3. Open file select sublime_text.exe
  4. Offset 0x8545: Original 84 -> 85
  5. Offset 0x08FF19: Original 75 -> EB
  6. Offset 0x1932C7: Original 75 -> 74 (remove UNREGISTERED in title bar, so no need to use a license)
@Crocoblock
Crocoblock / code.php
Created January 25, 2024 09:57
JetSmartFilters Search filter plain query
<?php
add_filter( 'jet-smart-filters/query/final-query', function( $query ) {
if ( empty( $query ) ) {
return $query;
}
foreach ( $query as $var => $value ) {
@yufengwng
yufengwng / arch_cheatsheet.txt
Last active September 7, 2024 19:44
Arch Linux Commands Cheatsheet
pacman
======
view logs: /var/log/pacman.log
update system
# pacman -Syu
list installed packages
# pacman -Q
@juanbrujo
juanbrujo / PlayStationBIOSFilesNAEUJP.md
Last active September 7, 2024 19:43
Files for PlayStation BIOS Files NA-EU-JP
@whoisryosuke
whoisryosuke / laravel-uuid-guide.md
Last active September 7, 2024 19:43
Laravel - Enabling UUID for model (v6 tested) -- uses \Illuminate\Support\Str::uuid

Migrations

Add UUID (or swap bigIncrement) and make sure to set as primary column:

        Schema::create('events', function (Blueprint $table) {
            $table->uuid('id')->primary();

When using the column as a foreign key in a pivot table, create a UUID column and do the same foreign key assignment: