Skip to content

Instantly share code, notes, and snippets.

@RuolinZheng08
RuolinZheng08 / backtracking_template.py
Last active March 21, 2025 05:20
[Algo] Backtracking Template & N-Queens Solution
def is_valid_state(state):
# check if it is a valid solution
return True
def get_candidates(state):
return []
def search(state, solutions):
if is_valid_state(state):
solutions.append(state.copy())
def findSchedules(workHours, dayHours, pattern):
totalHours = 0
result = []
for c in pattern:
if c != '?':
totalHours = totalHours + int(c)
diff = workHours - totalHours
constructResult(list(pattern), 0, diff, dayHours, result)
return result
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active March 31, 2025 09:00
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@jpalala
jpalala / react_samples_list.md
Last active November 12, 2024 04:10 — forked from leecade/react_samples_list.md
React Samples List
@andreibosco
andreibosco / creative-cloud-disable.md
Last active December 19, 2024 08:28
disable creative cloud startup on mac
@kavitshah8
kavitshah8 / 2-D-array-fix-2.js
Last active March 17, 2020 10:57
Arrays with one Misc
function createAndInitialize2DArray(size) {
// catch a bug & fix me!
var defaultValue = 0;
var twoDimensionalArray = [];
function initOneDArray() {
var row = [];
for (var i = 0; i < size; i++) {
row.push(defaultValue);
}
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 1, 2025 03:07
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@dapangmao
dapangmao / Linkedlist.md
Last active June 15, 2021 17:56
Linked List
  • Transform list to linked list
class ListNode:
    def __init__(self, val=None):
        self.val = val
        self.next = None
        self.size = 0
        if val:
            self.size = 1
    def add_to_last(self, x):