Skip to content

Instantly share code, notes, and snippets.

@Dan-Q
Dan-Q / _no_code_page_.php
Last active October 12, 2024 16:49
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@d3v3l0
d3v3l0 / draw-patterns.c
Created December 3, 2021 23:06 — forked from dougallj/draw-patterns.c
All distinct 4x4 patterns
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#define WIDTH_IN_BLOCKS 29
#define HEIGHT_IN_BLOCKS 28
#define PADDING 4
#define BLOCK_WIDTH (4 * 4)
#define BLOCK_HEIGHT (4 * 4)
@karthink
karthink / fast-latex-input.el
Last active November 14, 2025 04:26
Configuration for super-fast Latex input using AucTeX, CDLatex and a bit of YaSnippet. See https://karthinks.com/software/latex-input-for-impatient-scholars
;; This elisp code uses use-package, a macro to simplify configuration. It will
;; install it if it's not available, so please edit the following code as
;; appropriate before running it.
;; Note that this file does not define any auto-expanding YaSnippets.
;; Install use-package
(package-install 'use-package)
;; AucTeX settings - almost no changes
// using scala 3.0.2
// using lib org.apache.spark:spark-sql_2.13:3.2.0
// using repository https://wip-repos.s3.eu-central-1.amazonaws.com/.release
// using lib io.github.vincenzobaz::spark-scala3:0.1.3-new-spark
import scala3encoders.given
import org.apache.spark.sql.Dataset
import org.apache.spark.sql.SparkSession
use std::{
fs::File,
io::{Read, Write},
time::Instant,
};
use tokio::task::{self, JoinHandle};
async fn compute() {
let handles: Vec<JoinHandle<_>> = (0..1000)
.map(|_| {
@llacom
llacom / babashka-connect.el
Created February 4, 2021 09:49
emacs/cider commands to spawn a babashka repl and connect to it
(defun my-babashka-connect--process-filter (proc string)
"Run cider-connect once babashka nrepl server is ready."
(when (string-match "Started nREPL server at .+:\\([0-9]+\\)" string)
(cider-connect-clj (list :host "localhost" :port (match-string 1 string))))
;; Default behavior: write to process buffer
(internal-default-process-filter proc string))
(defun my-babashka-connect ()
"Start babashka on a random port."
(interactive)
# IDA (disassembler) and Hex-Rays (decompiler) plugin for Apple AMX
#
# WIP research. (This was edited to add more info after someone posted it to
# Hacker News. Click "Revisions" to see full changes.)
#
# Copyright (c) 2020 dougallj
# Based on Python port of VMX intrinsics plugin:
# Copyright (c) 2019 w4kfu - Synacktiv
@borkdude
borkdude / repl.clj
Last active March 4, 2021 22:44
REPL session of babashka and sci internals @ London Clojurians December 2020
(ns ldnclj.repl
(:require [babashka.main :as bb]
[cheshire.core :as json]
[edamame.core :as e]
[sci.core :as sci]
[sci.impl.analyzer :as ana]
[sci.impl.interop :as interop]
[sci.impl.interpreter :as i]
[sci.impl.parser :as p]))
@digikar99
digikar99 / lisp-resources-digikar-2020.md
Last active January 29, 2025 06:24
If programming is more than just a means of getting things done for you, then Common Lisp is for you!
@digikar99
digikar99 / learn-from-lisp.md
Last active January 18, 2023 03:12
This article is in response to Emmet Boudreau’s article ‘Should We be Using Lisp for Data-Science’ published on Medium

Lisp may not be the best language for Data Science, but what can we still learn from it?

This article is in response to Emmet Boudreau’s article ‘Should We be Using Lisp for Data-Science’.

Below, unless otherwise stated, lisp refers to Common Lisp; in general, lisp refers to the lisp family of languages, just like the C-family of languages. There are functional lisps like Clojure and Scheme, and there are general purpose lisps such as Common Lisp and Racket.

The primary hurdle to using Lisp for Data Science, I believe, is the non-infix syntax common in mathematics.

But, is there anything to learn from its syntax?