Skip to content

Instantly share code, notes, and snippets.

View jsjolund's full-sized avatar

Johannes Sjölund jsjolund

View GitHub Profile
@jsjolund
jsjolund / string-conversion.rs
Created September 26, 2022 21:11 — forked from jimmychu0807/string-conversion.rs
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
@jsjolund
jsjolund / weechat_grayout.txt
Created September 26, 2022 17:05 — forked from fats/weechat_grayout.txt
[weechat] Gray out join/part/quit messages
/set irc.look.color_nicks_in_server_messages off
/set colorize_nicks.look.ignore_tags irc_join,irc_part,irc_quit
/set irc.color.message_join darkgray
/set irc.color.message_quit darkgray
/set irc.color.reason_quit darkgray
/set weechat.color.chat_tags darkgray
/set weechat.color.chat_nick darkgray
/set weechat.color.chat_host darkgray
/set weechat.color.chat_delimiters darkgray
/set weechat.color.chat_channel darkgray

Xmonad + Gnome integration for Ubuntu 19.10

The guide at https://wiki.haskell.org/Xmonad/Using_xmonad_in_Gnome#Ubuntu is increasingly out of date and was already pretty flaky by Ubuntu 16-18. This guide is for Ubuntu 19.10.

I'll try to include some additional context for whats going on so that when things change again it should hopefully not leave you completely lost.

What I want (AKA you can ignore this if your response isn't "Just don't use xmonad + gnome")

@jsjolund
jsjolund / aiowatch.py
Last active November 3, 2022 11:29 — forked from mivade/aiowatch.py
Using watchdog with asyncio
import asyncio
from pathlib import Path
from typing import Optional
from watchdog.events import FileSystemEvent, FileSystemEventHandler
from watchdog.observers import Observer
class _EventHandler(FileSystemEventHandler):
def __init__(self, queue: asyncio.Queue, loop: asyncio.BaseEventLoop,