Skip to content

Instantly share code, notes, and snippets.

@JamesSedlacek
JamesSedlacek / View+OpenUrl.swift
Created January 29, 2025 01:47
This file provides a safe way to open URLs in SwiftUI applications.
//
// View+OpenUrl.swift
//
// Created by James Sedlacek on 11/26/24.
//
/// This file provides a safe way to open URLs in SwiftUI applications.
/// It adds a view modifier that handles URL opening with user confirmation
/// and multiple opening options (browser, in-app, or copy to clipboard).
///
@ngxson
ngxson / FAQ.md
Last active January 29, 2025 06:14
convert ARM NEON to WASM SIMD prompt

Why did you do this?

Relax, I only have one Sunday to work on idea, literally my weekend project. So I tried Deepseek to see if it can help. Surprisingly, it works and it saves me another weekend...

What is your setup?

Just chat.deepseek.com (cost = free) with prompts adapted from this gist.

Does it work in one-shot or I have to prompt it multiple times?

Interview Questions

MongoDB

Q1: Explain what is MongoDB? ☆

Answer: MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. It's Key Features are:

  • Document Oriented and NoSQL database.

JavaScript Interview Questions

Q1: Explain equality in JavaScript ☆

Answer: JavaScript has both strict and type–converting comparisons:

  • Strict comparison (e.g., ===) checks for value equality without allowing coercion
  • Abstract comparison (e.g. ==) checks for value equality with coercion allowed
@thefirehacker
thefirehacker / r1.py
Created January 29, 2025 06:09 — forked from vgel/r1.py
script to run deepseek-r1 with a min-thinking-tokens parameter, replacing </think> with a random continuation string to extend the model's chain of thought
import argparse
import random
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache
import torch
parser = argparse.ArgumentParser()
parser.add_argument("question", type=str)
parser.add_argument(
@vgel
vgel / r1.py
Last active January 29, 2025 06:09
script to run deepseek-r1 with a min-thinking-tokens parameter, replacing </think> with a random continuation string to extend the model's chain of thought
import argparse
import random
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache
import torch
parser = argparse.ArgumentParser()
parser.add_argument("question", type=str)
parser.add_argument(

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@metaphorical
metaphorical / Mint-shortcut-VSCode.md
Last active January 29, 2025 06:04
Add shortcut to Application menu in Linux Mint

#Add shortcut to Application menu in Linux Mint

Example will be setting up VS Code on Mint and add shortcut to menu and panel.

Actually, it is really easy, you can just download ir from website, unzip in desired folder and run from there, so this is just about a way to add shourtcut where you want it.

##Download

https://code.visualstudio.com/Download

@disco0
disco0 / macmini 1,1 to 2,1 EFI firmware update.md
Last active January 29, 2025 06:02 — forked from dreamcat4/macmini 1,1 to 2,1 EFI firmware update
macmini 1,1 to 2,1 EFI firmware update

Mac Mini 1,1 to 2,1 Firmware Upgrade

  • NOTE: This is a markdown adaptation of the original forked gist, additional file in this gist is an adaptation of the original post.

Guide & Discussion Thread:

For the best guide, use search keyword: chmod. It should scroll down to:

@baruch
baruch / defer.h
Created May 27, 2018 19:09
Defer cleanup for C (gcc and llvm)
#define DEFER_MERGE(a,b) a##b
#define DEFER_VARNAME(a) DEFER_MERGE(defer_scopevar_, a)
#define DEFER_FUNCNAME(a) DEFER_MERGE(defer_scopefunc_, a)
#define DEFER(BLOCK) void DEFER_FUNCNAME(__LINE__)(int *a) BLOCK; __attribute__((cleanup(DEFER_FUNCNAME(__LINE__)))) int DEFER_VARNAME(__LINE__)
// Usage:
/*
void dosomething()
{
char* data = malloc(100);