Skip to content

Instantly share code, notes, and snippets.

@kolen
kolen / gae_to_json.py
Last active November 11, 2020 18:43
Google app engine backup dump to json
import sys
import json
import datetime
sys.path.append('/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/')
from google.appengine.api.files import records
from google.appengine.datastore import entity_pb
from google.appengine.api import datastore
def extract(index):
raw = open('backups/2020-11-10T18:54:56_95621/default_namespace/all_kinds/output-'+str(index), 'r')
Analysis of sampling sudo (pid 20663) every 1 millisecond
Process: sudo [20663]
Path: /usr/bin/sudo
Load Address: 0x107424000
Identifier: sudo
Version: 86.50.1
Code Type: X86-64
Parent Process: zsh [20661]
Date/Time: 2020-01-07 19:59:14.114 +0300
Analysis of sampling login (pid 13098) every 1 millisecond
Process: login [13098]
Path: /usr/bin/login
Load Address: 0x10a645000
Identifier: login
Version: 790.50.6
Code Type: X86-64
Parent Process: sh [13097]
Date/Time: 2020-01-07 19:42:07.670 +0300
@kolen
kolen / mh-z14.rb
Created December 3, 2019 19:34
Read MH-Z14 CO2 sensor readings
#!/usr/bin/env ruby
# Read MH-Z14 CO2 sensor readings connected via serial port
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem "rubyserial", "0.6.0"
end
@kolen
kolen / dither.glsl
Created July 30, 2019 21:53
Simple dithering shader for godot engine
// Based on http://devlog-martinsh.blogspot.com/2011/03/glsl-dithering.html
shader_type canvas_item;
uniform float scale = 1.0;
float find_closest(int x, int y, float c0)
{
mat4 dither = mat4(vec4( 1.0, 33.0, 9.0, 41.0),
vec4(49.0, 17.0, 57.0, 25.0),
@kolen
kolen / Cargo.toml
Created July 23, 2019 17:08
Rust Image library test cases for iteration methods on ImageBuffer with zero width and/or height causing 'chunk_size != 0' panic
[package]
name = "image-iter-panic-demo"
version = "0.1.0"
edition = "2018"
[dependencies]
image = { git = "https://github.com/image-rs/image" }
[lib]
path = "lib.rs"
@kolen
kolen / Dungeon Keeper Map Files Format Reference v1.1.md
Created May 12, 2019 14:51
Dungeon Keeper Map Files Format Reference v1.1
@kolen
kolen / tap.ksy
Created May 8, 2019 18:05
Fixed kaitai struct for zx spectrum .tap files (fixed prefixing data with header)
meta:
id: zx_spectrum_tap
file-extension: tap
endian: le
license: CC0-1.0
title: ZX Spectrum tape file format
xref:
justsolve: TAP_(ZX_Spectrum)
pronom: fmt/801
doc-ref: https://faqwiki.zxnet.co.uk/wiki/TAP_format
use std::boxed::Box;
use std::thread;
use std::mem;
trait Callback: Send {
fn callback(&mut self);
}
struct CallbackHolder<CB: Callback> {
userdata: Box<Option<CB>>
#![allow(dead_code,
mutable_transmutes,
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
unused_mut)]
#![feature(libc)]
extern crate libc;
#[no_mangle]
pub unsafe extern "C" fn send(mut to: *mut libc::c_char,