Skip to content

Instantly share code, notes, and snippets.

View JIghtuse's full-sized avatar

Boris Egorov JIghtuse

View GitHub Profile
@TrentSPalmer
TrentSPalmer / gentoo_nspawn_container_on_Digital_Ocean.md
Last active June 28, 2017 09:32
Gentoo Nspawn Container on Ubuntu 17.04 on Digital Ocean.

Install a Gentoo nspawn Container on Ubuntu 17.04 on Digital Ocean.

Spin up an Ubuntu 17.04 droplet, because nspawn containers are slightly more difficult with Ubuntu 16.04. Install systemd-container. (This will also work on your local workstation or laptop running Ubuntu 17.04.)

apt install systemd-container
anonymous
anonymous / playground.rs
Created December 12, 2016 09:56
Shared via Rust Playground
use std::collections::HashMap;
#[derive(Clone, Debug)]
struct Data {
values: Vec<i32>,
pass_to: Option<usize>,
}
impl Data {
fn has_complete_values(&self) -> bool {
anonymous
anonymous / playground.rs
Created December 28, 2015 07:37
Shared via Rust Playground
#[derive(Clone, Copy)]
struct Comp;
struct USB;
struct Card;
impl USB {
fn get_version(&self) -> Option<f64> {
Some(1.2)
}
}
anonymous
anonymous / playground.rs
Created December 1, 2015 07:03
Shared via Rust Playground
use std::fmt::Debug;
fn takes_two_things<T: Debug, U: Debug>(x: T, y: U) {
println!("{:?} {:?}", x, y);
}
fn main() {
takes_two_things(3, "ok");
takes_two_things(3, 2); // fine if the same
}
anonymous
anonymous / playground.rs
Created October 6, 2015 08:05
Shared via Rust Playground
use std::str::FromStr;
#[derive(Debug)]
enum Version { Version1, Version2 }
#[derive(Debug)]
enum ParseError { InvalidSyntax, UnsupportedVersion }
struct NameValue {
name: String,
anonymous
anonymous / playground.rs
Created October 6, 2015 07:20
Shared via Rust Playground
use std::str::FromStr;
#[derive(Debug)]
enum Version { Version1, Version2 }
#[derive(Debug)]
enum ParseError { InvalidSyntax, UnsupportedVersion }
fn parse_version(line: String) -> Result<Version, ParseError> {
let mut split = line.split("=");
me:
@true
a:
@true
sandwich:
@[ "$$(id -u)" -eq 0 ] && echo "Okay." || echo "What? Make it yourself."
.PHONY: me a sandwich
@jayjanssen
jayjanssen / gist:5697813
Created June 3, 2013 12:33
Testing multicast with iperf
this is a sample of output:
root@percona-db-2:~# iperf -s -u -B 226.94.1.1 -i 1
------------------------------------------------------------
Server listening on UDP port 5001
Binding to local address 226.94.1.1
Joining multicast group 226.94.1.1
Receiving 1470 byte datagrams
UDP buffer size: 122 KByte (default)
------------------------------------------------------------
@egonSchiele
egonSchiele / diners.hs
Last active April 23, 2022 17:29
Dining philosophers solution in Haskell using STM. Taken from http://rosettacode.org/wiki/Dining_philosophers#Haskell with some minor modifications.
import Control.Monad
import Control.Concurrent
import Control.Concurrent.STM
import System.Random
import Text.Printf
-- Forks
type Fork = TMVar Int
newFork :: Int -> IO Fork
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname