Skip to content

Instantly share code, notes, and snippets.

@macshome
macshome / IOKit.swift
Last active April 27, 2024 08:09
This playground shows you a few different ways to get device info via IOKit.
// This playground shows you a few different ways to get device info via IOKit.
// If you want to explore IOKit and look for interesting data I would download
// the Additional Developer Tools from Apple and use the IORegistryExplorer app.
// It makes it super easy to poke around in the IOKit planes.
import IOKit
import Foundation
// For convient access we can make a computed getter for the PlatformExpert.
// Traditionally this has been where you go to find all sorts of data about the
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 27, 2024 08:10
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@yukiarimo
yukiarimo / gen_images.mjs
Created March 29, 2024 06:03 — forked from aku/gen_images.mjs
Generate images using Draw Things HTTP API
import { writeFile } from 'fs/promises'
const DRAW_THINGS_URL = 'http://127.0.0.1:7860/sdapi/v1/txt2img'
const BATCH_COUNT = 5
const IMG_SIZE = 512
const MAX_FILE_NAME_LEN = 30
const prompt = 'bunch of carrots'
const params = {
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active April 27, 2024 08:07
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@csarn
csarn / README.md
Last active April 27, 2024 08:04
ZFS pull backup with minimal permissions

Usage

on system that should be backed up

  • put "restrict_commands.sh" in /usr/local/bin and make it executable
  • install ts, lzop and optionally mbuffer
useradd zfsbackup --create-home --system
mkdir /home/zfsbackup/.ssh
zfs allow -u zfsbackup send,hold tank/dataset
echo 'restrict,command="restrict_commands.sh" ssh-ed25519 ...' > /home/zfsbackup/.ssh/authorized_keys
@chabala
chabala / using-google-takeout.md
Last active April 27, 2024 08:03
Merge and extract tgz files from Google Takeout

Recently found some clowny gist was the top result for 'google takeout multiple tgz', where it was using two bash scripts to extract all the tgz files and then merge them together. Don't do that. Use brace expansion, cat the TGZs, and extract:

$ cat takeout-20201023T123551Z-{001..011}.tgz | tar xzivf -

You don't even need to use brace expansion. Globbing will order the files numerically:

$ cat takeout-20201023T123551Z-*.tgz | tar xzivf -
@idelsink
idelsink / .clang-format
Created March 7, 2016 22:03
Clang format file.
# clang-format
# Made by: Ingmar Delsink
# idelsink.com
# See http://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Tested with: clang-format version 3.7.1
# General
#########
# The style used for all options not specifically set in the configuration.
@Nairit11
Nairit11 / Docker Cheat Sheet.md
Last active April 27, 2024 07:59
Cheat Sheet for Docker

DOCKER CHEAT SHEET

Run an Image

docker run image_name

To run a specific version use a tag. By default tag is 'latest'

docker run image_name:version