Skip to content

Instantly share code, notes, and snippets.

@ithilelda
ithilelda / PXE boot with GRUB2.md
Last active January 2, 2024 10:35
actually working pxe boot with grub2 on bios (client setup)

PXE Boot Setup with GRUB2 Tutorial

There are many tutorials on the internet that tell you how to setup a PXE Boot server with PXELINUX. There are however other options to replace PXELINUX like GRUB2 and iPXE. In this tutorial, I'm going to teach you how to setup a PXE Boot Environment with GRUB2, and later add menu entries to boot many popular OSes.

Notice: I'm not going to repeat the part where you setup the DHCP and TFTP server. Such section in other tutorials still applies to this scenario.

Making the GRUB2 image to be loaded by NIC

think the GRUB2 image as the same as PXELINUX's pxelinux.0 file. Your DHCP server must point to it, and it must be available on your TFTP server. Instead of shoving a blob down your throat and telling you that it just works, I'm going to walk you through the process of making one yourself by using an readily available linux installation.

zt_logo

Setting up ZeroTier as a default ethernet interface

Step 1: Install ZeroTier

Install ZeroTier on your gateway, join your network and authorize it, and then configure it as a basic IPv4 NAT router

/etc/sysctl.conf

@sheepla
sheepla / suggest.sh
Last active March 18, 2024 03:39
Web検索のサジェストキーワードを取得する.sh
#!/bin/sh
# suggest.sh -- get suggestion keywords from several site
#
# Usage:
# suggest SITE KEYWORDS...
# SITE:
# youtube(yt), archwiki(aw), duckduckgo(d), wikipedia(w), amazon(a)
# Example:
# suggest wikipedia Linux
use bytes::{Buf, Bytes, BytesMut};
use opentelemetry::sdk;
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry::sdk::trace::{Builder, Sampler};
use opentelemetry::trace::TracerProvider;
use opentelemetry::{global::set_text_map_propagator, KeyValue};
use std::convert::TryFrom;
use std::env::var;
use std::net::SocketAddr;
use std::process::Stdio;
@ninlith
ninlith / build.txt
Last active February 8, 2024 21:27
Hybrid UEFI/BIOS multiboot USB drive
# Hybrid UEFI/BIOS multiboot USB drive
# Install required packages
sudo apt install gdisk grub2-common grub-efi-amd64-bin grub-pc-bin qemu-system
# Create an empty disk image
target_size=3.6G # $(lsblk -b --output SIZE -n -d /dev/sdX) for drive size
qemu-img create -f raw boottitikku.img "$target_size"
# Create a GUID Partition Table (GPT)
@plar
plar / ubuntu_disk_encryption.sh
Last active November 6, 2021 19:07
Ubuntu_Full_Disk_Encryption_Howto_2019 (shell commands)
sudo -i
export DEV="/dev/sda"
export DEV="/dev/nvme0n1"
export DM="${DEV##*/}"
export DEVP="${DEV}$( if [[ "$DEV" =~ "nvme" ]]; then echo "p"; fi )"
export DM="${DM}$( if [[ "$DM" =~ "nvme" ]]; then echo "p"; fi )"
# export SDD_PASS=secret123
sgdisk --print $DEV
sgdisk --zap-all $DEV
@FedericoPonzi
FedericoPonzi / CI.yml
Last active April 17, 2024 22:56
Ready to use Github workflow for cross-compiling a rust binary to many Linux architectures.
# Instruction + template repo: https://github.com/FedericoPonzi/rust-ci
# Search and replace <YOUR_BINARY_NAME> with your binary name.
name: CI
on:
pull_request:
push:
branches:
- master
tags:
@Andrey2G
Andrey2G / encoding.txt
Last active April 7, 2024 13:00
Video Encoding with multiple resolutions
ffmpeg -i "c:/videos/sample.mp4
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0
-c:v libx264 -crf 22 -c:a aac -ar 48000
-filter:v:0 scale=w=480:h=360 -maxrate:v:0 600k -b:a:0 64k
-filter:v:1 scale=w=640:h=480 -maxrate:v:1 900k -b:a:1 128k
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 900k -b:a:2 128k
-var_stream_map "v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p"
-preset slow -hls_list_size 0 -threads 0 -f hls -hls_playlist_type event -hls_time 3
-hls_flags independent_segments -master_pl_name "name-pl.m3u8"
"c:/videos/encoded/name-%v.m3u8"
@catchdave
catchdave / replace_synology_ssl_certs.sh
Last active April 10, 2024 08:53
CLI script to programmatically replace SSL certs on Synology NAS
#!/bin/bash
#
# *** For DSM v7.x ***
#
# How to use this script:
# 1. Get your 3 PEM files ready to copy over from your local machine/update server (privkey.pem, fullchain.pem, cert.pem)
# and put into a directory (this will be $CERT_DIRECTORY).
# Personally, I use this script (https://gist.github.com/catchdave/3f6f412bbf0f0cec32469fb0c9747295) to automate steps 1 & 4.
# 2. Ensure you have a user setup on synology that has ssh access (and ssh access is setup).
# This user will need to be able to sudo as root (i.e. add this line to sudoers, <USER> is the user you create):
#!/bin/bash
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
set -u
set -e
CONSUL_VERSION=${CONSUL_VERSION:-"1.9.4"}
NOMAD_VERSION=${NOMAD_VERSION:-"1.0.4"}
CNI_PLUGINS_VERSION=${CNI_PLUGINS_VERSION:-"0.9.1"}