Skip to content

Instantly share code, notes, and snippets.

View VehpuS's full-sized avatar
🦔

Moshe Jonathan Gordon Radian VehpuS

🦔
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<style>
.item1 {
grid-area: myArea;
}
.grid-container {
display: grid;
grid-template-areas:
@VehpuS
VehpuS / struct-packed-bits.c
Last active October 22, 2018 19:53
reading packed struct bits created by VehpuS - https://repl.it/@VehpuS/reading-packed-struct-bits
#include <stdio.h>
#include <stdint.h>
typedef struct __attribute__((__packed__)) data_block_t {
uint8_t a;
uint8_t b : 1;
uint8_t c : 1;
uint8_t d : 1;
uint8_t e : 1;
uint8_t f : 1;
@VehpuS
VehpuS / expand-as-macro-pattern.c
Last active October 14, 2020 16:47
Expand as macros pattern demonstration in C - https://repl.it/@VehpuS/Expand-as-macros
#include <stdio.h>
#include <stdbool.h>
#define NAME_ID_LIST(ENTRY) \
ENTRY(MOSHE, 0, true) \
ENTRY(DROR, 1, false)
#define NAME_ID_LIST_EXPAND_AS_ENUM(enum_name, enum_value, ...) enum_name = enum_value,
typedef enum name_id {
#include <stdio.h>
// https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html
#define test(a) b ## a
int main(void) {
char* bc = "Hello World\n";
printf(test(c));
return 0;
}
@VehpuS
VehpuS / c_csv_python_parser.c
Created February 8, 2019 23:51
A CSV parser in C using the Python csv standard module
#include <Python.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define bail_null(obj) \
if (NULL == obj) { err = 1; goto bail; }
#define bail_require(cond) \
if (!(cond)) { err = 1; goto bail; }
@VehpuS
VehpuS / getRedashQueryData.ts
Last active March 30, 2019 14:18
A gist to highlight: https://github.com/ShaharGM/OpenBudgetHKT/blob/master/helpers/getRedashQueryData.ts (check repo for most up-to-date version) - a wrapper to ReDash that lets you run a specific query
const MAX_QUERY_RETRIES = 200;
const DEFAULT_MAX_AGE = 9999;
export interface GetRedashQueryDataProps<QParams = { [key in string]: string }> {
redashURL: string; // e.g. https://app.redash.io/hasadna
queryId: number; // e.g. 185581
queryParams?: QParams; // e.g. {"userCityID": 123121}
/* If query results less than `max_age` seconds old are available,
* return them, otherwise execute the query; if omitted or - 1, returns
* any cached result, or executes if not available.Set to zero to
// Based on an answer from https://stackoverflow.com/questions/2771171/control-the-dashed-border-stroke-length-and-distance-between-strokes
.dashed {
background-image: repeating-linear-gradient(to right, #990000 0%, #990000 50%, transparent 50%, transparent 100%),
repeating-linear-gradient(to right, #990000 0%, #990000 50%, transparent 50%, transparent 100%),
repeating-linear-gradient(to bottom, #990000 0%, #990000 50%, transparent 50%, transparent 100%),
repeating-linear-gradient(to bottom, #990000 0%, #990000 50%, transparent 50%, transparent 100%);
background-position: -1px -1px, //left top,
-1px 23px, //left bottom,
-1px -1px, //left top,
@VehpuS
VehpuS / intersting-discussions.md
Last active October 31, 2019 12:43
Interesting discussions on github
@VehpuS
VehpuS / expo-local-build-nodes.md
Last active February 1, 2023 22:34
A Summary of Documents on How to Build Expo Locally

A Summary of Documents on How to Build Expo Locally

I made this because each doc on it's own discusses localizing one part of the pipeline - and I couldn't find a single place to see the whole process.

Project set up + app.json

From Building Standalone Apps

Do steps 1, 2

@VehpuS
VehpuS / backup_postgres_to_csv.sh
Created September 1, 2020 18:28
Backup a postgres table to CSV
#!bash
psql -d old_db -c "\COPY (SELECT * FROM conditions) TO old_db.csv DELIMITER ',' CSV"