Skip to content

Instantly share code, notes, and snippets.

View JustHumanz's full-sized avatar
🐧
Hey there i am using github

Aldin Setiawan JustHumanz

🐧
Hey there i am using github
View GitHub Profile
@firelightning13
firelightning13 / [GUIDE] GPU Passthrough for Laptop with Fedora.md
Last active July 21, 2024 10:37
[GUIDE] GPU Passthrough for Laptop with Fedora

Abstract

This is a full guide for people who wanted to setup Windows 10/11 VM with QEMU/KVM hypervisor for laptops that configured with hybrid graphics card like Intel/AMD + NVIDIA. This process will take about 1 to 2 hours, depending on your system's performance.

There is another comprehensive guide you can follow here (shoutout to asus-linux team). It is more up-to-date than mine. I'll probably incorporate those information to my guide, but you are welcome to use this one as a reference!

Before we proceed:

  • This guide is exclusively for Fedora because this distro is quite different to set up than other distro such as Arch. I would say Arch is easier to setup than Fedora, but sometimes your prefer Fedora than Arch in terms of its usage & features.
  • This tutorial mostly focus on laptops with NVIDIA Optimus MUXed configuration when dGPU (dedicated GPU) can connect directly to HDMI/DP output. If in doubt, sea
@satrobit
satrobit / xdp.md
Created August 8, 2021 16:17
Absolute Beginner's Guide to BCC, XDP, and eBPF

Introduction

If you're reading this, chances are you have some idea of eBPF and XDP. In this article, we'll write an eBPF program that will count and categorize packets based on the destination port.

eBPF

Writing low-level tracing, monitoring, or network programs in Linux is not easy. Through all the layers of the kernel, people have been squeezing every bit of performance they could get.

And that's where eBPF comes in. eBPF is basically an extended and modern variation of BPF which is like a virtual machine inside the Linux kernel. It can execute user-defined programs inside a sandbox in the kernel.

These programs can be executed in various hook points but we will focus on XDP for now.

# Dump a PG mimic
ceph pg dump pgs --format=json-pretty |jq -r '.[]|select(.pgid == "<PGID>")'
# Dump a PG nautilus
ceph pg dump pgs --format=json-pretty |jq -r '.pg_stats[]|select(.pgid == "<PGID>")'
# Find inconsistent PG's mimic
ceph pg dump pgs --format=json-pretty 2> /dev/null|jq -r '.[]|select (.state|test("inconsistent"))| .pgid'
#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
@lc-at
lc-at / mux.py
Created January 7, 2020 11:29
pymux: run multiple services in one port (connection multiplexer)
import select
import socket
import socketserver
__author__ = 'loncat <me@lcat.dev>'
services = [
{
'name': 'ssh',
'address': ('127.0.0.1', 22),
@smola
smola / GLUSTER_SETUP.sh
Created October 18, 2018 09:24
Quick and dirty single-node GlusterFS setup
#
# Instructions for quick gluster server (1 node) setup with a volume on LVM.
# No replication, just using localhost.
#
# See https://docs.gluster.org/en/latest/Administrator%20Guide/Brick%20Naming%20Conventions/
#
# Install GlusterFS
add-apt-repository ppa:gluster/glusterfs-4.0
apt-get install glusterfs-server
// TODO
//
// add direct message e.g.
//
// - DirectMessage(userID, msg)
// - a.DirectMessageService.New
// - a.DirectMessageService.Destroy
//
//
// add undo fns e.g.
@7cc
7cc / aニコニコ静画-マンガAPI-01.txt
Last active January 30, 2024 14:43
ニコニコ静画、マンガAPI
*良識の範囲で使う。例えば、関連する市場も同時に表示するとか
追記:市場は終了…https://blog.nicovideo.jp/seiga/2019/12/post-1285.html
# 静画API
静画, コメント, タグ, 市場
マンガ, コメント, タグ, 市場(旧テーマ?お題)
自分のNGリスト取得
マイリスト取得?不明
ランキング
@jhjguxin
jhjguxin / nginx-403-forbidden-error-hosting-in-user-home-directory.md
Created August 12, 2013 05:40
nginx 403 forbidden error when server static file under user home directory