Skip to content

Instantly share code, notes, and snippets.

@cjmeyer
cjmeyer / build-openocd.sh
Last active May 22, 2016 13:15
Bash: Build OpenOCD with JLink support
#! /usr/bin/sh
#
# Build script to cross-compile OpenOCD with MinGW on Mint Linux (FTDI, JLINK, TI-ICDI, OSBDM).
#
# 7zip
# curl
# git
# MinGW-W64
# libtool
# Automake
@yiding
yiding / DGPHParser.hs
Last active May 21, 2021 08:56
Parsing xcode DGPH files. This one handles DGPH 1.04 (used in xcode 7.0, 7.1) Xcode DGPH files contains dependency graph information that lets Xcode do incremental builds.
{-# LANGUAGE OverloadedStrings #-}
module DGPHParser(parseDgph) where
import qualified Data.Attoparsec.ByteString as A
import qualified Data.ByteString as B
import Data.Bits
import Data.Foldable (foldl')
import qualified Data.ByteString as B
import qualified Data.Attoparsec.ByteString as A
@ganwell
ganwell / logspec.py
Created September 23, 2012 16:08
Pylab spectogram with log. frequency scale
import numpy
import scipy
import matplotlib.pyplot as pyplot
def decibel(lin):
"""Convert amplitude to decibel.
We might later need power to decibel..."""
return 20*numpy.log10(norm(lin))
@kaiserama
kaiserama / DataTables.py
Last active March 16, 2022 14:52
Jquery DataTables class implementation in Flask with MySQL. There was an example of using DataTables with MongoDB + Flask, but nothing for using MySQL + Flask. Be sure you install Flask-MySQL extension first!
from MySQLdb import cursors
from flask import request
class DataTablesServer(object):
def __init__( self, request, columns, index, table, cursor):
self.columns = columns
self.index = index
self.table = table
# values specified by the datatable for filtering, sorting, paging
@adamgreig
adamgreig / 00-README.md
Last active August 12, 2022 08:37
Run embedded Rust code on your STM32F4

Embedded Rust on STM32F4

My notes from implementing Job Vranish's excellent guide.

Follow along with the guide above, getting rustc from rustup or similar:

rustc 1.0.0-nightly (dcaeb6aa2 2015-01-18 11:28:53 +0000)
binary: rustc
commit-hash: dcaeb6aa23ecba2dc2af870668a9239136d20fa3

commit-date: 2015-01-18 11:28:53 +0000

@NatashaTheRobot
NatashaTheRobot / WatchConnectivitySingletonDemo.swift
Last active December 29, 2022 14:44
WatchConnectivity Singleton Demo
//
// WatchSessionManager.swift
// WatchConnectivityDemo
//
// Created by Natasha Murashev on 9/3/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
//
import WatchConnectivity
@jlblancoc
jlblancoc / gist:44be9d4d466f0a973b1f3808a8e56782
Last active February 16, 2023 15:45
GCC sanitizer with CMake

For memory leaks

Build in CMake with these params:

CMAKE_CXX_FLAGS:STRING= -fsanitize=address  -fsanitize=leak -g
CMAKE_C_FLAGS:STRING=-fsanitize=address  -fsanitize=leak -g
CMAKE_EXE_LINKER_FLAGS:STRING=-fsanitize=address  -fsanitize=leak
CMAKE_MODULE_LINKER_FLAGS:STRING=-fsanitize=address  -fsanitize=leak

Which can be done with:

@insin
insin / bash_prompt.sh
Created December 3, 2011 01:49 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to active virtualenv, git branch and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@vjeranc
vjeranc / penrose-tiling.frag
Last active December 17, 2023 06:08
Fragment shader tiling the Las Vegas sphere in Penrose https://whenistheweekend.com/theSphere.html
#define phi 1.61803398874989484820
#define h 1.53884176858762670128
uniform float time;
varying vec2 vUv;
varying vec3 vNormal;
float cx(in vec2 a, in vec2 b) {
return a.x * b.y - a.y * b.x;
}
@Geoff-Ford
Geoff-Ford / composing-software.md
Last active March 3, 2024 08:48
Eric Elliott's Composing Software Series

Eric Elliott's "Composing Software" Series

A collection of links to the excellent "Composing Software" series of medium stories by Eric Elliott.

Edit: I see that each post in the series now has index, previous and next links. However, they don't follow a linear flow through all the articles with some pointing back to previous posts effectively locking you in a loop.