Skip to content

Instantly share code, notes, and snippets.

Avatar

Motoi Shimizu motoishmz

View GitHub Profile
@ksasao
ksasao / luminometer.ino
Created Feb 1, 2022
M5StickC 環境光センサ Hat。ロームのBH1750FVを利用 。 https://twitter.com/ksasao/status/1488550499549065218
View luminometer.ino
#include <M5GFX.h>
#include <M5StickCPlus.h>
#include <M5_BH1750FVI.h>
M5GFX display;
M5_BH1750FVI sensor;
uint16_t lux;
void setup() {
View conv_utf8_to_sjis.cpp
auto conv_utf8_to_sjis = [](string srcUTF8) -> string
{
int lenghtUnicode = MultiByteToWideChar(CP_UTF8, 0, srcUTF8.c_str(), srcUTF8.size() + 1, NULL, 0);
wchar_t* bufUnicode = new wchar_t[lenghtUnicode];
MultiByteToWideChar(CP_UTF8, 0, srcUTF8.c_str(), srcUTF8.size() + 1, bufUnicode, lenghtUnicode);
int lengthSJis = WideCharToMultiByte(CP_THREAD_ACP, 0, bufUnicode, -1, NULL, 0, NULL, NULL);
char* bufShiftJis = new char[lengthSJis];
WideCharToMultiByte(CP_THREAD_ACP, 0, bufUnicode, lenghtUnicode + 1, bufShiftJis, lengthSJis, NULL, NULL);
string strSJis(bufShiftJis);
delete bufUnicode;
@kylemcdonald
kylemcdonald / FAT-lost.md
Last active Aug 29, 2015
The other reasons F.A.T. Lab died.
View FAT-lost.md

Today F.A.T. Lab shut its doors with this lovely note from Magnus Eriksson and Evan Roth.

But the "we lost to them" narrative is only one perspective. As a "virtual research fellow" since 2011, I had the opportunity to both look up to F.A.T. as an outsider for its first half, and get the inside scoop for the second half. But my first project appears on page 20 of the blog's 200+ pages. With that in mind, here are some other stories about why F.A.T. "lost":

  1. F.A.T. lost its rowdy juvenile edge when almost everyone got married, had kids, got (mostly) real jobs. The biggest producers from early F.A.T. effectively "retired" from producing F.A.T.-style work.
  2. There was not enough new energy to replace these retired members. To fix this, sometimes a member would propose adding someone. Inevitably, someone else would suggest they "weren't F.A.T. enough", or just thinking about how many inactive members we had, and how much of a boys club it was, would get us down and discussion woul
View ffmpeg.md

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

View ofxNanoSVG.h
#pragma once
#define NANOSVG_IMPLEMENTATION
#include "nanosvg.h"
class ofxNanoSVG
{
public:
bool load(const string& filepath)
@shobhitg
shobhitg / server.js
Last active Mar 12, 2022
File upload example using busboy with express
View server.js
var path = require('path');
var fs = require('fs');
var os = require('os');
var express = require('express');
var app = express();
var Busboy = require('busboy');
app.get('/', function (req, res) {
res.send('<html><head></head><body>\
<form method="POST" enctype="multipart/form-data">\
@rtt
rtt / tinder-api-documentation.md
Last active Sep 10, 2022
Tinder API Documentation
View tinder-api-documentation.md

Tinder API documentation

Note: this was written in April/May 2014 and the API may has definitely changed since. I have nothing to do with Tinder, nor its API, and I do not offer any support for anything you may build on top of this. Proceed with caution

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

@sponomarev
sponomarev / command.sh
Created Nov 9, 2013
Remove iTerm2 icon from Dock
View command.sh
# remove
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
# restore
/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm.app/Contents/Info.plist
@novi
novi / bmpcc.md
Last active Dec 22, 2015
Blackmagic Design Pocket Cinema Camera メモ
View bmpcc.md

たまにアップデートします

ボタンダブルクリックなどの操作もあるので一度説明書は読んだほうがよい。 サポートからダウンロードできるアプリで本体のファームウェアをアップデートできる。(ファームはネット経由の自動アップデートではないので毎回自分でアプリを更新する)

電源

  • 電池フル充電で1時間持たない。40分くらい。
  • Nikon純正の互換予備バッテリ必須。
@keijiro
keijiro / fbm-camera-shaking-effect.md
Created Sep 16, 2012
Perlin Noise (fBm) を使ったカメラ揺れエフェクト
View fbm-camera-shaking-effect.md

Perlin Noise (fBm) を使ったカメラ揺れエフェクト

概要

Perlin Noise (fBm 関数)をオブジェクトの動きに取り入れることによって、色々と面白い効果が生み出せます。例えば、これを位置と回転に適用するだけで、カメラの手ブレ風エフェクトなどを作り出せます。

サンプル

http://keijiro.github.com/unity-perlin/