Skip to content

Instantly share code, notes, and snippets.

View Vicfred's full-sized avatar
:octocat:
I like mathemagic and computering

Vicfred Vicfred

:octocat:
I like mathemagic and computering
View GitHub Profile
@Vicfred
Vicfred / normcore-llm.md
Created September 7, 2023 05:29 — forked from veekaybee/normcore-llm.md
Normcore LLM Reads
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@Vicfred
Vicfred / .XCompose
Created July 27, 2021 18:52 — forked from m93a/.XCompose
Math symbols for the compose key
# Math
<Multi_key> <A> <A> : "∀"
<Multi_key> <E> <E> : "∃"
<Multi_key> <exclam> <E> <E> : "∄"
<Multi_key> <minus> <0> : "−"
<Multi_key> <KP_Subtract> <KP_0> : "−"
<Multi_key> <asterisk> <1> : "⋅"
<Multi_key> <KP_Multiply> <KP_1> : "⋅"
@Vicfred
Vicfred / gen.cpp
Created September 10, 2020 08:52 — forked from MiSawa/gen.cpp
Exponential instance for a wrong implementation of Dinic
#include <iostream>
#include <vector>
#include <tuple>
#include <array>
// s u - u - u - u
// | > a < X X X > c - t
// b v - v - v - v
@Vicfred
Vicfred / ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
Created July 16, 2020 00:44 — forked from Brainiarc7/ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
ffmpeg livestreaming to youtube via Nvidia's NVENC and Intel's VAAPI on supported hardware

Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:

Considerations to take when live streaming:

The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:

  1. Set the buffer size (-bufsize:v) equal to the target bitrate (-b:v). You want to ensure that you're encoding in CBR mode.

  2. Set up the encoders as shown:

@Vicfred
Vicfred / dinic.cpp
Created June 8, 2020 10:32 — forked from Chillee/dinic.cpp
Max Flow (Dinic's, HLPP)
template <int MAXV, class T = int> struct Dinic {
const static bool SCALING = false; // non-scaling = V^2E, Scaling=VElog(U) with higher constant
int lim = 1;
const T INF = numeric_limits<T>::max();
struct edge {
int to, rev;
T cap, flow;
};
int s = MAXV - 2, t = MAXV - 1;
@Vicfred
Vicfred / ffmpeg.md
Created March 3, 2020 02:38 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@Vicfred
Vicfred / mkv embed soft subtitles
Created March 2, 2020 07:04 — forked from kurlov/mkv embed soft subtitles
ffmpeg command to add .srt based subtitles to an .mkv file
ffmpeg -i in.mkv -f srt -i in.srt -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s srt out.mkv
@Vicfred
Vicfred / wallpaper-changer
Created December 26, 2019 02:35 — forked from daniel-j/wallpaper-changer
This is a simple random wallpaper changer to use with Awesome WM. You need to install feh to use this.
#!/bin/bash
#
# Created by djazz // Dangershy
# Dependencies: feh
#
FOLDER="~/Pictures/wallpapers"
DELAY=10
# to make it loop over lines instead of spaces in filenames
@Vicfred
Vicfred / ‎rsync_tutorial‎.md
Created December 26, 2019 02:35 — forked from ilyar/ ‎rsync_tutorial‎.md
rsync tutorial‎

How rsync works

(source: https://sites.google.com/site/rsync2u/home/rsync-tutorial/how-rsync-works3)

~/demo1$rsync is efficient. The first time rsync is run, destination is created and the full source is copied to destination. Thereafter, only changes in source are copied to destination. If the --link-dest option is used, unchanged files are hard linked to the previous backup.

A hard link is a pointer to a file. Hard links have the advantage of using very little memory. There is an illustrated explanation of hard links on http://blog.interlinked.org/tutorials/rsync_time_machine.html > scroll down to “Hard-Links”.

Here is how the "rsync --link-dest=DIR" algorithm creates files in destination:

if destination does not exists,