Skip to content

Instantly share code, notes, and snippets.

@danneu
danneu / diskio.h
Created Feb 23, 2021 — forked from RickKimball/diskio.h
msp430 Petit FatFile System sample
View diskio.h
/*-----------------------------------------------------------------------
/ PFF - Low level disk interface modlue include file (C)ChaN, 2009
/-----------------------------------------------------------------------*/
#ifndef _DISKIO
#include "integer.h"
/* Status of Disk Functions */
typedef BYTE DSTATUS;
@danneu
danneu / text_to_svg_path.py
Created Aug 22, 2020 — forked from CatherineH/text_to_svg_path.py
Convert a text character to an SVG path.
View text_to_svg_path.py
from svgpathtools import wsvg, Line, QuadraticBezier, Path
from freetype import Face
def tuple_to_imag(t):
return t[0] + t[1] * 1j
face = Face('./Vera.ttf')
@danneu
danneu / index.js
Created Mar 21, 2020 — forked from joepie91/index.js
Breaking CloudFlare's "I'm Under Attack" challenge
View index.js
'use strict';
const parseExpression = require("./parse-expression");
function findAll(regex, target) {
let results = [], match;
while (match = regex.exec(target)) {
results.push(match);
}
View json5-parser.js
// json5.js
// Modern JSON. See README.md for details.
//
// This file is based directly off of Douglas Crockford's json_parse.js:
// https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
var JSON5 = (typeof exports === 'object' ? exports : {});
JSON5.parse = (function () {
"use strict";
@danneu
danneu / plink-plonk.js
Created Feb 15, 2020 — forked from tomhicks/plink-plonk.js
Listen to your web pages
View plink-plonk.js
View nox-crash.log
(index):458 wasm streaming compile failed: TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
printErr @ (index):458
(anonymous) @ out.js:2317
(index):458 falling back to ArrayBuffer instantiation
printErr @ (index):458
(anonymous) @ out.js:2318
(index):458 Calling stub instead of sigaction()
printErr @ (index):458
_sigaction @ out.js:13258
_SDL_QuitInit
View .swift
// $ ps -c -Ao pid,comm,pcpu -r | tail -n +2 | head -n 5
// 2333 installd 61.8
// 2671 iTerm2 17.3
// 2334 storedownloadd 4.1
// 203 WindowServer 2.8
// 5243 Activity Monitor 2.7
func getTopCpuProcs() {
let ps = Process()
ps.launchPath = "/usr/bin/env"
ps.arguments = ["ps", "-c", "-Ao", "pid,comm,pcpu,time", "-r"]
View DraggableView.swift
// A view that you can drag to move the underlying window around,
// but other mouse events are still handled by the view.
class DraggableView: NSView {
var dragStart: Date? = nil
// This alone would be sufficient except that the final mouseUp
// after a drag gets handled by the view instead of ignored,
// so the user will accidentally click a button if they happened
// to start (thus end) their drag on one.
override var mouseDownCanMoveWindow: Bool { return true }
View .rs
#[derive(Deserialize, Debug)]
pub struct Submission {
#[serde(rename = "id")]
pub thing_id: String,
pub author: String,
pub title: String,
pub created_utc: f32,
pub score: i32,
pub url: String,
}
@danneu
danneu / a.rs
Last active Sep 11, 2018
src/a.rs, src/b.rs, src/lib.rs
View a.rs
pub fn fn_a() -> u32 { 1 }