Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/bash
qemu-system-i386 \
-L pc-bios -nodefaults \
-M pc,accel=tcg,hpet=no -cpu qemu32 \
-m 1024 \
-drive file=./winxp.qcow2,index=0,media=disk,format=qcow2 \
-device VGA \
-cdrom iso/windows-xp.iso \
-boot menu=on
@Silica163
Silica163 / main.c
Last active May 19, 2025 11:40
c without stdlib and libc
void exit(int code);
int write(int fd, const void * buff, int count);
int strlen(char * str){
char * end = str;
while(*(end++));
return end - str;
}
int main(int argc, char ** argv, char ** envp){
#include <stdio.h> // standard in-out
#include <errno.h> // error message
#include <unistd.h> // close function
#include <string.h>
#include <sys/socket.h> // socket
#include <netinet/in.h> // network address
#include <arpa/inet.h> // convert port number
int main(int argc, char **argv){
@Silica163
Silica163 / thai.h
Last active September 13, 2024 14:47
ใช้คำหลัก(keyword)ภาษาไทยใน c เขียนเล่นๆเท่านั้นแหละ
/*
นี่แค่เขียนเล่นๆเอาฮาเฉยๆ
ใครเอาไปใช้ก็ช่วยบอกหน่อยว่าเป็นยังไงบ้าง
*/
typedef จำนวนเต็ม int;
typedef จำนวนเต็มบวก unsigned int;
typedef ตัวอักษร char;
typedef จำนวนจริง float;
#define อัตโนมัติ auto
#define ไปที่ goto
@Silica163
Silica163 / genQemuMacAddr.sh
Created July 31, 2024 14:55
Mac Adddress Generator for Qemu virtual machine.
#/bin/sh
printf "52:54:%02x:%02x:%02x:%02x\n" $(($RANDOM & 255)) $(($RANDOM & 255)) $(($RANDOM & 255)) $(($RANDOM & 255))
@Silica163
Silica163 / thai font on linux.md
Last active May 30, 2025 20:57
install thai font in linux

How to install Thai font on linux

Download font files

Go to fonts.google.com then search for Thai font family, select the one you like or many as you want. Click Download, you will got a zip file contains that font.

I don't know about other distro, but don't use aur/ttf-google-thai because it doesn't contain any glyph of Thai font.

You can also use noto-fonts but it is 108MiB large, to large if you only want thai font.

@Silica163
Silica163 / spotifyAutoMuteAds.js
Created March 2, 2024 12:08
auto mute spotify ads
// only work with spotify webapp
// paste this script and run in developer console
// or load this script before spotify loaded
var footer,muteBtn,footObserver;
function onAttrChange(record,observe){
let event = record[0];
console.log(event,record);
if(event.attributeName == "data-testadtype"){
muteBtn.click();
@Silica163
Silica163 / Arch on a USB.md
Last active August 14, 2023 14:26
Arch on a USB

Install Arch Linux on USB drive

remember RUN AS ROOT

format disk

fdisk /dev/sdb
/*
1. Go to https://www.typingstudy.com and select which lesson you want to cheat.
2.1 Press and hold "Space bar" and some letter until the test finish.
2.2 Do the test until you see your typing resault.
3. Open developer tools' console and paste this code, then hit enter.
4. Edit "Exercise time" and "typing speed" to anyting you want by use inspector(Firefox) or Elements(Chrome).
*/
for (let e of document.getElementsByClassName("result")) {
e.innerHTML = e.innerHTML.slice(e.innerHTML.indexOf("/") + 1) + "/" + e.innerHTML.slice(e.innerHTML.indexOf("/") + 1);
e.style = "background-position:500px 0;";