Skip to content

Instantly share code, notes, and snippets.

View jcmvbkbc's full-sized avatar

Max Filippov jcmvbkbc

  • Fremont, CA
View GitHub Profile
@jcmvbkbc
jcmvbkbc / gist:316e6da728021c8ff670a24e674a35e6
Last active November 21, 2023 18:39
esp32s3 linux rebuild scripts
Latest versions of these scripts are available in git repository https://github.com/jcmvbkbc/esp32-linux-build
@jcmvbkbc
jcmvbkbc / fix-fpe-div0.c
Last active June 17, 2022 00:23
division-by-0-fixer
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <signal.h>
#if defined(__x86_64__) || defined(__i386__)
static int fixup_div0(siginfo_t *si, ucontext_t *uc)
{
@jcmvbkbc
jcmvbkbc / rebuild-kernels.sh
Created July 11, 2018 06:48
android kernel/emulator tools
#! /bin/bash -ex
# VER=3.18|4.4|4.9 ./rebuild-kernels
declare -A defconfig
declare -A cross
defconfig=([arm64]="ranchu64_defconfig" [x86_64]="x86_64_ranchu_defconfig")
cross=([arm64]="aarch64-linux-gnu-" [x86_64]="x86_64-linux-gnu-")
for check in 0 1 ; do
@jcmvbkbc
jcmvbkbc / fix-repo-version
Created May 10, 2018 22:16
Script for repo project version fixing ( repo forall -c fix-repo-version `pwd`/.repo/manifests/default.xml )
#! /bin/bash -ex
if [ $# -gt 0 ] ; then name="$1"
else name=".repo/manifests/default.xml" ; fi
sed -i "$name" -e "\\,name=\"$REPO_PROJECT\",s, *revision=\"[^\"]*\",,g"
sed -i "$name" -e "\\,name=\"$REPO_PROJECT\",s,/>,revision=\"$REPO_LREV\" />,g"
@jcmvbkbc
jcmvbkbc / h.c
Last active May 23, 2021 15:51
Hanoi towers with unsorted source.
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
typedef std::deque<int> stack;
void move_top1(stack& from, stack& to, stack& spare);
int top(const stack& o)
@jcmvbkbc
jcmvbkbc / Makefile
Last active March 29, 2021 07:45
Makefile for ESP8266 that can build both C and C++
# tnx to mamalala
# Changelog
# Changed the variables to include the header file directory
# Added global var for the XTENSA tool root
#
# This make file still needs some work.
#
# Updated for SDK 0.9.2
#
# Output directors to store intermediate compiled files
// ==UserScript==
// @name drop lj promo
// @namespace jcmvbkbc
// @include https://*.livejournal.com/friends*
// @include https://www.livejournal.com/
// @version 1
// @run-at document-idle
// @grant none
// ==/UserScript==
ipv6: ipv6.c
if ENABLE_FOO
include $(srcdir)/Makefile.foo.include
endif
#include <inttypes.h>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#ifndef FREQ
#define FREQ 44100
#endif
#ifndef CHANNELS