View Program.cs
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
// dotnet --version | |
// 7.0.100 | |
// dotnet restore | |
// dotnet run | |
// rlwrap nc localhost 5555 | |
using System; | |
using System.IO; | |
using System.Net; | |
using System.Net.Http; |
View find-or-create.sql
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
-- https://stackoverflow.com/a/70312948 | |
WITH | |
extant AS ( | |
SELECT id FROM access_code WHERE ("value") = ('asdf') | |
), | |
inserted AS ( | |
INSERT INTO access_code ("value") | |
SELECT 'asdf' | |
WHERE NOT EXISTS (SELECT FROM extant) |
View ec2-boot-bench.txt
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
# 12th July 2023 | |
# trying out https://www.daemonology.net/blog/2021-08-12-EC2-boot-time-benchmarking.html | |
cloudshell-user@ip-10-2-80-7 infra]$ history | |
1 git clone https://github.com/cperciva/ec2-boot-bench | |
2 cd ~/ec2-boot-bench/ | |
3 ls | |
4 cat BUILDING | |
5 ./configure |
View user.clj
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
;; org.clojure/clojure {:mvn/version "1.11.1"} | |
;; com.github.librepdf/openpdf {:mvn/version "1.3.30"} | |
(import 'com.lowagie.text.Document) | |
(import 'com.lowagie.text.Image) | |
(import 'com.lowagie.text.PageSize) | |
(import 'com.lowagie.text.pdf.PdfWriter) | |
(def doc (new Document)) | |
(def os (io/output-stream "output.pdf")) |
View scatterplot.clj
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
;; clj -Sdeps '{:deps {org.apache.poi/poi {:mvn/version "4.1.1"} org.apache.poi/poi-ooxml {:mvn/version "4.1.1"}}}' | |
;; based on https://stackoverflow.com/questions/59061235/apache-poi-manage-scatter-chart | |
(ns user | |
(:import [org.apache.poi.xssf.usermodel XSSFWorkbook] | |
[org.apache.poi.ss.util CellRangeAddress] | |
[org.apache.poi.xddf.usermodel.chart XDDFDataSourcesFactory ChartTypes AxisCrosses AxisPosition MarkerStyle] | |
[org.apache.poi.ss.usermodel.charts LegendPosition] | |
[java.io FileOutputStream])) |
View move-namespace.clj
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
(binding [*ns* (find-ns 'some.other.namespace)] | |
(with-open [config (java.io.PushbackReader. (java.io.FileReader. "config.clj"))] | |
(loop [] | |
(when-let [form (read {:eof nil} config)] | |
(do (eval form) (recur)))))) | |
;; see also https://gist.github.com/vkz/4c32cdff75ba7254ed0c |
View user.clj
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
;; Deep Learning Base AMI (Amazon Linux 2) Version 22.0 (ami-0c9d86eac25c03fea) | |
;; p2.xlarge | |
;; $ nvidia-smi --list-gpus | |
;; GPU 0: Tesla K80 (UUID: GPU-3e0d6827-3d8e-5a5f-85d6-114d950f6d44) | |
;; | |
;; $ cat /etc/os-release | |
;; NAME="Amazon Linux" | |
;; VERSION="2" | |
;; ID="amzn" | |
;; ID_LIKE="centos rhel fedora" |
View microphone.clj
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 | |
[javax.sound.sampled TargetDataLine AudioFormat AudioSystem AudioInputStream AudioFileFormat$Type DataLine$Info] | |
[java.io File ByteArrayInputStream]) | |
(def audio-format (new AudioFormat 44100 16 2 true true)) | |
(def info (new DataLine$Info TargetDataLine audio-format)) | |
(assert (AudioSystem/isLineSupported info)) | |
(def line (AudioSystem/getTargetDataLine audio-format)) | |
(.open line) | |
(.start line) |
View basic-producer-consumer.py
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
# In this program there is a queue implemented as a list protected by a | |
# mutex so that the producer can run on one thread and the consumer can | |
# run on another thread. The dequeue_all method will return an empty list | |
# if there is no work (it does not block its caller). | |
from random import random | |
from random import shuffle | |
from time import sleep | |
from threading import Lock | |
from _thread import start_new_thread |
View Makefile
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
PACKAGE = cmdline-jmxclient | |
PACKAGE_VERSION = 0.10.3 | |
JAR = $(PACKAGE)-$(PACKAGE_VERSION).jar | |
EXTRA_DIST = Makefile | |
RPM_TOPDIR := $(HOME)/rpmbuild | |
$(JAR): | |
curl -s -o $(JAR) http://crawler.archive.org/cmdline-jmxclient/$(JAR) |
NewerOlder