Skip to content

Instantly share code, notes, and snippets.

pi@raspberrypi ~/qpuinfo $ git log -1 -p
commit d3d4745808231202a19365458e283d730e3d1a2e
Author: Terminus <i.can.speak.c.and.basic@gmail.com>
Date: Sun Feb 8 05:06:01 2015 +0900
change to point physical address, not bus address
Special thanks to @KOBA789 !
diff --git a/mapmem.c b/mapmem.c
@ginrou
ginrou / construct_lenna.py
Last active September 9, 2025 10:27
DCTでlennaを再構成する
#!/bin/env python
import numpy as np
import scipy.misc
from scipy.fftpack import dct, idct
import sys
H = 128
W = 128
lenna = scipy.misc.imresize(scipy.misc.lena(), (H, W)).astype(float)
@shyouhei
shyouhei / gist:0b7dab3e75bfbf96f895
Created March 31, 2015 15:26
新社会人の人が留意すべき事項

新社会人に必須である:

  • 勤務先との書面による「労働契約」。業務委託契約等NG。
  • 多寡を問わず毎月払われる給料。遅配等論外である。
  • 健康保険。
  • 労災保険。
  • 雇用保険。
  • 三六協定。
  • 年次有休。
  • 育児休業の制度があり取得者がいる会社に勤務する。
@gbaman
gbaman / HowToOTG.md
Last active April 8, 2026 17:09
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@rogerhub
rogerhub / smc.c
Created December 27, 2015 01:41
OS X script for getting fan speed and temperature, based off of Chris911/iStats
// clang -o smc smc.c -framework IOKit -framework CoreFoundation
/*
* Apple System Management Control (SMC) Tool
* Copyright (C) 2006 devnull
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
@stonehippo
stonehippo / docker_usb_guest_osx.md
Last active June 12, 2024 10:36
Getting a USB device to show up in a Docker container on OS X

Getting a USB device to show up in a Docker container on OS X

Some background

I was trying to get the Arduino IDE to work inside a Docker container on OS X. I was able to get the IDE working (see Getting X11 GUI applications to work on OS X with Docker), but I could not figure out how to make the USB port for the Arduino visible.

The solution

I first tried to directly map hardware serial port into the Docker container, doing something like this:

@scchan
scchan / saxpy.cpp
Last active October 12, 2018 16:11
hcc saxpy example
#include <random>
#include <algorithm>
#include <iostream>
#include <cmath>
// header file for the hc API
#include <hc.hpp>
#define N (1024 * 500)
@qnighy
qnighy / normalforms.md
Last active February 9, 2025 17:57
いろいろな標準形

Jordan標準形 (Jordan normal form)

K:代数閉体, V:有限次元のK-線形空間, f : V → V 線形写像のとき、Vの基底を上手く選ぶと表現行列がJordanブロックを対角線上に並べた行列になる。

この標準形はJordanブロックの順列を除いて一意である。

計算方法1: 固有方程式を解き固有値を得る。(A-λI)x=0となるxを探す。(A-λI)y=xとなるyを探す。これを止まるまで繰り返すことで基底の一部が得られる。別の固有ベクトルや別の固有値に対しても同様のことを行う。

有理標準形 (Frobenius normal form)

@Terminus-IMRC
Terminus-IMRC / Makefile
Last active May 8, 2020 14:25
An infinite loop in Makefile with remaking rules
$(info ** Remaking: MAKE_RESTARTS=$(MAKE_RESTARTS) **)
#
# If WAIT >= t, this Makefile will loop infinitely.
# If WAIT < t, it won't loop infinitely due to filesystem's time resolution.
# +------------+------+
# | Filesystem | t |
# +------------+------+
# | ext4 | 0.01 |
# | hfsplus | 1 |
@primenumber
primenumber / othello_solver.cu
Last active August 13, 2019 18:31
CUDA Othello Solver
// CUDA Othello Solver
// License: GPL 3
#include <cstdio>
#include <cassert>
constexpr int threadsPerBlock = 128;
constexpr int simdWidth = 4;
constexpr int nodesPerBlock = threadsPerBlock/simdWidth;
constexpr int MAX_DEPTH = 10;