Skip to content

Instantly share code, notes, and snippets.

@saitoha
saitoha / suckless-st-sixel.diff
Last active May 14, 2024 06:08
Add SIXEL graphics support for suckless st. (sixel.c/sixel_hls.c come from mintty, licensed under GPL)
commit ea830e03d4d4562b1ff225940f65bceddd9cad6c
Author: Hayaki Saito <saitoha@me.com>
Date: Sun Jun 11 23:46:45 2017 +0900
Add sixel graphics support
Signed-off-by: Hayaki Saito <saitoha@me.com>
diff --git a/Makefile b/Makefile
index d8595fe..a25d040 100644
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active May 14, 2024 06:05
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@aishikaty
aishikaty / tiny-view-libraries.md
Last active May 14, 2024 06:03
Tiny JavaScript UI

☀️ UI Libraries

  • redom (1.6k) - Tiny turboboosted JavaScript library for creating user interfaces
  • frzr (1.6k) - Turboboosted 2 KB view library for browser & node.js
  • killroy (1.9k) - A tiny ui library inspired by React
  • real-dom (0.7k) - A ~1K non-virtual DOM non-framework framework for simple apps
  • domchanger (1.8k) - Dombuilder that applies diffs only to the real dom
  • vomit (3.2k) - A high order function using virtual dom to build user interfaces
  • bel (3.5k) - A simple library for composable DOM elements using tagged template strings
  • yo-yo (5.4k) - A tiny library for building modular UI components using DOM diffing and ES6 tagged template literals (build on bel)
  • [choo](https://github.com/yos
@venam
venam / pw-setvol.sh
Last active May 14, 2024 06:03
Set PipeWire volume natively on the default sink
#! /bin/sh
# the metadata only contains the name of the default sink
default_sink_name=$(pw-metadata 0 'default.audio.sink' | grep 'value' | sed "s/.* value:'//;s/' type:.*$//;" | jq .name)
default_sink_id=$(pw-dump Node Device | jq '.[].info.props|select(."node.name" == '" $default_sink_name "') | ."object.id"')
current_volume=$(pw-cli enum-params "$default_sink_id" 'Props' | grep -A 2 'Spa:Pod:Object:Param:Props:channelVolumes' | awk '/Float / {gsub(/.*Float\s/," "); print $1^(1/3) }')
change="${1:-0.1}" # defaults to increment of 0.1
new_volume=$(echo "$current_volume $change" | awk '{printf "%f", $1 + $2}')
# we need to reconvert to cubic root
#new_volume_cube=$(echo "$new_volume" | awk '{ print $1^3 }')

Working with EET Files

This is my edited version of Jeff Hoogland's original article on the eet command. It is posted here because it is hard to find online as the original link is now dead and not even found in the Wayback Machine.

One of the things that allow the Enlightenment Foundation Libraries to be as fast and efficient as they are in their use of compiled files for storing information. While these compiled files are fast, the drawback to using them is that there is some difficulty when you want to manually access/edit the data these files contain. Today I am going to talk about how we can gain access to the data contained in compiled Enlightenment Foundation Library EET data files.

EET files are binary data files that generally hold configuration options/settings for applications. To work with these files we will need acce

@sindresorhus
sindresorhus / esm-package.md
Last active May 14, 2024 06:01
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ryancdotorg
ryancdotorg / dnaas.c
Created October 30, 2013 23:20
Wrapper library to use /dev/null as a service on Linux via LD_PRELOAD
/* This is a wrapper library that will give your server the power of
* /dev/null as a service, as seen at http://devnull-as-a-service.com/
*
* Compile:
* gcc -ggdb -shared -fPIC dnaas.c -ldl -lcurl -o libdnaas.so
*
* Try:
* LD_PRELOAD=./libdnaas.so dd if=/dev/sda of=/dev/null bs=8192 count=16
*
* Install:
@kuroski
kuroski / camelCase-snake_case-types.ts
Last active May 14, 2024 05:56
Typescript type camelCase / snake_case conversion
type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}`
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
: Lowercase<S>
type KeysToCamelCase<T> = {
[K in keyof T as CamelCase<string & K>]: T[K]
}
type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ?
@ukyo
ukyo / README.md
Last active May 14, 2024 05:55
maincontent取るくん

Install and Build and Screenshot.

git clone https://gist.github.com/906764beb36481301405c586abd81011.git
cd 906764beb36481301405c586abd81011
npm install
npm run build
npm run screenshot https://gist.github.com/ukyo/906764beb36481301405c586abd81011
open out.html
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active May 14, 2024 05:48
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr