View gist:a26795aaa0132362f52575e50c98fb3f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat a.c | |
#include <stdint.h> | |
uint16_t GetTimer(void); | |
void delay_us(uint16_t dt) { | |
uint16_t t1 = GetTimer(); | |
uint16_t t2 = GetTimer() - t1; | |
while (t2 < dt) { | |
} |
View gist:8ddd3efa283202eecf4ad4d31baf89a4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gdb -p $(pidof rviz2) | |
GNU gdb (Debian 12.1-4+b1) 12.1 | |
Copyright (C) 2022 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. | |
Type "show copying" and "show warranty" for details. | |
This GDB was configured as "x86_64-linux-gnu". | |
Type "show configuration" for configuration details. | |
For bug reporting instructions, please see: |
View CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.25) | |
project(test) | |
add_executable(hello hello.c) | |
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/foo.h | |
# Ninja always implicitly creates target directories | |
COMMAND mkdir -p include/ | |
COMMAND touch include/foo.h) |
View pixelsize.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <libgen.h> | |
#include <ft2build.h> | |
#include FT_FREETYPE_H | |
#define DPI (96) /* device resolution */ | |
void die(void) | |
{ | |
printf("oops\n"); | |
exit(1); |
View time.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph G { | |
edge [weight=10] | |
TAI -> UTC [label="−∆AT"]; | |
UTC -> UT1 [label="+∆UT1"] | |
UT1 -> TT [label="+∆T"] | |
TT -> TCG [label="linear"] | |
TCG -> TCB [label="4 D"] | |
TCB -> TDB [label="Linear"] | |
edge [weight=2] |
View print_radius.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "SpiceUsr.h" | |
int main() | |
{ | |
SpiceBoolean found; | |
SpiceInt nr; | |
SpiceDouble radii[3]; | |
SpiceInt code; | |
SpiceChar name[] = "Io"; |
View gist:69f44b16fd00825a717724174b6e1a64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To emulate `hashFiles()` in GitHub Actions with `sha256sum`, you can do | |
```shell | |
sha256sum file | cut -f1 -d ' ' | xxd -r -p | sha256sum | |
``` |
View rinngbuf.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <zephyr.h> | |
#include <sys/printk.h> | |
#include <sys/ring_buffer.h> | |
#define RING_BUF_SIZE 10 | |
RING_BUF_ITEM_DECLARE_SIZE(ringbuf, RING_BUF_SIZE); | |
void dump(struct ring_buf *r, uint32_t ret) | |
{ | |
printk("ret %3u, size %3u space %3u head %3u tail %3u\n", |
View hello_led.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <drivers/led.h> | |
void main(void) | |
{ | |
const struct device *led = device_get_binding("SC LED"); | |
while (1) { | |
led_on(led, 1); | |
k_msleep(1000); | |
led_off(led, 1); |
View main.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <zephyr.h> | |
#define MY_STACK_SIZE 5000 | |
K_THREAD_STACK_DEFINE(preempt_stack, MY_STACK_SIZE); | |
struct k_thread preempt_thread; | |
K_THREAD_STACK_DEFINE(coop_stack, MY_STACK_SIZE); | |
struct k_thread coop_thread; |
NewerOlder