Skip to content

Instantly share code, notes, and snippets.

@Maximus-
Maximus- / sendmsg_x.c
Last active March 23, 2024 04:59
Example of macOS sendmsg_x
// ./usr/include/sys/syscall.h:521:#define SYS_sendmsg_x 481
// ./kern/syscalls.master:751:480 AUE_NULL ALL { user_ssize_t recvmsg_x(int s, struct msghdr_x *msgp, u_int cnt, int flags); }
#include <sys/syscall.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
@euske
euske / openssh-is-written-by-monkeys.md
Last active January 13, 2023 05:35
OpenSSL はサルが書いたに決まってる (OpenSSL is written by monkeys, by Marco Peereboom)
@danisla
danisla / README.md
Last active November 7, 2022 13:59
GKE GPU Sharing Daemonset

GPU Sharing on GKE DaemonSet

NOTE: This is not a Google supported product.

Example Usage

  1. Create a GKE cluster with a GPU node pool:
gcloud container clusters create gpu-sharing-demo --zone us-central1-c
@ryu1kn
ryu1kn / README.md
Last active March 18, 2024 14:19
Getting GCP access token from a service account key JSON file

Getting GCP access token from a service account key

Use your service account's key JSON file to get an access token to call Google APIs.

Good for seeing how things work, including the creation of JWT token.

To create a JWT token, you can replace create-jwt-token.sh script with tools like step.

If you just want to get an access token for a service account,

@rdump
rdump / kubectl-multi-version-brews.md
Last active April 4, 2024 15:20
kubectl multi-version brews (kubernetes-cli formula)

kubectl multi-version brews

Applicability

The instructions below apply to older versions of Homebrew which still provide switch capability.

For current Homebrew, you'll likely need to keep Versions around, and build locally. Here's my versions repository https://github.com/rdump/homebrew-versions

MacPorts is now keeping versioned installations available as well, by default.

#!/bin/bash
# License of this script: CC0
# Installation of dependent libraries and softwares is required to use this script
# ex. nasm, yasm, libmp3lame-dev, libopus-dev, libvorbis-dev, libvpx-dev...
set -ex
# setup
temp_dir=$(mktemp -d)
@nico-lab
nico-lab / hevc_nvenc.txt
Last active April 15, 2024 11:29
ffmpeg -h encoder=hevc_nvenc
Encoder hevc_nvenc [NVIDIA NVENC hevc encoder]:
General capabilities: dr1 delay hardware
Threading capabilities: none
Supported hardware devices: cuda cuda d3d11va d3d11va
Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 bgra rgb0 rgba x2rgb10le x2bgr10le gbrp gbrp16le cuda d3d11
hevc_nvenc AVOptions:
-preset <int> E..V....... Set the encoding preset (from 0 to 18) (default p4)
default 0 E..V.......
slow 1 E..V....... hq 2 passes
medium 2 E..V....... hq 1 pass
@daz
daz / youtube-dl-to-mp3.sh
Last active June 26, 2022 22:00
youtube-dl pipe to ffmpeg for mp3 output one-liner
youtube-dl -f251 "[URL]" -o - | ffmpeg -i pipe: -strict -2 out.mp3
@daz
daz / generate-silence.sh
Created October 23, 2017 07:25
Generate a silent AAC audio with ffmpeg
ffmpeg -f lavfi -i anullsrc=r=11025:cl=mono -t <number of seconds> -acodec aac out.m4a
@bdelacretaz
bdelacretaz / fileopen.d
Created June 22, 2017 05:22
dtrace script to dump all file open calls for a specific process
#!/usr/sbin/dtrace -s
/* dump all "open" syscalls */
/* $1 is the PID to observe */
syscall::open:entry
/pid == $1/
{
printf("'%s' (PID: %d): syscall:open %s", execname, pid, copyinstr(arg0));
}