Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"runtime"
"time"
"sync"
)
func main() {
@Geal
Geal / install-sysdig.sh
Last active May 20, 2020 13:44
Curl install pattern
v=`curl -s https://s3.amazonaws.com/download.draios.com/stable/install-sysdig`; if [ "7777a6bb3188993fc70fd8124c03e2880f034be6 -" != "`echo -n "$v" | sha1sum`" ]; then echo "invalid hash"; else `echo "$v" | sudo bash`; fi
../../extras/package/macosx/../../../modules/codec/avcodec/fourcc.c:448:23: error: use of undeclared identifier 'AV_CODEC_ID_OPUS'
{ VLC_CODEC_OPUS, AV_CODEC_ID_OPUS, AUDIO_ES },
^
../../extras/package/macosx/../../../modules/codec/avcodec/fourcc.c:487:43: error: invalid application of 'sizeof' to an incomplete type 'const struct <anonymous struct at
../../extras/package/macosx/../../../modules/codec/avcodec/fourcc.c:39:14> []'
static const size_t codecs_count = sizeof (codecs_table)
^~~~~~~~~~~~~~
2 errors generated.
make[4]: *** [codec/avcodec/libavcodec_plugin_la-fourcc.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
@Geal
Geal / fun.rs
Created January 16, 2014 18:30
Fun with mutable readers!
use std::io;
pub struct A<'a, R> {
reader: &'a R
}
pub fn init<'a, R: io::Reader>(r: &'a R) -> ~Parser<'a, R> {
~A {
reader: r
}
@Geal
Geal / client.rs
Last active March 7, 2022 21:54
Rust and Unix domain sockets usage example * stream sockets (client.rs and server.rs) * datagram sockets (datagram_client.rs and datagram_server.rs) * example of writing to syslog (incomplete for now)
extern mod native;
use std::io::net::unix::UnixStream;
use std::path::posix::Path;
use std::str;
use std::rt::rtio::IoFactory;
use native::io;
fn main() {
@Geal
Geal / gist:8228049
Last active January 2, 2016 01:09
rough threat model for group chat
# Threat model
## Attacker categories
### Security adversary
Wants to read messages he is not supposed to.
able to control communication channels and read/modify packets
### Consensus adversary
@Geal
Geal / gist:7894264
Created December 10, 2013 17:11
Rust file usage
use std::rt::io::File;
use std::rt::io::buffered::BufferedReader;
[...]
let s:~str = ~"file.txt";
let mut strings:~[~str] = ~[];
let path = PosixPath::new(s);
let mut rdr = BufferedReader::new(File::open(&path).unwrap());
@Geal
Geal / robot.js
Created December 6, 2012 13:46
géo
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@Geal
Geal / gist:1393956
Created November 25, 2011 16:50
Macro displaying __FUNCTION__ and __LINE__ and concatenating its arguments
#define STR(x) #x
#define STR1(x) STR(x)
#define DEBUGME(a) OutputDebugStringA( "[DEBUG| " __FUNCTION__ ":" STR1(__LINE__) "] " a "\n")
@Geal
Geal / about.md
Created August 10, 2011 09:15 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer