Skip to content

Instantly share code, notes, and snippets.

def is_valid(grid, r, c, k):
not_in_row = k not in grid[r]
not_in_column = k not in [grid[i][c] for i in range(9)]
not_in_box = k not in [grid[i][j] for i in range(r//3*3, r//3*3+3) for j in range(c//3*3, c//3*3+3)]
return not_in_row and not_in_column and not_in_box
def solve(grid, r=0, c=0):
if r == 9:
return True
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 26, 2024 18:15
Complete Recent Discord Quest

Complete Recent Discord Quest

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
  2. Join a vc
  3. Stream any window (can be notepad or something)
  4. Press Ctrl+Shift+I to open DevTools
  5. Go to the Console tab
  6. Paste the following code and hit enter:
let wpRequire;
@siliconjungle
siliconjungle / vector-db.js
Created October 15, 2023 21:59
Simple vector db embeddings.
import readline from 'readline'
import chalk from 'chalk'
import OpenAI from 'openai'
import { LocalIndex } from 'vectra'
import { fileURLToPath } from 'url'
import path, { dirname } from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
@mariohercules
mariohercules / CoreSimulator-Clean.txt
Last active April 26, 2024 18:12
~/Library/Developer/CoreSimulator/Devices - Clean
# Delete/Clean XCode /CoreSimulator/Devices/ folder
$ xcrun simctl delete unavailable
@superdodd
superdodd / pizero-setup.md
Created September 1, 2016 05:15
Set up a Raspberry Pi Zero (with only a USB cable) via OS X
  1. Download the Raspbian Lite image from https://downloads.raspberrypi.org/raspbian_lite_latest (add .torrent to get a torrent)
  2. Unzip the download to extract the .img file
  3. Insert a FAT32-formatted SD card, and copy the image over:
    • diskutil list to identify the disk number, e.g. /dev/disk2
    • diskutil unmountDisk /dev/disk2
    • sudo dd bs=1m if=image.img of=/dev/rdisk2
  4. Before unmounting, edit a couple of files to activate internet-over-USB. The image mounted for me at /Volumes/boot.
    • In config.txt, add this as the last line of the file: dtoverlay=dwc2
    • In cmdline.txt, add this as a parameter, just after the rootwait parameter: modules-load=dwc2,g_ether
  5. Unmount the SD card (via Finder) and stick it in the Raspberry Pi.