Skip to content

Instantly share code, notes, and snippets.

View ttys3's full-sized avatar
💭
sad, ttyS0 has been taken by other user

ttys3

💭
sad, ttyS0 has been taken by other user
View GitHub Profile
@ttys3
ttys3 / ffmpeg_example.rs
Created September 25, 2022 10:02 — forked from yongkyuns/ffmpeg_example.rs
FFMPEG usage in rust using command and raw pixels
use std::io::prelude::*;
use std::process::{Command, Stdio};
fn main() {
let mut child = Command::new("ffmpeg")
// Overwrite file if it already exists
.arg("-y")
// Interpret the information from stdin as "raw video" ...
.arg("-f")
.arg("rawvideo")
@ttys3
ttys3 / mpv-gnome-inhibit.lua
Created May 8, 2022 04:14 — forked from crazygolem/mpv-gnome-inhibit.lua
Prevent the screen from blanking under GNOME+Wayland while a video is playing
--[[
Prevent the screen from blanking while a video is playing.
This script is a workaround for the GNOME+Wayland issue documented in the
[Disabling Screensaver] section of the mpv manual, and depends on
gnome-session-inhibit (usually provided by the gnome-session package) to set up
the inhibitors.
@ttys3
ttys3 / fstab-generate-arch.md
Created April 6, 2022 09:37 — forked from Brainiarc7/fstab-generate-arch.md
Generate fstab in Arch Linux

First, install arch-install-scripts:

sudo pacman -S --needed arch-install-scripts

Secondly, mount your partitions in all the internal hard drives.

Thirdly, generate and validate your config by piping it out to stdout:

@ttys3
ttys3 / keyboard-keys.md
Created March 4, 2022 12:37 — forked from bittner/keyboard-keys.md
Keyboard keys markup in MarkDown

Ctrl + Alt + Space

@ttys3
ttys3 / eatmem.c
Last active February 4, 2022 04:26 — forked from pfigue/eatmem.c
Eat Memory. In C. For testing memory limits.
// Compile with e.g. `gcc -o /tmp/eatmem /tmp/eatmem.c`
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define DEFAULT_SLEEP_SECONDS 600
#define DEFAULT_ALLOC_MB 1024
@ttys3
ttys3 / latency.markdown
Created December 15, 2021 12:48 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@ttys3
ttys3 / curl_post_json.md
Created October 6, 2021 23:20 — forked from ungoldman/curl_post_json.md
post a JSON file with curl

How do you POST a JSON file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

@ttys3
ttys3 / pacman.md
Last active September 26, 2021 14:37 — forked from tanyuan/pacman.md
Useful commands for pacman and paru

Arch Linux Pacman & Paru (Feature packed AUR helper)

Pacman (Official)

Easter egg

Edit /etc/pacman.conf:

Under the # Misc options section, remove the # in front of Color and add the line ILoveCandy. Because Pac-Man loves candy.

@ttys3
ttys3 / dockergrep.sh
Created September 22, 2021 18:01 — forked from roylee0704/dockergrep.sh
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container