Skip to content

Instantly share code, notes, and snippets.

@lu-zero
lu-zero / playground.rs
Created September 29, 2018 22:08 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#![feature(ptr_offset_from)]
use std::marker::PhantomData;
#[derive(Debug, Clone, Copy)]
struct PlaneInfo {
stride: usize,
w: usize,
h: usize,
}
@lu-zero
lu-zero / playground.rs
Created August 1, 2017 10:33 — forked from anonymous/playground.rs
Rust code shared from the playground
/* Can you do better?
*
* The following code tries to initialize an array of somehow complex structures
* I added also the dumb way to do that with maps and vectors
* I wonder if adding some syntactic sugar such as
*
* let array = [{|index| generator(index)}; N];
*
* Could be interesting or hadn't been proposed already.
*
@lu-zero
lu-zero / ovpn-writer.sh
Created December 10, 2016 13:31 — forked from renatolfc/ovpn-writer.sh
Script to generate an OpenVPN client configuration file in the unified format
#!/bin/sh
##
## Usage: ./ovpn-writer.sh SERVER CA_CERT CLIENT_CERT CLIENT_KEY SHARED_SECRET > client.ovpn
##
server=${1?"The server address is required"}
cacert=${2?"The path to the ca certificate file is required"}
client_cert=${3?"The path to the client certificate file is required"}
client_key=${4?"The path to the client private key file is required"}
@lu-zero
lu-zero / playground.rs
Created July 23, 2016 15:31 — forked from anonymous/playground.rs
Shared via Rust Playground
#![feature(box_syntax, box_patterns)]
#![allow(dead_code, unused_variables)]
pub trait TraitObject {
fn safe_method(&mut self);
}
pub struct Description {
common_field: &'static str,
}
diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h
index ab4fe70..76ad89b 100644
--- a/libavcodec/bitstream.h
+++ b/libavcodec/bitstream.h
@@ -44,8 +44,8 @@ typedef struct BitstreamContext {
} BitstreamContext;
/**
- * Return number of bits already read.
- */
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 820a7ae..51a1943 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -33,6 +33,7 @@
#include "internal.h"
#include "mathops.h"
#include "mpegaudiodsp.h"
+#include "bitstream_debug.h"
@lu-zero
lu-zero / per_slice_gb.diff
Last active March 14, 2016 12:47 — forked from anonymous/diff
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 80bc46a..d651406 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -75,6 +75,7 @@ typedef struct SVQ3Context {
H264Picture *cur_pic;
H264Picture *next_pic;
H264Picture *last_pic;
+ GetBitContext slice;
int halfpel_flag;
@lu-zero
lu-zero / get_bits_debug.h
Last active March 5, 2016 19:53 — forked from anonymous/get_bits_debug.h
Tracing the old bitreader
#define get_bits_count(gb) \
({ \
int _ret = get_bits_count(gb); \
printf("%s:%d %s, read_count %d\n", __FILE__, __LINE__, __func__, _ret); \
_ret; \
})
#define get_bits1(gb) \
({ \
unsigned int _ret = get_bits1(gb); \
@lu-zero
lu-zero / bitstream-trace.h
Last active March 4, 2016 21:53 — forked from sasshka/gist:9fb9891ade4628145d3b
bitstream.h debugging
#define bistream_read_count(bb) ({\
int _ret = bitstream_read_count(bb); \
printf("%s:%d %s, read_count %d\n", __FILE__, __LINE__, __func__, _ret); \
_ret; \
})
#define bistream_read_bit(bb) ({\
int _ret = bitstream_read_bit(bb); \
printf("%s:%d %s, read_bit %d\n", __FILE__, __LINE__, __func__, _ret); \
_ret; \
@lu-zero
lu-zero / gist:01aab7db5693655e1e45
Created November 21, 2015 17:24 — forked from samhocevar/gist:00eec26d9e9988d080ac
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <sam@hocevar.net>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#