Skip to content

Instantly share code, notes, and snippets.

View falsycat's full-sized avatar
☠️
moved to Gitea

falsycat falsycat

☠️
moved to Gitea
View GitHub Profile
@falsycat
falsycat / holm.sh
Last active January 27, 2023 06:30
#!/bin/bash
rec=$(cat -)
n=$(awk '$0!=""{++a}END{print a}' <<< "$rec")
sort -g -k $1 <<< "$rec" | awk -v "i=$1" -v "n=$n" '$0!=""{
++a;
p = $(i)*(n-a+1);
if (p>0.05) exit;
for (x=1;x<=NF;++x) {
#!/bin/bash
# ---- record manipulation
function normalize() {
cat - | \
sed -nE -e '/^#/b' -e '/^\s/{H;$!b}' -e 'x; /^$/!{s/\s+/ /g;p}' | \
awk -e '{for (i=3;i<NF;i+=2) print $1, $2, $i, $(i+1)}'
}
function calc_wallet_sums() {
cat - | \
@falsycat
falsycat / pleroma-mod.js
Last active December 9, 2022 14:19
mod script for pleroma-fe
(() => {
const kModPath = "/instance/";
window.addEventListener("DOMContentLoaded", () => {
const mods = [
mod_style,
mod_highlight,
mod_math,
];
@falsycat
falsycat / pano-eye.ino
Last active July 20, 2022 16:17
全周(180度)展望完全監視システム - パノプティコンアイ
#include <Servo.h>
#define ACTION_DELAY 700
#define ANGLE_UNIT 15
#define TEST_COUNT (180/ANGLE_UNIT+1)
#define DIST_ERROR 20
#define PIN_BEEP 12
#define PIN_LED 2
#define PIN_BUTTON_INIT 3
@falsycat
falsycat / openh264-minimp4-decode.cc
Created June 29, 2022 08:58
read mp4 video using openh264 + minimp4.h
#include <cassert>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <fstream>
#include <vector>
#define MINIMP4_IMPLEMENTATION
#include "minimp4.h"
@falsycat
falsycat / openh264-minimp4-encode.cc
Created June 29, 2022 08:56
create mp4 video using minimp4.h + openh264
#include <cassert>
#include <cstdint>
#include <cstring>
#include <iostream>
#define MINIMP4_IMPLEMENTATION
#include "minimp4.h"
#include "../codec/api/wels/codec_api.h"
@falsycat
falsycat / source_location.hh
Last active March 17, 2022 03:21
std::source_location implementation for Clang (MIT)
#pragma once
#if defined(__clang__)
#include <cstdint>
namespace std {
// source_location impl for Clang
// reference:
// https://github.com/paweldac/source_location/blob/ff0002f92cdde3576ce02048dd9eb7823cabdc7b/include/source_location/source_location.hpp

Keybase proof

I hereby claim:

  • I am falsycat on github.
  • I am falsycat (https://keybase.io/falsycat) on keybase.
  • I have a public key ASAj3Bp1J77mbXlt-GhZpXd5_1Q3mvc3J6s-t6cEckAwBwo

To claim this, I am signing this object:

#!/usr/bin/awk -f
! /^(#|$)/ {
delete io
for (i = 4; i <= NF; ++i) {
split($i, tok, ":")
target = tok[1]
value = int(tok[2])
#version 330
#extension GL_ARB_explicit_uniform_location : enable
out vec4 o_color;
void main(void) {
o_color = vec4(1.);
}