Skip to content

Instantly share code, notes, and snippets.

View Ciantic's full-sized avatar

Jari Pennanen Ciantic

View GitHub Profile
import {extname} from 'path'
import {build, stop} from 'esbuild'
import {solidPlugin} from 'esbuild-plugin-solid'
import {denoPlugin} from 'esbuild_deno_loader'
const [input] = Deno.args
const ext = extname(input)
const compileOutput = input.replace(ext, '.compiled.js')
const bundleOutput = input.replace(ext, '.bundle.js')
// Please find the full, tested version in
// https://github.com/influxdata/influxdb_iox/blob/fe155e15fb2ad166aee66b0458e63c24a8128dd4/query/src/exec/task.rs#L101-L118
pub struct DedicatedExecutor {
state: Arc<Mutex<State>>,
}
/// Runs futures (and any `tasks` that are `tokio::task::spawned` by
/// them) on a separate Tokio Executor
struct State {
@pirate
pirate / request_logging_with_filenames.js
Created March 12, 2021 01:40
Show filename:lineno for every log message in node. Log the time, origin ip, method, and url for every express.js request.
// patch console.log to show filename and line number for every logged message
//
// ./src/index.js:68:9 √ Connected to Sentry
// ./src/index.js:72:9 √ Connected to Stripe
// ./src/index.js:82:9 √ Connected to Backblaze
// ./src/index.js:99:9 √ Connected to FireBase
// ./src/routes/paypal.js:68:17 Error: Request failed with status code 401
// at createError (./node_modules/axios/lib/core/createError.js:16:15)
// at settle (./node_modules/axios/lib/core/settle.js:17:12)
// at IncomingMessage.handleStreamEnd (./node_modules/axios/lib/adapters/http.js:236:11)
@graninas
graninas / What_killed_Haskell_could_kill_Rust.md
Last active March 18, 2024 14:57
What killed Haskell, could kill Rust, too

At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.


What killed Haskell, could kill Rust, too

What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.

Is Haskell dead?

@Ciantic
Ciantic / cloudflare-dyndns-a-aaaa-record-update.sh
Last active April 27, 2024 13:03
cloudflare dyndns script / update a A and AAAA record using bash script
#!/bin/bash
# Author: Jari Pennanen
# Url: https://gist.github.com/Ciantic/4e543f2d878a87a38c25032d5c727bf2
AUTH_EMAIL="john.doe@example.com" # Your Cloudflare email
AUTH_KEY="" # Get this from My profile -> API Keys -> View
DOMAIN="example.com" # main domain
SUBDOMAIN="home.example.com" # set A and AAAA-record of this subdomain
@jakub-g
jakub-g / async-defer-module.md
Last active April 12, 2024 07:32
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@Pindar
Pindar / README.md
Last active February 13, 2023 21:23 — forked from mill1000/README.md
Headless A2DP Audio Streaming on Raspbian Stretch

About

This gist will show how to setup Raspbian Stretch as a headless Bluetooth A2DP audio sink. This will allow your phone, laptop or other Bluetooth device to play audio wirelessly through a Rasperry Pi.

Motivation

A quick search will turn up a plethora of tutorials on setting up A2DP on the Raspberry Pi. However, I felt this gist was necessary because this solution is:

  • Automatic & Headless - Once setup, the system is entirely automatic. No user iteration is required to pair, connect or start playback. Therefore the Raspberry Pi can be run headless.
  • Simple - This solution has few dependencies, readily available packages and minimal configuration.
  • Up to date

Prerequisites

@davejm
davejm / latex-short-captions.lua
Created April 26, 2018 12:08 — forked from tarleb/latex-short-captions.lua
Filter to turn figure titles into short captions in LaTeX
-- don't do anything unless we target latex
if FORMAT ~= "latex" then
return {}
end
local List = require'pandoc.List'
local function latex(str)
return List:new{pandoc.RawInline('latex', str)}
end
@lucien144
lucien144 / reports.sh
Created June 6, 2017 08:29
GoAccess monthly reports with summary report
#!/bin/bash
START=$SECONDS
FILES=/var/www/vhosts/site.com/logs/access-2*.log
# Generate summary
goaccess /var/www/vhosts/site.com/logs/access.log --geoip-database /var/www/vhosts/site.com/logs/GeoIP.dat -o /var/www/vhosts/site.com/web/web/reports/summary.html
# Generate monthly reports
# -> Split logs
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###