Skip to content

Instantly share code, notes, and snippets.

View tnishinaga's full-sized avatar

Toshifumi NISHINAGA tnishinaga

  • Japan
  • 16:50 (UTC +09:00)
View GitHub Profile
@tnishinaga
tnishinaga / load_kernel.py
Created July 10, 2017 15:34
STM32F746-discovery boardにkernelを読み込むgdbスクリプト
#!/usr/bin/env python
# wait until SDRAM enabled(U-Boot working)
gdb.execute("monitor reset run")
gdb.execute("monitor sleep 1000")
gdb.execute("monitor halt")
# load dtb and Kernel
gdb.execute("load vmlinux")
gdb.execute("restore arch/arm/boot/dts/stm32f746-disco.dtb binary 0xC0004000")
@tnishinaga
tnishinaga / reg_concept.c
Created April 12, 2017 10:53
マイコンのレジスタをよくあるdefine文以外の方法でレジスタの設定するコードのイメージ。
typedef struct {
const struct {
uint32_t CTSEN;
uint32_t RTSEN;
uint32_t RTS;
uint32_t DTR;
uint32_t RXE;
uint32_t TXE;
uint32_t LBE;
uint32_t SIRLP;
@tnishinaga
tnishinaga / fan_ctrl.sh
Created January 7, 2017 06:47
Auto fan control script for Raspberry Pi
#!/bin/bash
temp_on=50000
temp_off=45000
#connected to GPIO18
fan_gpio=18
temp=`cat /sys/class/thermal/thermal_zone0/temp`
# init GPIO
@tnishinaga
tnishinaga / README_ja.md
Created October 15, 2016 07:51
Patch filename renamer

LKMLのパッチ名からファイル名をリネームするスクリプト

これなに

MLのArchiveからgit mailsplitでsplitし、特定の一連のパッチをとりだしたあと、パッチのファイル名をパッチの番号で置き換えるためのスクリプトです。

使い方

変数名 役割
@tnishinaga
tnishinaga / json_server_test.rb
Created May 21, 2016 07:49
RubyでGETに対しJSON返すだけのサンプル
require "json"
hoge = {
"hoge" => "fuga"
}.to_json
require 'webrick'
srv = WEBrick::HTTPServer.new({:BindAddress => '127.0.0.1',
:Port => 10080})
srv.mount_proc("/") { |req, res|
@tnishinaga
tnishinaga / elf_search.c
Created December 20, 2015 23:55
ELFのシンボルとそのアドレス引くやつ
#include <stdio.h>
#include <elf.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
void hoge(){
printf("hoge!\n");
}