Skip to content

Instantly share code, notes, and snippets.

View zzeroo's full-sized avatar
💤
zzeroo...

zzeroo zzeroo

💤
zzeroo...
View GitHub Profile
@zzeroo
zzeroo / CargoAttributes.nsi
Created November 17, 2020 19:05
Helper .nsi script to extract information from Rust's Cargo.toml
; CargoAttributes.nsi
;
; * Copyright © 2020 Stefan Müller <co@zzeroo.com>
; *
; * SPDX-License-Identifier: GPL-2.0-or-later
;
; Helper .nsi script to extract information from Rust's Cargo.toml.
;
; # Usage
;
/// Prints and spins "-=..zZ[ER]Oo..=-"
///
use std::{thread, time::Duration};
const STRING: &'static str = "..zzeroo..";
fn main() {
let mut text: Vec<_> = STRING.split_terminator("").skip(1).collect();
let text_len = text.len();
let mut i = text_len;
@zzeroo
zzeroo / yaya in docker.sh
Last active September 27, 2020 16:43
Yaya installation in docker
# Docker total optional :)
# pacman -S docker
yay -S docker
# Wenn docker installiert ist kannst du so magic
# Sachen machen wie diese:
docker run -it -v $(pwd):/src debian:latest
# ---- hier gehts los ---
@zzeroo
zzeroo / main.rs
Created May 25, 2020 14:22
Where to put the type info?
use std::thread;
use tokio::runtime::Runtime;
use tokio_modbus::prelude::*;
use tokio_serial::Serial;
fn main() {
thread::spawn(|| {
let mut rt = Runtime::new().expect("Couldn't create Runtime");
rt.block_on(async {
let port = Serial::from_path("/dev/ttyUSB0", &Default::default()).unwrap();
@zzeroo
zzeroo / runtime_return_value.rs
Created May 25, 2020 14:21
How to annote the type information?
use std::thread;
use tokio::runtime::Runtime;
use tokio_modbus::prelude::*;
use tokio_serial::Serial;
fn main() {
thread::spawn(|| {
let mut rt = Runtime::new().expect("Couldn't create Runtime");
rt.block_on(async {
let port = Serial::from_path("/dev/ttyUSB0", &Default::default()).unwrap();
@zzeroo
zzeroo / futures sender Clone.log
Created May 14, 2020 13:23
futures_channel::mpsc::Sender<UiEvent>`, which does not implement the `Copy` trait
--> src/main.rs:60:41
|
29 | ui_event_sender: Sender<UiEvent>,
| --------------- move occurs because `ui_event_sender` has type `futures_channel::mpsc::Sender<UiEvent>`, which does not implement the `Copy` trait
...
49 | refresh_button.connect_clicked(move |_| {
| -------- value moved into closure here
50 | ui_event_sender
| --------------- variable moved due to use in closure
...
@zzeroo
zzeroo / libvirt_backup_all.sh
Created April 9, 2020 06:41
Backup all libvirt instances
# Backup virtual maschines
# TODO: debug notes `echo 'backup vm $i'`
# fish
for i in (virsh --connect=qemu:///system list --all --name); [ ! -z $i ] && virsh --connect=qemu:///system dumpxml $i | sudo tee /var/lib/libvirt/images/$i.xml >/dev/null ; end
# bash
#for i in $(virsh --connect=qemu:///system list --all --name); do [ ! -z $i ] && virsh --connect=qemu:///system dumpxml $i | sudo tee /var/lib/libvirt/images/$i.xml >/dev/null ; done
# Create btrfs Snapshot
sudo btrfs subvol snap -r /mnt/btrfs_storage2900G/@var-lib-libvirt-images /mnt/btrfs_storage2900G/@snapshots/@var-lib-libvirt-images-ro

Keybase proof

I hereby claim:

  • I am zzeroo on github.
  • I am zzeroo (https://keybase.io/zzeroo) on keybase.
  • I have a public key ASALy6kT3iwcgj3Y8Z0D1SygahKj5-odwVyve3SiC1W8Zgo

To claim this, I am signing this object:

<%= simple_form_for @product do |f| %>
<%= f.simple_fields_for :attributes do |d| %>
<% f.object.attributes.try(:each) do |key, value| %>
<%= d.input key, :input_html => {:value => value } %>
<% end %>
<% end %>
<% end %>
@zzeroo
zzeroo / bookmark.min.js
Created May 31, 2019 06:11 — forked from zaydek-old/bookmark.min.js
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();