This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
theme = "tokyonight" | |
[editor] | |
line-number = "relative" | |
mouse = false | |
bufferline = "multiple" | |
rulers = [80] | |
[editor.statusline] | |
right = ["diagnostics", "selections", "position", "position-percentage", "file-encoding", "file-line-ending", "file-type"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set prefix (Ctrl+a) | |
set-option -g prefix C-a | |
unbind-key C-a | |
bind-key C-a send-prefix | |
# Use Alt-arrow keys to switch panes (Alt+left/right/up/down) | |
bind -n M-Left select-pane -L | |
bind -n M-Right select-pane -R | |
bind -n M-Up select-pane -U | |
bind -n M-Down select-pane -D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implementation of Result<Result,Error> type a la Rust. | |
// author: Ugo Varetto | |
// License: Zero-clause BSD | |
// SPDX identifier: 0BSD | |
#include "result.h" | |
//----------------------------------------------------------------------------- | |
Result<int, std::string> Foo(int i) { | |
if (i == 0) { | |
return Err(std::string("Error")); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sha256.c - SHA256 reference implementation | |
// | |
//----------------------------------------------------------------------------- | |
#include <assert.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
//----------------------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cabal-version: 3.4 | |
-- The cabal-version field refers to the version of the .cabal specification, | |
-- and can be different from the cabal-install (the tool) version and the | |
-- Cabal (the library) version you are using. As such, the Cabal (the library) | |
-- version used must be equal or greater than the version stated in this field. | |
-- Starting from the specification version 2.2, the cabal-version field must be | |
-- the first thing in the cabal file. | |
-- Initial package description 'y' generated by | |
-- 'cabal init'. For further documentation, see: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Directory | |
import System.FilePath | |
import Control.Monad | |
import System.Process | |
import Data.Char | |
main = do | |
c <- listDirectory "." | |
f <- filterM (\x -> return (map toLower (snd(splitExtension x)) == ".heic")) c | |
mapM (\x -> callProcess "convert" [x, (dropExtension x) ++ ".jpg"]) f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# run with sudo | |
ethtool -s enp8s0 wol g | |
systemctl hibernate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/systemd/network/50-wired.link | |
#Make system wake up on magic packet reception | |
[Match] | |
MACAddress=80:FA:5B:78:BB:98 | |
[Link] | |
NamePolicy=kernel database onboard slot path | |
MACAddressPolicy=persistent | |
WakeOnLan=magic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rust-script | |
use std::{ | |
env, fs, | |
io::{self, Error, ErrorKind}, | |
}; | |
fn main() -> io::Result<()> { | |
let d = env::args() | |
.nth(1) | |
.ok_or(Error::new(ErrorKind::Other, "Missing argument"))?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rdmd | |
int convert(string path) { | |
import std.file, std.algorithm, std.path, import std.parallelism; | |
import std.process : execute | |
import std.uni: toLower; | |
auto dFiles = dirEntries(path, SpanMode.breadth).filter!(f=>f.name.toLower.endsWith(".heic")); | |
foreach (d; parallel(dFiles)) { | |
auto f = d.name; | |
auto status = execute(["convert", f.baseName, f.baseName ~ ".jpg"]); | |
if (status.status != 0) return status.status; |