Skip to content

Instantly share code, notes, and snippets.

# install docker
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
if [ ! $(getent group docker) ];
then
sudo groupadd docker;
else
echo "docker user group already exists"
fi
@StephenCleary
StephenCleary / ObservableProgress.cs
Last active April 16, 2024 11:22
ObservableProgress
using System;
using System.Reactive.Linq;
using System.Threading;
/// <summary>
/// Helper methods for using observable <see cref="IProgress{T}"/> implementations. These are hot observables.
/// </summary>
public static class ObservableProgress
{
/// <summary>
@erlend
erlend / inx.sh
Created September 3, 2023 21:09
Script for running GUI applications in Docker or OrbStack with XQuartz
#!/bin/sh
cmd=$*
authorize() {
for host
do xhost | egrep -q "^INET6?:$host$" || xhost + $host
done
}
@NeatMonster
NeatMonster / README.md
Last active April 16, 2024 11:19
A simple hexdump module for Python

Simple Hexdump

A simple hexdump module for Python.

Installation

The preferred installation method is:

pip install simple-hexdump
@rygorous
rygorous / gist:2156668
Last active April 16, 2024 11:18
float->half variants
// float->half variants.
// by Fabian "ryg" Giesen.
//
// I hereby place this code in the public domain, as per the terms of the
// CC0 license:
//
// https://creativecommons.org/publicdomain/zero/1.0/
//
// float_to_half_full: This is basically the ISPC stdlib code, except
// I preserve the sign of NaNs (any good reason not to?)
@joseluisq
joseluisq / resize_disk_image.md
Last active April 16, 2024 11:18
How to resize a qcow2 disk image on Linux

How to resize a qcow2 disk image on Linux

This example takes olddisk.qcow2 and resizes it into newdisk.qcow2, extending one of the guest's partitions to fill the extra space.

1. qcow2 format

1.1. Verify the filesystems of olddisk.qcow2

@7aman
7aman / sqlite3-in-python.py
Created January 21, 2019 07:29
sqlite3 cheatsheet for python 3
#!/usr/bin/env python3
'''
Thanks to Andres Torres
Source: https://www.pythoncentral.io/introduction-to-sqlite-in-python/
'''
import sqlite3
# Create a database in RAM
@ryo-ARAKI
ryo-ARAKI / starship.toml
Last active April 16, 2024 11:16
Starship configuration file
# ~/.config/starship.toml
[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = ""
[[battery.display]]
threshold = 30
style = "bold red"
@codemzy
codemzy / useDelay.js
Created February 25, 2021 11:03
React useDelay hook - to avoid flash of loading content
import React from "react";
// delay a state change (used for loading or waiting for async to avoid flash of loading state)
export default function useDelay(initial, { delay = 300, delayedValue = true, minDuration = 700 }) {
const [state, setState] = React.useState(initial);
const [change, setChange] = React.useState(initial);
const end = React.useRef(0);
React.useEffect(() => {
let timer;
@mkarneim
mkarneim / CustomUberPost.shader
Created August 4, 2023 12:26
UberPost.shader that also works together with Oculus Quest Passthrough mode
Shader "CustomUberPost" // "Hidden/Universal Render Pipeline/UberPost"
{
HLSLINCLUDE
#pragma exclude_renderers gles
#pragma multi_compile_local_fragment _ _DISTORTION
#pragma multi_compile_local_fragment _ _CHROMATIC_ABERRATION
#pragma multi_compile_local_fragment _ _BLOOM_LQ _BLOOM_HQ _BLOOM_LQ_DIRT _BLOOM_HQ_DIRT
#pragma multi_compile_local_fragment _ _HDR_GRADING _TONEMAP_ACES _TONEMAP_NEUTRAL
#pragma multi_compile_local_fragment _ _FILM_GRAIN
#pragma multi_compile_local_fragment _ _DITHERING