Skip to content

Instantly share code, notes, and snippets.

View JIghtuse's full-sized avatar

Boris Egorov JIghtuse

View GitHub Profile
@ghoseb
ghoseb / ns-cheatsheet.clj
Last active May 20, 2024 13:01 — forked from alandipert/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
@lucasrizoli
lucasrizoli / gist:1603274
Created January 12, 2012 21:33
70 Unique Ways to Encode <
<
%3C
&lt
&lt;
&LT
&LT;
&#60
&#060
&#0060
&#00060
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 24, 2024 17:56
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@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
@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)
------------------------------------------------------------
me:
@true
a:
@true
sandwich:
@[ "$$(id -u)" -eq 0 ] && echo "Okay." || echo "What? Make it yourself."
.PHONY: me a sandwich
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("=");
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 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 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)
}
}