Skip to content

Instantly share code, notes, and snippets.

@shakram02
shakram02 / react-native-scrollview-with-confirm-button.tsx
Created May 4, 2023 08:59
Scroll view with header and confirm button
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
export function ListScreen() {
const data = [...Array(30).keys()]
return <View style={{ flex: 1, flexDirection: 'column' }}>
<View style={{ flex: 1, justifyContent: 'space-between', alignItems: 'baseline' }}>
<Text>Your Subscriptions</Text>
<TouchableOpacity>
<Text>Request</Text>
@shakram02
shakram02 / main_passcontrol.c
Created February 21, 2021 13:05
Control passing using FreeRTOS notifications.
/**
* 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"
/**
* 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 February 21, 2021 11:39
FreeRTOS Semaphore API
/**
* 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 February 21, 2021 01:08
Mailbox example for FreeRTOS using FreeRTOS demo code as a base
/**
*
* 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 January 30, 2021 15:36
This code demonstrates using RTOS tasks with different priorities
#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 November 12, 2020 02:33
My kernel config for gentoo-linux. Leaving it as a backup if I return to Gentoo someday
#
# 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 12:29
Convert python string to callable code. Import a module without executing it's main() / or expressions. Just the definitions and imports.
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 April 12, 2020 19:44
Basic constants for TUN/TAP devices for python and some code
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 February 15, 2020 14:59
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
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