Skip to content

Instantly share code, notes, and snippets.

View jasalt's full-sized avatar

Jarkko Saltiola jasalt

View GitHub Profile
@jarppe
jarppe / proxy_byte_channels_example.clj
Created June 16, 2024 12:17
Converting Channel to Java InputStream and OutputStream using proxies
(ns proxy-byte-channels-example
(:import (java.io InputStream
OutputStream)
(java.nio ByteBuffer)
(java.net UnixDomainSocketAddress
StandardProtocolFamily)
(java.nio.channels ByteChannel
SocketChannel)
(java.nio.charset StandardCharsets)))
@jasalt
jasalt / thinkfan.conf
Last active November 26, 2023 15:30
Fan profile (/etc/thinkfan.conf) for keeping Skylake Thinkpads silent at work
# This fan config helps to keep Thinkpad silent at work
# With it eg. 200$ second-hand 2-core Skylake laptop T460 and onwards can encode 1440p 30fps h264/h265 with
# Intel QuickSync HW encoder via proprietary VA-API driver https://wiki.debian.org/HardwareVideoAcceleration,
# silently, and stream it via OBS (RTMP/SRT/NDI..) etc..
# To use this fan config on a single-fanned Thinkpad with Debian and systemd, run:
# sudo apt install thinkfan
# sudo echo "options thinkpad_acpi fan_control=1" > /etc/modprobe.d/thinkpad_acpi.conf
@ssrihari
ssrihari / clojure-learning-list.md
Last active August 9, 2024 17:22
An opinionated list of excellent Clojure learning materials

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language
@prestancedesign
prestancedesign / web.clj
Last active August 5, 2024 16:45
Ring session authentication with Reitit
(ns authexample.web
(:gen-class)
(:require [buddy.auth :refer [authenticated? throw-unauthorized]]
[buddy.auth.backends.session :refer [session-backend]]
[buddy.auth.middleware :refer [wrap-authentication wrap-authorization]]
[clojure.java.io :as io]
[compojure.response :refer [render]]
[reitit.ring :as ring]
[ring.adapter.jetty :as jetty]
[ring.middleware.params :refer [wrap-params]]
@jenswittmann
jenswittmann / functions.php
Last active July 3, 2024 18:10
Timber embed SVG Plugin for WordPress
/**
* embed SVG
* Example: <span>{{ "logo"|svg }}</span>
*
* @param \Twig\Environment $twig The Twig environment.
* @return \Twig\Environment
*/
function twig_svg_embed($twig)
{
$twig->addFilter(
@kissgyorgy
kissgyorgy / listen.py
Created September 4, 2020 16:37
How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio
import asyncio
import psycopg2
# dbname should be the same for the notifying process
conn = psycopg2.connect(host="localhost", dbname="example", user="example", password="example")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = conn.cursor()
cursor.execute(f"LISTEN match_updates;")
@X-Raym
X-Raym / DaVinci Resolve Scripting Doc.txt
Last active August 15, 2024 23:45
DaVinci Resolve Scripting API Doc v19 beta 5
Last Updated: 11 July 2024
----------------------------
In this package, you will find a brief introduction to the Scripting API for DaVinci Resolve Studio. Apart from this README.txt file, this package contains folders containing the basic import
modules for scripting access (DaVinciResolve.py) and some representative examples.
From v16.2.0 onwards, the nodeIndex parameters accepted by SetLUT() and SetCDL() are 1-based instead of 0-based, i.e. 1 <= nodeIndex <= total number of nodes.
Overview
--------
As with Blackmagic Fusion scripts, user scripts written in Lua and Python programming languages are supported. By default, scripts can be invoked from the Console window in the Fusion page,
@justinmklam
justinmklam / flask-port80-without-sudo.md
Last active June 21, 2024 19:59
Run a flask app on port 80 without sudo.

Flask apps are bound to port 5000 by default. To bind it to port 80, you would need to change the port as follows:

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=80, debug=True)

And to run it:

@GuiSim
GuiSim / Traktor Kontrol S4 MIDI input port 0.djayMidiMapping
Created June 12, 2017 07:51
Traktor S4 configuration file for DJay Pro
<?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>controls</key>
<array>
<dict>
<key>controlType</key>
<string>button</string>
<key>keyPath</key>