Skip to content

Instantly share code, notes, and snippets.

View nikolavojicic's full-sized avatar

Nikola Vojičić nikolavojicic

View GitHub Profile
(require 'url)
(require 'dom)
(defun download-sims-design-documents ()
(let ((url "https://donhopkins.com/home/TheSimsDesignDocuments/")
(dir "c:/Users/nikol/Documents/books/programming/TheSimsDesignDocuments/"))
(with-current-buffer (url-retrieve-synchronously url)
(goto-char (point-min))
(thread-last
(dom-by-tag (libxml-parse-html-region (point) (point-max)) 'a)
@nikolavojicic
nikolavojicic / text-acii-art-generator.txt
Last active February 2, 2025 17:41
Text Ascii Art Generator
https://patorjk.com/software/taag-v1/
- Standard
- JS Stick Letters
@nikolavojicic
nikolavojicic / latex_minted.md
Last active February 2, 2025 02:08
LaTeX Minted on Windows
  • Install Python: https://www.python.org/downloads/windows/
  • Add to Path system environment variable: C:\Users\<USER>\AppData\Local\Programs\Python\Python<VERSION>\Scripts
  • Run in CMD: pip install Pygments
  • Run in CMD: pip install latexminted
  • Be sure to run all MikTex updates
  • Be sure to use: \usepackage[highlightmode=immediate]{minted} (see: gpoore/minted#418 (comment))
  • Be sure to use flag: --shell-escape, e.g. pdflatex --shell-escape some-file.tex
(defn -map [f coll] ;; coll :(
(reduce
(fn [res elt]
(conj res (f elt))) ;; conj :(
[] coll))
(-map inc (range 10))
(defn -filter [f coll] ;; coll :(
(reduce
(def break (System/getProperty "line.separator"))
(def moves
{:p {:desc "PAPER" :beats :r}
:r {:desc "ROCK" :beats :s}
:s {:desc "SCISSORS" :beats :p}})
(defn vs [m1 m2]
class ClockDegree {
private static void assertValid(String n, double v) {
if (v < 1) throw new IllegalArgumentException(n + " < 1");
if (v > 12) throw new IllegalArgumentException(n + " > 12");
}
public static double degree(double h, double m) {
assertValid("h", h);
assertValid("m", m);
@nikolavojicic
nikolavojicic / ip.clj
Last active November 22, 2023 14:09
Get IP address and PID in Clojure
(defn ip []
(try
(-> (InetAddress/getLocalHost) (.getHostAddress))
(catch Throwable __
(->> (NetworkInterface/getNetworkInterfaces)
(enumeration-seq)
(xf/some
(comp (keep (fn [^NetworkInterface network]
(when (and (.isUp network)
(not (.isLoopback network)))
CREATE OR REPLACE FUNCTION fn_days_in_month (DATE) RETURNS SMALLINT
AS 'SELECT EXTRACT (DAYS FROM DATE_TRUNC (''month'', $1) + INTERVAL ''1 month - 1 day'')::SMALLINT;'
LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT;
CREATE OR REPLACE FUNCTION fn_days_in_quarter (DATE) RETURNS SMALLINT
AS 'SELECT ($1 - DATE_TRUNC (''quarter'', $1)::DATE + 1)::SMALLINT;'
LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT;
CREATE OR REPLACE FUNCTION fn_days_in_year (DATE) RETURNS SMALLINT
AS 'SELECT EXTRACT (DOY FROM DATE_TRUNC (''year'', $1) + INTERVAL ''1 year - 1 day'')::SMALLINT;'
https://fontsgeek.com/fonts/Monaco-Regular
Extract and run =.ttf= file