Skip to content

Instantly share code, notes, and snippets.

View wout's full-sized avatar
🕳️

Wout wout

🕳️
View GitHub Profile
@mattiaz9
mattiaz9 / blurhashDataURL.ts
Last active April 12, 2024 13:14
Convert blurhash to a base64 DataURL string (no canvas or node-canvas)
import { decode } from "blurhash"
export function blurHashToDataURL(hash: string | undefined): string | undefined {
if (!hash) return undefined
const pixels = decode(hash, 32, 32)
const dataURL = parsePixels(pixels, 32, 32)
return dataURL
}
@andrebrait
andrebrait / keychron_linux.md
Last active April 23, 2024 19:51
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@vuongpd95
vuongpd95 / rails-docker-compose.md
Created September 27, 2020 13:53
docker-compose for Rails application on Local
# docker/webapp/Dockerfile
FROM ruby:2.6.6

SHELL ["/bin/bash", "-c"]
RUN apt-get update -qq && apt-get install -y postgresql-client memcached tzdata nano
# Install node 12, yarn
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
@fernandes
fernandes / Dockerfile
Last active June 20, 2020 06:16
Docker multi stage build for Lucky Framework app
FROM crystallang/crystal:0.34.0-alpine-build AS build-env
ARG LUCKY_ROOT=/app
ARG DEV_PACKAGES="nodejs yarn"
ENV LUCKY_ENV=production
ENV NODE_ENV=production
WORKDIR $LUCKY_ROOT
# install packages
RUN apk update \
@stephendolan
stephendolan / lucky_spec_action.yml
Last active April 27, 2020 21:48
GitHub Action - Lucky Setup and Spec
name: Lucky Build and Spec CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
@julienma
julienma / README.md
Last active November 10, 2021 13:04
How to install Discourse 2.4+ on Dokku (2019)
@artizirk
artizirk / gnupg_scdaemon.md
Last active April 3, 2024 14:49
OpenPGP SSH access with Yubikey and GnuPG

NB: This document describles a 'Old-School' way of using Yubikey with SSH

Modern OpenSSH has native support for FIDO Authentication. Its much simpler and should also be more stable with less moving parts. OpenSSH also now has support for signing arbitary files witch can be used as replacement of gnupg. Git also supports signing commits/tags with ssh keys.

Pros of FIDO

  • Simpler stack / less moving parts
  • Works directly with ssh, ssh-add and ssh-keygen on most computers
  • Simpler
  • Private key can never leave the FIDO device

Cons of FIDO

@mehdi-farsi
mehdi-farsi / rails_project_loc.rb
Last active February 9, 2024 07:13
Count the lines of code of a rails project - in pure Ruby
# Workflow:
#
# 1- if the path points to a directory
# 1.1- if the directory isn't in the exclusion list then: count LOC
# 1.2- else: prune directory
# 2- else
# 1.1- if the file extension is whitelisted then: count LOC
# 1.2- else: next
require 'find'
@mstruve
mstruve / redis.rb
Created November 16, 2018 19:48
Redis Readonly Console
if ENV['REDIS_ACCESS_MODE'] == 'readonly'
class Redis
class Client
WRITE_COMMANDS = ::Rails.cache.data.command.map { |a| a[0] if a[2].include?('write') }.compact.to_set.freeze
def process(commands)
if commands.flatten.any? { |c| WRITE_COMMANDS.include?(c.to_s) }
raise NotImplementedError, "REDIS_ACCESS_MODE is set to 'readonly', disallowing writes"
end
@mightybyte
mightybyte / haskell-language-extensions.md
Last active August 31, 2023 07:50
A Taxonomy of Haskell Language Extensions

Haskell Language Extension Taxonomy

Caveat: It's just personal opinion, and was written to be a bit provocative and encourage discussion . It is also something that is constantly evolving. Some of the main criteria I used in constructing this taxonomy are age, how widely used it us, and how well understood it is by the average Haskell programmer. These things will change over time.

Aso, this is focused on appropriateness for use in commercial production code bases. If you are not thinking about commercial use with a team of multiple