Skip to content

Instantly share code, notes, and snippets.

View rikka0w0's full-sized avatar

Rikka0_0小六花 rikka0w0

  • UNSW
  • Sydney
View GitHub Profile
@rikka0w0
rikka0w0 / eclipse_browser_wsl2.md
Created June 8, 2023 15:20
Fix Eclipse browser issue on Ubuntu 22.04 WSL2

sudo apt install libwebkit2gtk-4.0-37

@rikka0w0
rikka0w0 / openssh.sh
Last active April 14, 2023 06:20
Compile OpenSSH on Linux
#!/bin/bash
mv /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
apt install build-essential zlib1g-dev libssl-dev libpam0g-dev libselinux1-dev
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.0p1.tar.gz
tar -xzf openssh-8.0p1.tar.gz
rm openssh-8.0p1.tar.gz
cd openssh-8.0p1
./configure --with-md5-passwords --with-pam --with-selinux --with-privsep-path=/var/run/sshd/ --sysconfdir=/etc/ssh
make -j2
make install

Add repo

Seehttps://pkg.cloudflareclient.com/install

Install Official Warp Client

sudo apt install cloudflare-warp

Find the best address

wget -N https://gitlab.com/Misaka-blog/warp-script/-/raw/main/files/warp-yxip/warp-yxip.sh && bash warp-yxip.sh

Start Warp in Socks5 mode with best ip

@rikka0w0
rikka0w0 / mount_maps.sh
Last active October 30, 2023 02:14
[L4D2] Use squashfs to save disk. This is an script that auto mounts images and create symbolic links.
#!/bin/bash
# To make squashfs images, run:
# $ mksquashfs *.vpk /tmp/maps.squashfs -comp xz -all-root
# xz has the best compression ratio, lz4 is faster.
# The destination system should have losetup and kmod-loop to mount squashfs in kernel.
# Run this script as root.
# Debian/Ubuntu prerequisite: apt install squashfuse
# OpenVZ: make sure /dev/fuse exists, otherwise see https://iserversupport.com/forum/virtualization/enable-fuse-on-openvz/
# Point to the L4D2 addons directory
@rikka0w0
rikka0w0 / Win11_22H2_Menu_Contrast.md
Last active September 22, 2023 08:30
Improve visibility of Win11 22H2 context menu
  1. Download mssstyleEditor and install UxThemePatcher, then reboot.
  2. Open the msstyle to be patched, usually C:\Windows\Resources\Themes\colored\colored.msstyles or C:\Windows\Resources\Themes\aero\aero.msstyle, no need to make a backup, as the software wont overwrite the existing one.
  3. Replace the image of Part 27 in "Menu" and POPUPITEM in "ImmersiveStart::Menu".
  4. Change the FILLCOLOR of 2-Hot to white (0,0,0)
  5. Save the modified msstyles to somewhere else
  6. Make a copy of the system one
  7. Replace the system one
  8. Swith to the new theme, and done!

Note:

@rikka0w0
rikka0w0 / ip6_pub.sh
Created June 15, 2022 07:30
Get public ipv6 addr
ip -f inet6 addr show br0 | sed -En -e 's/.*inet6 (([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/\1/p' | grep -v ^fe80 | grep -v ^fdea | grep -v temporary | grep -v mngtmpaddr
@rikka0w0
rikka0w0 / readme.md
Created May 17, 2022 16:10
QEMU KVM + Pulseaudio

By default, pulseaudio will only be available to the current login user. If running the QEMU as the root user, the audio will not be available. The common error thrown by QEMU looks like this: Could not init 'pa' audio driver. The following step sets up a globally accessible Unix socket for the other users to access the audio interface. Note that any user on this PC will be able to use it, hence if you really worry about the security issue, please consider assigning an user group to the socket and restrict its access(load-module module-native-protocol-unix auth-group=sharepulse socket=/tmp/pulseaudio.sock).

  1. Edit /etc/pulse/default.pa. Look for a line starts with load-module module-native-protocol-unix and change it to load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulseaudio.sock.
  2. Edit /etc/pulse/client.conf. Change/add: default-server = unix:/tmp/pulseaudio.sock and autospawn = no.
  3. Copy /home/CURRENT_USER/.config/pulse/cookie to `/root/.config/pulse/cooki
@rikka0w0
rikka0w0 / backtrace.txt
Created February 28, 2022 15:56
ad22_wine7.2_simbeor_crash
couldn't load main module (0)
Unhandled exception: C++ exception(object = 00000001AE0AF9F0, type = 000000016435AEE8, base = 000000015DB20000) in 64-bit code (0x000000007b011a5e).
Register dump:
rip:000000007b011a5e rsp:00000001ae0af880 rbp:00000001ae0af9c0 eflags:00000202 ( - -- I - - - )
rax:00000001ae0af8c0 rbx:000000016435aee8 rcx:00000001ae0af8a0 rdx:0000000000000001
rsi:00000001ae0af9c0 rdi:00000001ae0af8e0 r8:0000000000000004 r9:00000001ae0af9a0 r10:0000000000000001
r11:0000000000440138 r12:0000000000000000 r13:0000000000000000 r14:00000001ae0afc78 r15:00000001a62fb9f0
Stack dump:
0x00000001ae0af880: 00000001ae0af8a0 000000017002b4a8
0x00000001ae0af890: 0000000000000079 000000017005f824
@rikka0w0
rikka0w0 / Readme.md
Last active April 30, 2023 02:35
Use Saleae 16 in Sigrok Pulseview

Use Saleae 16 in Sigrok Pulseview

Ubuntu (Tested on Kubuntu 20.04): sudo apt install -y sigrok pulseview

Steps

  1. Go to http://sigrok.org/gitweb/?p=sigrok-util.git;a=tree;f=firmware/saleae-logic16
  2. Download parseelf.py and sigrok-fwextract-saleae-logic16
  3. Download "Logic 1.2.10 Linux 64-bit"from Saleae and extract the file Logic from the archive to the same folder as the above two files.
  4. (Make sure you have python installed) ./sigrok-fwextract-saleae-logic16 Logic
  5. Copy the generated ".bitstream" and ".fw" files to /usr/share/sigrok-firmware or any other firmware search paths.
@rikka0w0
rikka0w0 / Readme.md
Created February 10, 2022 17:44
CCS11.1 on Java 17

The following steps have been tested on Kubuntu 20.04 with Oracle JDK 17. The original JRE (folder) shipped with CCS has been deleted.

Nashron JavaScript is missing since Java 15

Use standalone Nashron from OpenJDK. Create a folder named "nashorn" in the same folder with "ccstudio" and "eclipse", unzip the jars into the newly created folder. Edit "./ccs1110/ccs/eclipse/plugins/com.ti.dvt.control.engine_4.1.0.202105121547/META-INF/MANIFEST.MF", so that the final file looks like this:

Manifest-Version: 1.0
Bundle-SymbolicName: com.ti.dvt.control.engine;singleton:=true
Require-Bundle: com.ti.dvt.core,com.ti.dvt.datamodel;visibility:=reexp
 ort,org.apache.ant;visibility:=reexport,org.eclipse.ant.core;visibili