Skip to content

Instantly share code, notes, and snippets.

View khushmeeet's full-sized avatar
🖥️
Software Engineer at Apple

Khushmeet Singh khushmeeet

🖥️
Software Engineer at Apple
View GitHub Profile
@isaacs
isaacs / comma-first-var.js
Created April 6, 2010 19:24
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@nitaku
nitaku / README.md
Last active July 3, 2024 19:37
Minimal JSON HTTP server in python

A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.

python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
@staltz
staltz / introrx.md
Last active July 27, 2024 04:59
The introduction to Reactive Programming you've been missing
@alphacentory
alphacentory / setup.sh
Last active January 14, 2017 20:53
go api bash script set up
#!/bin/bash
cd ${HOME}
if [[ $unamestr == "Darwin" ]]; then
echo "installing... homebrew..."
if ! which brew > /dev/null; then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo "installing... git... go..."
brew install git go
fi
@journeymanavi
journeymanavi / production-web-server-setup-and-deployment-guide.md
Last active July 14, 2024 20:49
A runbook for setting up a Linux based secure, production web server, for serving static web content as well as deploying Node.js based web applications.
@simonw
simonw / crontab.txt
Created September 10, 2020 16:09
Dogsheep crontab.txt as of 10th September 2020
# Fetch latest configuration:
*/5 * * * * cd /home/ubuntu/dogsheep-config && python3 git_pull_and_run_scripts.py . && sudo python3 ensure_symlinks.py files-to-symlink
# Goodreads
46 * * * * cd /home/ubuntu && /home/ubuntu/datasette-venv/bin/goodreads-to-sqlite books goodreads.db -a auth.json
# Twitter
1,11,21,31,41,51 * * * * /home/ubuntu/datasette-venv/bin/twitter-to-sqlite user-timeline /home/ubuntu/twitter.db -a /home/ubuntu/auth.json --since
2,7,12,17,22,27,32,37,42,47,52,57 * * * * run-one /home/ubuntu/datasette-venv/bin/twitter-to-sqlite home-timeline /home/ubuntu/timeline.db -a /home/ubuntu/auth.json --since
4,14,24,34,44,54 * * * * run-one /home/ubuntu/datasette-venv/bin/twitter-to-sqlite mentions-timeline /home/ubuntu/twitter.db -a /home/ubuntu/auth.json --since
@jsomers
jsomers / brahe.html
Last active August 16, 2023 06:54
Dynamically created sky map using Fourmilab's Your Sky
<script>
var toUrlParam = function(date) {
return date.toISOString().split("T")[0].replaceAll("-", "%2F");
}
// https://stackoverflow.com/questions/563406/add-days-to-javascript-date
Date.prototype.addDays = function(days) {
var date = new Date(this.valueOf());
date.setDate(date.getDate() + days);
return date;
@p4bl0-
p4bl0- / 00_readme.md
Last active October 12, 2023 09:09
A complete compiler for a simple language (in less than 150 LoC)

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"

@sebastiancarlos
sebastiancarlos / bible.json
Created August 22, 2022 16:39
New Revised Standard Version Updated Edition (NRSVUE) of the Bible in JSON
This file has been truncated, but you can view the full file.
{
"Old Testament": {
"Genesis": {
"1": {
"1": "¹ When God began to create the heavens and the earth, ",
"2": "² the earth was complete chaos, and darkness covered the face of the deep, while a wind from God swept over the face of the waters. ",
"3": "³ Then God said, “Let there be light,” and there was light. ",
"4": "⁴ And God saw that the light was good, and God separated the light from the darkness. ",
"5": "⁵ God called the light Day, and the darkness he called Night. And there was evening and there was morning, the first day. \n",
"6": "⁶ And God said, “Let there be a dome in the midst of the waters, and let it separate the waters from the waters.” ",
@foeken
foeken / openai-replace.js
Created November 28, 2022 15:24
ScriptKit OpenAI script for Tana
// Name: OpenAI Replace
// Description: Replace using Open AI's API
// Shortcut: cmd ctrl s
import "@johnlindquist/kit"
let { Configuration, OpenAIApi } = await npm("openai")
let configuration = new Configuration({
apiKey: await env("OPENAI_API_KEY"),