Skip to content

Instantly share code, notes, and snippets.

@shakram02
shakram02 / main_passcontrol.c
Created Feb 21, 2021
Control passing using FreeRTOS notifications.
View main_passcontrol.c
/**
* Adapted from: https://www.freertos.org/RTOS_Task_Notification_As_Binary_Semaphore.html
*/
#include <stdio.h>
#include <pthread.h>
#include "FreeRTOS.h"
#include "semphr.h"
View main_handover.c
/**
* Adapted from: https://www.freertos.org/RTOS_Task_Notification_As_Binary_Semaphore.html
*/
#include <stdio.h>
#include <pthread.h>
#include "FreeRTOS.h"
#include "semphr.h"
@shakram02
shakram02 / main_semaphore.c
Created Feb 21, 2021
FreeRTOS Semaphore API
View main_semaphore.c
/**
* Adapted from: https://microcontrollerslab.com/freertos-binary-semaphore-tasks-interrupt-synchronization-u-arduino/
*/
#include <stdio.h>
#include <pthread.h>
#include "FreeRTOS.h"
#include "semphr.h"
@shakram02
shakram02 / FreeRTOS_Mailbox.c
Created Feb 21, 2021
Mailbox example for FreeRTOS using FreeRTOS demo code as a base
View FreeRTOS_Mailbox.c
/**
*
* Adapted from: https://microcontrollerslab.com/create-mailbox-with-queues-using-freertos-arduino/
*
*/
#include <stdio.h>
#include <pthread.h>
/* Kernel includes. */
@shakram02
shakram02 / tasks_rtos.cpp
Created Jan 30, 2021
This code demonstrates using RTOS tasks with different priorities
View tasks_rtos.cpp
#include <stdio.h>
#include <pthread.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
@shakram02
shakram02 / config-5.4.48-gentoo
Created Nov 12, 2020
My kernel config for gentoo-linux. Leaving it as a backup if I return to Gentoo someday
View config-5.4.48-gentoo
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.4.48-gentoo Kernel Configuration
#
#
# Compiler: gcc (Gentoo 9.3.0-r1 p3) 9.3.0
#
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=90300
@shakram02
shakram02 / data_to_code.py
Last active May 12, 2020
Convert python string to callable code. Import a module without executing it's main() / or expressions. Just the definitions and imports.
View data_to_code.py
import ast
func_h = """
import socket
class Toroto:
def __init__(self):
self.quacks = 0
def quack(self):
@shakram02
shakram02 / tun_tap_constants_for_python.py
Created Apr 12, 2020
Basic constants for TUN/TAP devices for python and some code
View tun_tap_constants_for_python.py
import fcntl
import struct
import os
import errno
# https://github.com/firecracker-microvm/firecracker/blob/ebc15f2eacaa4c26782a05f8e0cebe4c47512553/src/vmm/src/default_syscalls/mod.rs#L64
# https://gist.github.com/glacjay/585369#file-tun-ping-linux-py-L9
TUNSETIFF = 0x400454ca
# https://chromium.googlesource.com/chromiumos/platform/flimflam/+/refs/heads/0.11.257.B90/tools/tap-test.c#101
@shakram02
shakram02 / facebook-block-list.txt
Last active Feb 15, 2020
Block list for all facebook domains to be used with PiHole, source: https://github.com/jmdugan/blocklists/blob/master/corporations/facebook/all the gist is modified to allow traffic to WhatsApp
View facebook-block-list.txt
apps.facebook.com
connect.facebook.net
facebook.com
fbcdn.com
fbsbx.com
fbcdn.net
graph.facebook.com
login.facebook.com
s-static.ak.facebook.com
static.ak.connect.facebook.com
@shakram02
shakram02 / build_ffmpeg.sh
Created Sep 15, 2019
Sciprt used to build FFMPEG from sources and includes libraries that I need
View build_ffmpeg.sh
#!/bin/bash
./configure --enable-libopenh264 --enable-libx264 --enable-libwavpack --enable-libvorbis --enable-libopus --enable-libmp3lame --enable-libass --enable-libdav1d --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libopenjpeg --enable-gpl --enable-nonfree
6243 ./configure --enable-libopenh264 --enable-libx264 --enable-libwavpack --enable-libvorbis --enable-libopus --enable-libmp3lame --enable-libass --enable-libdav1d --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libopenjpeg --enable-libsoxr --enable-gpl --enable-nonfree