Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Xevion's full-sized avatar
⚜️
Noblesse Oblige

Xevion Xevion

⚜️
Noblesse Oblige
View GitHub Profile
import { createContext, Dispatch, ReactNode, useContext, useReducer } from "react";
export interface GlobalContextProps {
loggedIn: boolean;
background: boolean;
}
export interface GlobalContextAction {
type: string;
value: any;
@Xevion
Xevion / slug.py
Created August 26, 2022 05:37
Slug + base64 identifier URL generation
"""
slug.py
Contains operations and functions integral to slug processing and identifier extraction
"""
from math import ceil
from slugify import slugify
from typing import Optional
@Xevion
Xevion / bitwise_versus_addition.py
Last active August 4, 2022 19:30
Bitwise vs Addition in Python (1 million loops)
In [1]: def bitwise_or():
...: x = 0
...: for i in range(1, 32):
...: x |= 1 << i
...: return x
...:
In [2]: def addition():
...: x = 0
...: for i in range(1, 32):
@Xevion
Xevion / asb_union.c
Created July 7, 2022 00:17
Addressed Single Block Write Union Magic
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
struct AddressedSingleBlockWrite {
uint8_t Flag;
uint8_t Command;
uint8_t Address[8];
uint8_t Block;
// Hello world! Cplayground is an online sandbox that makes it easy to try out
// code.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
union magic {
uint8_t buf[4];
uint32_t magic2;
@Xevion
Xevion / common_timezones.txt
Created June 19, 2022 00:51
Common Timezones provided by Pytz
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
@Xevion
Xevion / all_timezones.txt
Created June 19, 2022 00:51
All timezones provided by Pytz
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
library(beakr)
# Create a new beakr server
newBeakr() %>%
# Respond to GET requests at the "/hi" route
httpGET(path = "/hi", function(req, res, err) {
print("Hello, World!")
}) %>%
<SpeakerMappings>
<Mapping count="11686">
<Source>Michael</Source>
<Destination>Michael</Destination>
</Mapping>
<Mapping count="7335">
<Source>Dwight</Source>
<Destination>Dwight</Destination>
</Mapping>
<Mapping count="6632">
{
"subaru": [
{
"id": "yyTJTUNgsVU",
"title": "The Subaru Sambar Is a Cute, Surprisingly Practical Tiny Van"
},
{
"id": "vCOYkYwEXPE",
"title": "The 2023 Subaru Solterra Is an Electric Crossover for Adventures"
},