Skip to content

Instantly share code, notes, and snippets.

View rm77's full-sized avatar
💭
(to be) or not (to be) = (to be)

Roy rm77

💭
(to be) or not (to be) = (to be)
  • surabaya, indonesia
View GitHub Profile
@megadix
megadix / jfif_to_jpg.py
Created May 17, 2024 06:33
Python script to convert JFIF images to JPEG - useful for images generated by Image Creator from Microsoft Bing
# Prerequisites:
# 1. Python 3.x
# 2. Pillow library (PIL fork)
# pip install pillow
import os
import sys
from PIL import Image
dir_path = None
@morgangiraud
morgangiraud / multi-gpu.sh
Last active May 20, 2025 22:47
Script for Ubuntu: Nvidia Multi-GPU Installation and Testing
# Script for Ubuntu: Nvidia Multi-GPU Installation and Testing (Adaptable for other distros)
# Step 0: Clean Nvidia Installation
# If you need to completely remove a previous Nvidia installation, use these commands.
# This ensures that you start with a clean slate for a new installation.
sudo apt-get --purge remove "*nvidia*"
sudo apt-get --purge remove "*cuda*" "*cudnn*" "*cublas*" "*cufft*" "*cufile*" "*curand*" "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*" "*libnccl*"
# Verify that the removal is complete by checking if any Nvidia, CUDA, or cuDNN packages are still installed.
apt list --installed | grep cuda
@tanaikech
tanaikech / submit.md
Created October 30, 2022 23:31
Workaround: Checking Existence of File ID in Google Drive without Access token and API key

Workaround: Checking Existence of File ID in Google Drive without Access token and API key

This is a workaround for checking the existence of file ID in Google Drive without both the access token and API key.

When you want to check whether the file of the file ID is existing in Google Drive, generally, you might use Drive API and Drive service (DriveApp) of Google Apps Script. In this case, the scope of Drive API is required to be used. By this, the access token and the API key (in the case of publicly shared files) are required to be used. But, there might be a case that the available scopes are limited. In this post, I would like to introduce a workaround for checking the existence of file ID in Google Drive without both the access token and API key.

Workaround: curl

In this workaround, the thumbnail link like https://drive.google.com/thumbnail?id={fileId} is used. Ref In this case, when the file ID is existing, the sign-in page with the status code of `200

@plembo
plembo / createkvmstoragepool.md
Last active November 13, 2024 17:38
Create the default KVM storage pool for images

Create the default KVM storage pool for images

Some distributions create the defaut KVM (libvirtd) storage pool for images when they install KVM, others do this upon the creation of the first KVM guest. Creating the default pool from scratch is pretty straightforward. Here's how to do it with virsh.

First verify there is no existing default pool:

$ virsh pool-list --all
 Name      State    Autostart
-----------------------------
@theprojectsomething
theprojectsomething / An Ubuntu WiFi Secure Captive Portal.md
Last active July 11, 2025 14:03
Guide: An Ubuntu WiFi Secure Captive Portal: Network Manager / DNSMasq / HA Proxy / Let's Encrypt

An Ubuntu WiFi Secure Captive Portal

Improvements, suggestions & fixes are welcome!

Captive portals can be a pain. Here's an opinionated and no-doubt entirely imperfect guide to setting one up for a WiFi access point on Ubuntu (tested on 20+), utilising Network Manager, DNSMasq, HA Proxy and (optionally) Let's Encrypt for a secure, locally hosted landing page.

_Note: This setup was originally designed for an offline WLAN, providing access to a small number of locally hosted domains ... think the WiFi media portal on a flight or boat. If you are looking to provide internet access behind a captive portal then this guide won't get you all the way there. That said, many routers have this capability built in, as do any number of open source router firmware solutions. So you probably don't need to roll your own. If you'd like to try anyway, Ha Proxy Stick Tables would probably come in handy. Very happy to update the guide with any p

@DavidVentura
DavidVentura / tap-linux.py
Created August 2, 2021 21:18 — forked from makcuk/tap-linux.py
A simple python tun/tap udp tunnel example
# Simple linux tun/tap device example tunnel over udp
# create tap device with ip tuntap add device0 tap
# set ip address on it and run tap-linux on that device and set desitation ip
# run same on another node, changing dst ip to first node
import fcntl
import struct
import os
import socket
import threading
@programmer131
programmer131 / Linux Virtualization using Iproute2.md
Last active February 18, 2024 05:08
using linux Iproute2 utility, Setup VLAN, double VLAN, VLAN with outer s-tag, VXLAN, VXLAN inside VXLAN,

How to clear ip addr, link
ip link delete vxlan2
ip addr del 192.168.0.55/24 dev vxlan2
VxLAN setup
Machine 1
ip link add vxlan1 type vxlan id 1 remote 192.168.18.48 dstport 4789 dev wlp2s0
ip link set vxlan1 up
ip addr add 192.168.0.6/24 dev vxlan1
Machine 2
ip link add vxlan1 type vxlan id 1 remote 192.168.18.24 dstport 4789 dev wlp3s0\

@nasirhafeez
nasirhafeez / freeradius-advanced-use-cases.md
Last active June 3, 2025 13:39
FreeRADIUS Advanced Use Cases
@djoreilly
djoreilly / mk-vxlan.sh
Created February 17, 2020 10:08
Linux VxLAN performance test setup script
#!/bin/bash
set -xe
# $0 host dev remote_ip
# host is 1 or 2
# on vmA
# ./mk-vx.sh 1 ens3 10.10.10.9
# on vmB
# ./mk-vx.sh 2 ens3 10.10.10.15
@vaughany
vaughany / .tmux.conf
Last active July 16, 2024 23:03
A shell script to open tmux with a selection of windows and panes.
# Remap prefix from 'C-b' to 'C-a'.
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Reload config file.
bind-key r source-file ~/.tmux.conf\; display ' Reloaded tmux config.'
# Split panes using | and -.
bind-key | split-window -h -c '#{pane_current_path}'