Skip to content

Instantly share code, notes, and snippets.

@Gunni
Gunni / nftables.conf
Created February 26, 2020 23:12
Example nftables.conf for a wireguard "server"
table inet filter {
chain inbound {
type filter hook input priority 0
policy drop
ct state invalid counter drop
ct state { established, related } counter accept
ip protocol icmp counter accept
ip6 nexthdr ipv6-icmp counter accept
@acmcelwee
acmcelwee / circle-lock.sh
Last active April 9, 2020 16:01
Workflows-friendly adaptation of CircleCI's build locking https://github.com/bellkev/circle-lock-test
#!/usr/bin/env bash
set -o xtrace -o errexit -o pipefail -o nounset
########################################################################################
# CircleCI's current recommendation for roughly serializing a subset
# of build commands for a given branch
#
# circle discussion thread - https://discuss.circleci.com/t/serializing-deployments/153
# Code from - https://github.com/bellkev/circle-lock-test
@Miouyouyou
Miouyouyou / Linux_DRM_OpenGLES.c
Last active February 18, 2024 14:21
An example, inspired by Rob Clark "kmscube.c" that uses Linux Direct Rendering Manager ( DRM ) and EGL to create an OpenGL ES 2 context. This is a standalone example, that just clears the screen with a blueish color. Usable with Rockchip DRM drivers and Mali Wayland/DRM userspace drivers.
// gcc -o drmgl Linux_DRM_OpenGLES.c `pkg-config --cflags --libs libdrm` -lgbm -lEGL -lGLESv2
/*
* Copyright (c) 2012 Arvin Schnell <arvin.schnell@gmail.com>
* Copyright (c) 2012 Rob Clark <rob@ti.com>
* Copyright (c) 2017 Miouyouyou <Myy> <myy@miouyouyou.fr>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@hisui
hisui / .mm
Created May 22, 2015 00:19
Checking if a given frame is a key frame.
static BOOL isKeyFrame(CMSampleBufferRef sample)
{
auto a = CMSampleBufferGetSampleAttachmentsArray(sample, 0);
if (CFArrayGetCount(a) > 0) {
CFBooleanRef value;
auto b = CFDictionaryGetValueIfPresent
((CFDictionaryRef) CFArrayGetValueAtIndex(a, 0)
, kCMSampleAttachmentKey_NotSync
, reinterpret_cast<const void **>(&value))
;