Skip to content

Instantly share code, notes, and snippets.

@v-fox
v-fox / NVMe_tweaks.md
Last active April 25, 2024 15:09
Linux kernel optimizations for NVMe

By default Linux distros are unoptimized in terms of I/O latency. So, here are some tips to improve that.

The performance can be checked by:

  • fio --name=read --readonly --rw={read/randread} --ioengine=libaio --iodepth={jobs_per_each_worker's_command} --bs={4k/2M} --direct={0/1} --numjobs=<number_of_parallel_workers> --runtime={10/30/60} --group_reporting --filename=/dev/nvme<device> - to simulate an optimized app;
  • dd_rescue /dev/nvme<device> /dev/null -b {4k/2M} {-d} - to simulate a stupid app.

Appropriate settings are changed in appropriate places, such as:

  • /etc/tuned/<custom-profile>/tuned.conf:
@BigNerd
BigNerd / download-my-fritz-box-logs.sh
Created June 2, 2019 10:48
This bash script downloads the current Fritz Box event log as JSON file and as TXT file
#!/bin/bash
#
# This bash script downloads the current Fritz Box event log as JSON file and as TXT file.
#
# The login procedure was implemented according to https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AVM_Technical_Note_-_Session_ID.pdf
#
# The script was tested successfully on MacOS High Sierra 10.13.6 with Fritz!Box 6490 Cable (kdg)
PASSWORD=<replace-with-your-fritz-box-password>
@webarchitect609
webarchitect609 / terminal.sh
Last active April 25, 2024 15:07
Git: disable GPG signing for current repo only.
# Write local
git config --local commit.gpgsign false
# Read local (if never set, can be an empty value)
git config --local commit.gpgsign
@Flafla2
Flafla2 / Perlin.cs
Last active April 25, 2024 15:04
Improved Perlin Noise Implementation in C#
public class Perlin {
public static double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;
double frequency = 1;
double amplitude = 1;
for(int i=0;i<octaves;i++) {
total += perlin(x * frequency, y * frequency, z * frequency) * amplitude;
amplitude *= persistence;
@HerringtonDarkholme
HerringtonDarkholme / nihongo.cpp
Last active April 25, 2024 15:04
g++ nihongo.cpp
#define エスティーディー std
#define アイオーストリーム <iostream>
#define ユージング using
#define イフ if
#define インクルード #include
#define イント int
#define シーアウト cout
#define シーイン cin
#define ネームスペース namespace
#define ブール bool
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active April 25, 2024 15:03
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@patrocle
patrocle / Nginx + Apache reverse proxy REAL IP.md
Last active April 25, 2024 15:02
Real IP for Apache (Nginx reverse proxy)

NGINX 1.10 + APACHE 2.4 real IP for reverse proxy

Edit nginx conf

default.conf or what you want

vim /etc/nginx/conf.d/default.conf

add proxy_set_header for php files

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 25, 2024 14:59
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@Dakedres
Dakedres / README.md
Last active April 25, 2024 14:59
A Windows 95/98 styled scrollbar for https://windows93.net

Install

Please note, this stylesheet may not work on all browsers, as the CSS scrollbar API is not standardized.

1.1.0

  • Made the checkerboard pattern translucent.
@dafta
dafta / usb-ether.sh
Last active April 25, 2024 15:08
Steam Deck USB Ethernet
#!/bin/sh
if [ "$UID" -ne 0 ]; then
echo "This script needs to be executed as root"
exit 1
fi
vendor_id="0x3000" # Valve
product_id="0x28DE"
serial_number="$(dmidecode -s system-serial-number)" # The Steam Deck's serial number