This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns datastructures.queue | |
(:refer-clojure :exclude [compare-and-set! pop]) | |
(:import java.util.concurrent.atomic.AtomicReference)) | |
(defn- compare-and-set! [^AtomicReference aref oldval newval] | |
(or (.compareAndSet aref oldval newval) | |
(throw (RuntimeException. ::loop)))) | |
(defmacro with-contention | |
[& body] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
// initialize the tape with 30,000 zeroes | |
unsigned char tape[30000] = {0}; | |
// set the pointer to point at the left-most cell of the tape | |
unsigned char* ptr = tape; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import thread | |
from time import sleep | |
items = [2, 4, 5, 2, 1, 7] | |
def sleep_sort(i): | |
sleep(i) | |
print i | |
[thread.start_new_thread(sleep_sort, (i,)) for i in items] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{marker::PhantomData, net::SocketAddr}; | |
use async_trait::async_trait; | |
use axum::{ | |
error_handling::HandleErrorLayer, | |
middleware::{self, Next}, | |
routing::get, | |
Router, | |
}; | |
use axum_core::{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import sys | |
import json | |
import argparse | |
from string import uppercase, digits, letters, punctuation | |
from random import SystemRandom | |
FULL_MAP = letters + digits + punctuation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo -e $(curl -s https://api.openai.com/v1/completions \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer $OPENAI_API_KEY" \ | |
-d '{"model": "text-davinci-003", "prompt": "Extract tags from the following text. Limit five tags. Output JSON.\\n\\nText: Folksonomy is a classification system in which end users apply public tags to online items, typically to make those items easier for themselves or others to find later. Over time, this can give rise to a classification system based on those tags and how often they are applied or searched for, in contrast to a taxonomic classification designed by the owners of the content and specified when it is published.[1][2] This practice is also known as collaborative tagging,[3][4] social classification, social indexing, and social tagging.\\n\\n<Output>", "temperature": 0, "max_tokens": 1000}' | jq .choices[0].text) | tr -d '\\' | sed -r 's/^"|"$//g' | jq .tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns merkle.tree | |
(:import [java.security MessageDigest])) | |
(defn sha-256-digest [bs] | |
(.digest | |
(doto (MessageDigest/getInstance "SHA-256") | |
(.update bs)))) | |
(def double-sha-256 (comp sha-256-digest sha-256-digest)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rauth import OAuth2Service | |
import re | |
import webbrowser | |
try: | |
read_input = raw_input | |
except NameError: | |
read_input = input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.docker.system-prune</string> | |
<key>Program</key> | |
<string>/usr/local/bin/docker</string> | |
<key>ProgramArguments</key> | |
<array> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set shell=/bin/bash | |
if &compatible | |
set nocompatible | |
endif | |
call plug#begin('~/.vim/plugged') | |
Plug 'airblade/vim-gitgutter' | |
Plug 'arcticicestudio/nord-vim' |
NewerOlder