Skip to content

Instantly share code, notes, and snippets.

View Davenchy's full-sized avatar

Davenchy Davenchy

View GitHub Profile
@Davenchy
Davenchy / ala.fish
Created May 29, 2026 21:32
A fish function that updates the Pacman`s mirror-list to use ALA for safe and fixed Arch-Linux full system upgrades
# Arch Linux Archive tool
# Use to fix local pacman mirrorlist to point to a specific snapshot
# You have to update the pacman.conf file to use the ala-mirrorlist
function ala
switch "$argv[1]"
case today
# Sync to today's snapshot
__ala_update_snapshot "$(date +"%Y/%m/%d")";
case set
# Sync to a specific snapshot
@Davenchy
Davenchy / .vimrc
Last active May 30, 2026 00:31
My VIM configuration
" PLUGINS ------------------------------------------------------ {{{
" set nocompatible
" filetype off
call plug#begin()
Plug 'kovetskiy/sxhkd-vim'
Plug 'catppuccin/vim', { 'as': 'catppuccin' }
Plug 'rstacruz/sparkup'
Plug 'wakatime/vim-wakatime'
Plug 'Exafunction/codeium.vim'
@Davenchy
Davenchy / main.s
Created October 25, 2025 09:11
My first x86-x64 ASM program
;#---------------------
;# GNU Assembler file
;# Function calls demo
;#---------------------
.intel_syntax noprefix
.global _start
.text
_start:
mov rbp, rsp
mov rdi, 5
@Davenchy
Davenchy / xcopy.bash
Created May 13, 2024 02:31
Copy/Paste bash scripts using xclip
#!/usr/bin/bash
# Simple bash script to copy files into clipboard using xclip
# Check if xclip is installed
if ! command -v xclip &> /dev/null; then
echo "Error: xclip is not installed. Please install xclip before running this script."
exit 1
fi
if [[ -z "$1" ]]; then
@Davenchy
Davenchy / user.php
Last active May 3, 2024 03:09
PHP User Model
class User {
private $id;
private $name;
private $email;
public function __construct(int $id, string $name, string $email) {
$this->id = $id;
$this->name = $name;
$this->email = $email;
}
@Davenchy
Davenchy / multer_example.js
Created May 1, 2024 11:08
Multer Example
const express = require('express');
const multer = require('multer');
const { v4: uuidv4 } = require('uuid');
const fs = require('fs');
const path = require('path');
const Resource = require('./models/Resource'); // Assuming you have a Resource model defined
const app = express();
// Set up multer storage configuration
@Davenchy
Davenchy / rclone-mount.bash
Created February 29, 2024 05:20
A bash script to mount a shared google drive directory into my disk using rclone
#!/usr/bin/env bash
# Use rclone to mount a shared google drive directory into my disk.
#
# Assumed you already created a readonly gdrive rclone config.
# Assumed you already added your access token or you authenticated the rclone config with your drive.
# Check the rclone docs for more info: https://rclone.org/drive/
# You don't have to assign everything, usually I leave everything empty and I use my browser to authenticate.
# the rclone config name
rclone_config_name="EmbeddedLinuxDiploma"
@Davenchy
Davenchy / README.md
Last active November 4, 2021 02:52
My zram control script

ZRam Controller Script

Install

The script uses zramctl under the hood

make sure to remove swap partition from /etc/fstab

Script

@Davenchy
Davenchy / event_emitter.dart
Last active November 8, 2021 22:23
Dart EventEmitter
import 'dart:async';
typedef EventHandler<E> = void Function(E event);
typedef HandlerCanceler = Future<void> Function();
class EventEmitter<T> {
final StreamController<T> _controller = StreamController.broadcast();
final List<StreamSubscription> _subscriptions = [];
final List<Completer> _completers = [];
@Davenchy
Davenchy / main.dart
Created November 1, 2021 12:02
Dart Middleware pattern
import 'middleware.dart';
void main(List<String> arguments) {
final password = MiddlewareManager<String, String>();
password.use((context, next, fail) {
if (context.isEmpty) fail('password is required');
next(context);
});
password.use((context, next, fail) {
if (context.length < 8) fail('password minimum 8 characters');