Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am summivox on github.
  • I am summivox (https://keybase.io/summivox) on keybase.
  • I have a public key ASDrKyPVT27N5ciGKGyAdA9xY_dYR7fSg9UpJ-xmB_DXjwo

To claim this, I am signing this object:

@summivox
summivox / spi-flash-pseudo.c
Created December 23, 2016 03:39
behavior description of SPI flash in pseudo-C
typedef uint8_t byte;
const int FLASH_SIZE = 0x100000;
const int PAGE_SIZE = 0x100;
byte flash[FLASH_SIZE];
int read_addr = 0;
byte write_buf[PAGE_SIZE];
int write_page = 0;
int write_offset = 0;
@summivox
summivox / spi-flash.ls
Created December 23, 2016 02:39
bus pirate spi flash
require! {
'get-stdin': input
}
BYTE_PER_BLOCK = 256
BYTE_PER_LINE = 8
BASE = 0
out = console.~log
@summivox
summivox / systick_hal_rtx.c
Created June 4, 2016 21:48
resolve SysTick conflict between STM32CubeMX-generated HAL and Keil RTX
int os_tick_init (void) { return (-1); }
unsigned HAL_GetTick(void) {
extern unsigned os_time;
return os_time;
}
// Copyright (c) 2016, summivox. (MIT Licensed)
// ==UserScript==
// @name github-tabstop
// @namespace http://github.com/smilekzs
// @version 0.2.0
// @description add tabstop option for hard tabs (works for github/gist)
// @grant GM_xmlhttpRequest
// @match *://github.com/*
// @match *://gist.github.com/*
// ==/UserScript==
#pragma once
#include <cstdint>
#ifdef DEBOUNCER_CHECK_TYPE
# include <type_traits>
#endif // DEBOUNCER_CHECK_TYPE
template <typename T, T thres_transient, T thres_steady>
struct Debouncer {
@summivox
summivox / init.ls
Last active April 9, 2016 01:09
AMTI MSR-6 interface
#!/usr/bin/env lsc
require! {
'serialport': {SerialPort}
}
say = console.~log
timeout = (t, f) -> setTimeout(f, t)
PORT = 'COM3'
s = new SerialPort PORT, baudrate: 57600
@summivox
summivox / twitter-promoted.css
Created March 17, 2016 16:47
stylish script for hiding twitter promoted tweets
@-moz-document domain("twitter.com") {
.promoted-tweet {
display: none;
}
}
@summivox
summivox / output
Last active February 20, 2016 23:10
manage-arguments does NOT work
4.6.85.31
Function is not optimized
Function is not optimized
Function is not optimized
Function is optimized
@summivox
summivox / cmaes_parallelize.m
Last active March 18, 2016 13:02
Prepare a Simulink model for repeated parameterized simulation in Rapid Accelerator mode.
function f_para = cmaes_parallelize(f_orig)
f_para = @f;
function scores = f(vs)
n = size(vs, 2);
scores = zeros(1, n);
parfor i = 1:n
scores(i) = f_orig(vs(:, i));
end
end
end