Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env fish
# Set variables
set TMP_DIR (mktemp -d) # Create a temporary folder
set DOWNLOAD_URL "https://code.visualstudio.com/sha/download?build=stable&os=linux-x64"
set HARDCODED_TARGET_DIR "/path/to/" # Change this to your desired folder
set DIR_TO_BACKUP "/path/to/VSCode-linux-x64/" # Change this to your desired folder
# Use HARDCODED_TARGET_DIR as the target directory
set TARGET_DIR (string replace -r '/+$' '' $HARDCODED_TARGET_DIR) # Normalize HARDCODED_TARGET_DIR to remove trailing slashes
@RandallFlagg
RandallFlagg / Create a perssitent image.md
Last active December 21, 2024 18:05
Create a usb bootable system image in Void Linux using EROFS

Yes, you can create a persistent storage file on your USB drive instead of creating a new partition. Here's how you can do it:

Step 6.1: Create a Persistent Storage File

  1. Create a Persistent File:
    • Create a file that will serve as the persistent storage:
      sudo dd if=/dev/zero of=/path/to/usb/persistent.img bs=1M count=1024
      This command creates a 1GB file. You can adjust the size as needed.
@RandallFlagg
RandallFlagg / How to submit your first XBPS package to void packages.md
Last active July 13, 2024 23:29
How to submit your first XBPS package to void packages

The offical documents that will give you additional information:
https://github.com/void-linux/void-packages/blob/master/Manual.md
https://github.com/void-linux/void-packages?tab=readme-ov-file
https://xbps-src-tutorials.github.io/package-update-tutorial.html
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md

Prepare your environemt:

  1. Fork the repository in https://github.com/void-linux/void-packages
  2. Clone your forked repo and in the cloned directory run the bootstrap command: ./xbps-src binary-bootstrap
  3. If you are making a new package create a directory for it in the srcpkg directory
@RandallFlagg
RandallFlagg / MountQemuNBD.sh
Last active June 30, 2024 09:31
Mount VHDX
#!/bin/bash
#TODO: Fix documentation
#TODO: Add an option for RW/RO
#TODO: Add tests to make sure there are no errors
# https://stackoverflow.com/questions/22009364/is-there-a-try-catch-command-in-bash
# https://stackoverflow.com/questions/15656492/writing-try-catch-finally-in-shell
# https://mywiki.wooledge.org/BashFAQ/105
#TODO: Select nbd device alone
#TODO: Translate this python code into bash: https://github.com/rhyven/MountNBD/blob/master/MountNBD.py
Install ADB:
On void Linux(other distros might have a different package name)
xi android-tools
xi android-udev
sudo usermod -aG plugdev $LOGNAME
sudo reboot now #This will reboot the machine
All the shell commands can be run from within the shell by logging into the shell and ommiting the adb shell from the begining:
List all android devices connectes to the machine running the adb:
@RandallFlagg
RandallFlagg / repo-rinse.sh
Created November 3, 2023 02:21 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@RandallFlagg
RandallFlagg / notepadplusplus_win11.reg
Created October 8, 2023 23:56 — forked from ChuckMichael/notepadplusplus_win11.reg
***/!\Not needed starting from Notepad++ v8.5.1/!\*** It adds "Edit with Notepad++" option to new context menu under Windows 11. Thanks to @AveYo!
Windows Registry Editor Version 5.00
; Edit with Notepad++ in Windows 11 contextmenu - by AveYo (https://gist.github.com/AveYo)
[-HKEY_CURRENT_USER\Software\Classes\*\shell\extract]
[HKEY_CURRENT_USER\Software\Classes\*\shell\extract]
"MuiVerb"="Edit with &Notepad++"
"Icon"="C:\\Program Files\\Notepad++\\notepad++.exe,0"
"MultiSelectModel"="Player"
"NeverDefault"=""
"AppliesTo"="NOT .zip"
@RandallFlagg
RandallFlagg / @import, import, require
Created April 22, 2018 22:25
@import, import, require - diffrences
@import is CSS/SASS syntax to include other files.
import is modern ES6 syntax to include modules.
require is AMD/CMD syntax currently used by Node.
@RandallFlagg
RandallFlagg / pnpm-debug.log
Created April 10, 2018 22:10
pnpm fails installing globally @adonisjs/cli
---
0 debug pnpm:package-json:
initial:
name: "pnpm-global-pkg"
private: true
version: "1.0.0"
1 debug pnpm:stage: "resolution_started"
2 debug pnpm:progress:
pkg:
name: "pnpm"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">