Skip to content

Instantly share code, notes, and snippets.

View gauravssnl's full-sized avatar
😸
use code::latest ;

GAURAV gauravssnl

😸
use code::latest ;
View GitHub Profile
@SleepingSoul
SleepingSoul / building-gstreamer-from-source.md
Last active March 9, 2024 21:41
Building GStreamer from source on Linux device

Hardware used: Orange Pi 4 LTS

OS: Armbian Jammy

Should work everywhere on Debian or Ubuntu

Step 1: Install build tools (meson, ninja)

Usually gstreamer uses newer version of meson then available in apt packages, so we need to also build and install it from source. This is super easy. Here I am using 1.2.3 version that is currently latest, but you can use any other version.

sudo apt install pip
type Event:
wait()
set()
type Link:
get(ptr: Ptr):
if LOAD(ptr, Acquire) |value|:
return value
e = Event{}
public static void main(String[] argv) throws InterruptedException {
Executors.newVirtualThreadPerTaskExecutor().
execute(() -> {
System.out.print("StringList: " + stringList);
});
stringList = List.of("ZZ", "XX", "LL", "DDD");
}
public static void main(String[] argv) throws InterruptedException {
Executors.newVirtualThreadPerTaskExecutor().
execute(() -> {
System.out.print("StringList: " + stringList);
});
stringList = List.of("ZZ", "XX", "LL", "DDD");
}
@lobre
lobre / zig_type_system.md
Last active March 15, 2024 20:43
Zig type system illustrated using ascii diagrams

Zig Type System

Zig aims to be a simple language. It is not easy to define what simple exactly means, but zig is also a low-level programming language that aims for c-compatibility. To reach this goal, it needs good semantics in its type system so that developers have a complete toolbox to manipulate data.

So types in zig are composable, but this can become rapidly overwhelming. See those examples. Are you able to understand them at a glance, as soon as you read them?

*const ?u8
?*const u8
*const [2]u8
@irh
irh / variadic_closures.rs
Created September 29, 2022 08:44
An example of implementing a method that accepts closures with different arguments.
// An example of implementing a method that accepts closures with different input arguments.
// The trick to avoid Rust complaining about conflicting implementations is to specify
// the arguments for each specialization in a separate type parameter.
// See https://geo-ant.github.io/blog/2021/rust-traits-and-variadic-functions/
fn main() {
let mut foo = Foo::default();
foo.add_fn(|| 0);
foo.add_fn(|a| a);
@dabeaz
dabeaz / lala.py
Last active January 2, 2023 04:20
Some lambdas
# Author: David Beazley (https://www.dabeaz.com)
# Twitter: @dabeaz
from functools import reduce
run = lambda s: reduce(lambda *_:..., iter(lambda s=[s]:
(_:=s.pop()(),s.append(_))[0], None))
const = lambda v,c : lambda: c(v)
add = lambda x,y,c : lambda: c(x+y)
mul = lambda x,y,c : lambda: c(x*y)
@willmcgugan
willmcgugan / timers.css
Created August 18, 2022 15:13
Timers example
TimerWidget {
layout: horizontal;
height: 5;
background: $panel-darken-1;
border: tall $panel-darken-2;
margin: 1;
padding: 0 1;
transition: background 200ms linear;
}
@menzenski
menzenski / log_rich_inspect_in_aws_glue.py
Last active August 17, 2022 14:44
Use rich's Inspect method on an object in an AWS Glue script
from rich.logging import RichHandler
from rich._inspect import Inspect
import logging
handler = RichHandler(rich_tracebacks=True, show_path=False, locals_max_length=None, locals_max_string=None, show_level=False, show_time=False)
logging.basicConfig(level="NOTSET", format="%(message)s", datefmt="[%X]", handlers=[handler])
# assumption - you are using AWS CloudWatch logs for AWS Glue