Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block apiraino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Rust2Wasm mini-howto
### install deps
Reference here:
### create a binary rust project
### write a public function
### compile Rust code targeting WASM
wargo build (i.e. cargo build --target=wasm32-unknown-emscripten)
### test binary
apiraino /
Created Jan 23, 2018
Convert XML file from Firefox (pre-Quantum) extension --> Keepass import CSV
#!/usr/bin/env python3
# Convert XML file from the firefox (pre-Quantum) extension
# into a CSV suitable to be imported into keepassxc
# Notes:
# - Python3 only!
# - password must be exported in plain text
# - requires defusedxml package ("pip install defusedxml")
apiraino / TCP sync forwarder
Last active Apr 10, 2018
TCP sync forwarder
View TCP sync forwarder
extern crate encoding;
use std::io::prelude::*;
use std::io::{BufReader, BufWriter};
use std::env;
use std::net::{Shutdown, TcpStream};
use encoding::{EncoderTrap, Encoding};
use encoding::all::ASCII;
fn main() {
View TCP async forwarder
extern crate tokio;
extern crate tokio_io;
use std::sync::{Arc, Mutex};
use std::net::{Shutdown, SocketAddr};
use tokio::net::{TcpListener, TcpStream};
use tokio::prelude::*;
apiraino / gist:8fd8bbbe797ec12fe8dd2bd3a3f2d8f8
Created Jul 12, 2018
Langenscheidt OpenSearch description file
View gist:8fd8bbbe797ec12fe8dd2bd3a3f2d8f8
// Create these files on a webserver (also localhost is ok) and point your browser there
// Reference:
// lg.html
<html lang="en-US" dir="ltr" class="no-js">
<head prefix="og:">
<meta charset="utf-8">
<link rel="search" type="application/opensearchdescription+xml" href="/lg_osd.xml" title="Langenscheidt Ita-Deu"/>
You should see a + icon on the custom search engine box.
struct Foo {}
impl Bar for Foo {
fn dummy_spacer() -> bool {
fn dummy_spacer() -> bool {
View brightness setting for i3 (using Gnome utility)
#!/usr/bin/env bash
# set -x
# /usr/lib/gnome-settings-daemon/gsd-backlight-helper
#Application Options:
# --set-brightness Set the current brightness
# --get-brightness Get the current brightness
# --get-max-brightness Get the number of brightness levels supported
View gist:4c8abac8d23398b2bd6dcd5d3d54e1df
(defun rust-test-fn (code expected-result)
(insert code)
;; check window before formatting
(let (w-start (window-start))
(message "%s" w-start)
(should (equal expected-result (buffer-string)))
View cargo check false positive
pub struct MyStruct {
num: i32
impl MyStruct {
// setting to "pub", makes the warning disappear
fn new() -> MyStruct {
MyStruct { num : 2 }
You can’t perform that action at this time.