Skip to content

Instantly share code, notes, and snippets.

View harujoh's full-sized avatar
💭
I'm fine.

harujoh

💭
I'm fine.
View GitHub Profile
@t-sin
t-sin / README.md
Last active February 27, 2022 13:02
my first (ARMv6) assembly program

ARMv6 assembly language study

to run

on Raspberry PI (Raspbian)

as -o test.o test.s && ld -o test test.o && ./test

on x86 Ubuntu

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import random
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
from chainer import reporter
@ksasao
ksasao / detect_marker.py
Last active December 10, 2023 02:38
ZOZOSUITのマーカーのIDを読み取るコードです。公開されている画像を元に独自に解析しているので、公式ではこのように処理しているかどうかは不明です。仕様等については https://twitter.com/ksasao/status/990779583682170881 のスレッドも参照してください。全身を読み取るコード https://twitter.com/ksasao/status/989842844243279872 ライセンスは Apache License 2.0 です。
import numpy as np
import random
import math
import cv2
from PIL import Image
import sys
def detect_markers(im):
markers = []
# 輪郭線抽出のための二値化
@ufcpp
ufcpp / MakePrimitiveContravariant.cs
Last active February 9, 2018 05:49
カリー化するとチョットハヤイ
using System;
static class Program
{
static void M(Action<int> a)
{
a(10);
}
static void Main()
@asimshankar
asimshankar / README.md
Last active April 13, 2024 15:50
Training TensorFlow models in C

Training TensorFlow models in C

Python is the primary language in which TensorFlow models are typically developed and trained. TensorFlow does have bindings for other programming languages. These bindings have the low-level primitives that are required to build a more complete API, however, lack much of the higher-level API richness of the Python bindings, particularly for defining the model structure.

This gist demonstrates taking a model (a TensorFlow graph) created by a Python program and running the training loop in a C program.

The model

@ufcpp
ufcpp / GCHandleReuse.cs
Created November 17, 2017 11:07
GCHandle の値、どこかのスロットのアドレスがたぶん帰ってきてる。かつ、Free したスロットは即座に再利用されてる
using System;
using System.Runtime.InteropServices;
class X { }
class Y { }
public class Program
{
static void Main()
{
@ufcpp
ufcpp / Converter.cs
Last active February 9, 2018 05:51
デリゲートの引数変換
using System;
// https://gist.github.com/AArnott/d285feef75c18f6ecd2b と同種の最適化、デリゲートの引数変換にも使えそうという話。
static class DelegateAdapter
{
// こっちだと、action をフィールドに持つクラスが1個作られて、
// var temp = new その匿名クラス();
// new Action(temp.Method);
// みたいなコードになる。
public static Action<int> ConvertSlow(Action<Alias> action) => x => action(new Alias(x));
@kokeiro001
kokeiro001 / ImageExtractor.cs
Last active April 3, 2022 01:40
ffmpegを使って動画から画像を抽出するやつ
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace FfmpegPipeSandbox
{
class Program
@ufcpp
ufcpp / CovariantClass.cs
Created September 28, 2017 01:47
道を踏み外すかどうかの瀬戸際な共変アップキャスト
using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
interface ICovariant<T> // Task<T> とか (bool, T) を含むので out は付けれない
where T : class
{
T A();
Task<T> B();
(bool, T) C();
@ufcpp
ufcpp / SafeCrash.cs
Last active December 21, 2017 13:14
セキュリティホール作るのに unsafe なんて要らなかった
using System;
using System.Runtime.InteropServices;
class Base { }
class Derived : Base
{
// 1個や2個だと「たまたま0詰め」な領域を指すかもしれないので無駄にたくさんフィールド並べる
public long A { get; }
public long B { get; }
public long C { get; }