Skip to content

Instantly share code, notes, and snippets.

Avatar
🤗

Naotoshi Seo sonots

🤗
View GitHub Profile
View retry.sh
#!/usr/bin/env bash
PROGNAME=$(basename $0)
function usage() {
echo "Usage: $PROGNAME [-c MAX_RETRY] [-s INTERVAL_SEC] -- COMMAND" 1>&2
echo " Retry a command if failed" 1>&2
echo "" 1>&2
echo "Options:" 1>&2
echo " -h, --help Show this message" 1>&2
View GKE fluentd-gcp warning logs.txt
2019-11-28 08:15:11 +0000 [info]: parsing config file is succeeded path="/etc/google-fluentd/google-fluentd.conf"
2019-11-28 08:15:12 +0000 [info]: Detected GCE platform
2019-11-28 08:15:12 +0000 [info]: Logs viewer address: https://console.cloud.google.com/logs/viewer?project=teak-kit-226806&resource=container/instance_id/7530681816608554840
2019-11-28 08:15:12 +0000 [info]: Detected GCE platform
2019-11-28 08:15:12 +0000 [info]: Logs viewer address: https://console.cloud.google.com/logs/viewer?project=teak-kit-226806&resource=gce_instance/instance_id/7530681816608554840
2019-11-28 08:15:12 +0000 [info]: Detected GCE platform
2019-11-28 08:15:12 +0000 [info]: Logs viewer address: https://console.cloud.google.com/logs/viewer?project=teak-kit-226806&resource=container/instance_id/7530681816608554840
2019-11-28 08:15:13 +0000 [warn]: 'time_format' specified without 'time_key', will be ignored
2019-11-28 08:15:13 +0000 [warn]: 'filters' parameter is deprecated: filters has been renamed as matches
2019-11-28 08:1
@sonots
sonots / runs-on: ubuntu-latest.txt
Last active Jul 28, 2020
Environment Variables on Github Actions
View runs-on: ubuntu-latest.txt
GOROOT_1_11_X64=/usr/local/go1.11
ANDROID_HOME=/usr/local/lib/android/sdk
JAVA_HOME_11_X64=/usr/lib/jvm/zulu-11-azure-amd64
ImageVersion=20190930.2
LANG=C.UTF-8
INVOCATION_ID=029524e610de4329ac57a8f3e8b21281
JAVA_HOME_12_X64=/usr/lib/jvm/zulu-12-azure-amd64
ANDROID_SDK_ROOT=/usr/local/lib/android/sdk
RUNNER_TOOL_CACHE=/opt/hostedtoolcache
JAVA_HOME=/usr/lib/jvm/zulu-11-azure-amd64
View cupy_convolution_forward_example.py
dtype = numpy.float32
batch_size = 2
in_channels = 3
out_channels =2
kernel_size = (3, 3, 1)
stride = (1, 1, 1)
pad = (0, 0, 0)
in_dims = (1000, 768, 3)
out_dims = (998, 766, 3)
x_shape = (batch_size, in_channels) + in_dims
View numo-linalg with openblas at mac.md
$ brew install openblas
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openblas/lib
    CPPFLAGS: -I/usr/local/opt/openblas/include
For pkg-config to find this software you may need to set:
View gist:bdce8e970227eeb7bb0d29d0fa03452c
Is is asynchronous? or synchronous? How can we run asynchronously?
View Ruby without GVL in C Ext.md

rb_thread_call_without_gvl を使う

例えば普通に書くと

nvrtcResult status = nvrtcCreateProgram(&_prog, _src, _name, _numHeaders, _headers, _includeNames);

となる C 関数の呼び出しを、GVLを外して呼び出すには、

View gdb with ruby.md

bundle exec gdb とやると環境変数が渡って楽

$ bundle exec gdb ruby
gdb> run test.rb

コマンドラインで ruby への引数も渡したいときは --args オプションが使える。 ちなみに man gdb には出てこないが、gdb --help には出てくるオプション。

View CUDA Bus error.md

It occurred when I did not wait GPU process finishes.

#include <stdio.h>
#include <cuda_runtime.h>

__global__
void my_kernel(int val, int *A, int N)
{
    int i = threadIdx.x;
@sonots
sonots / preprocessor.pyx
Created Oct 13, 2017
preprocessor in cython
View preprocessor.pyx
# A trick to embed preprocessors in cython
cdef extern from *:
cdef void EMIT_IF_PYTHON_VERSION_HEX_LT_37 "#if PY_VERSION_HEX < 0x03070000 //" ()
cdef void EMIT_ELSE "#else //" ()
cdef void EMIT_ENDIF "#endif //" ()
EMIT_IF_PYTHON_VERSION_HEX_LT_37()
EMIT_ELSE()
You can’t perform that action at this time.