Skip to content

Instantly share code, notes, and snippets.

View rsp9u's full-sized avatar

rsp9u rsp9u

  • Japan
View GitHub Profile
  • from toが第一引数, 第二引数で書ける
  • デフォルトの対象ファイルがカレントからの再帰
  • 表示がgit diff, patch形式
  • デフォルトが上書き動作。オプションでdry-run(diffだけ出る)

example

$ ar from to -dry | tee x.patch
diff --git a/test.file b/test.file
index 0113cbc..94eae1f 100644
from timeit import timeit
forloop = """
arr = []
for i in range(10000):
arr.append(i*i)
"""
listcomp = """
arr = [i*i for i in range(10000)]
import feedparser
from datetime import datetime
dt_fmt = "%a, %d %b %Y %H:%M:%S %Z"
def rss2mm(feed_url, until, max_n=3):
ret_lines = []
f = feedparser.parse(feed_url)
for idx, e in enumerate(f["entries"]):
@rsp9u
rsp9u / CMakeLists.txt
Last active April 5, 2021 04:04
cmake build with OpenCV 3,4,13 & Android NDK r17c
cmake_minimum_required(VERSION 3.4.1)
project(hello-jni)
set(OpenCV_DIR "/path/to/OpenCV-android-sdk/sdk/native/jni/abi-armeabi-v7a")
find_package(OpenCV REQUIRED)
set(CMAKE_CXX_FLAGS "-O2 -std=c++11 -Wno-format-security --include-directory-after /path/to/android-ndk-r17c/sysroot/usr/include/arm-linux-androideabi")
add_library(hello-jni SHARED hello-jni.cpp)
@rsp9u
rsp9u / run.sh
Last active August 5, 2020 23:57
Terminal Sharing by ttyd/docker/tmux
$ docker run --rm --name docker-tmux -td -v $PWD/tmux.conf:/root/.tmux.conf squallcx/docker-tmux tmux new -A -s ttyd
$ ttyd docker exec -ti docker-tmux tmux new -A -s ttyd
@rsp9u
rsp9u / Dockerfile
Created June 25, 2020 18:21
Source build faiss-cpu without avx
FROM centos:7
RUN yum groupinstall -y "Development tools"
WORKDIR /src
RUN git clone https://github.com/kyamagu/faiss-wheels.git &&\
cd faiss-wheels &&\
git submodule init &&\
git submodule update
RUN yum install -y wget pcre pcre-devel &&\
wget https://downloads.sourceforge.net/swig/swig-4.0.1.tar.gz &&\
@rsp9u
rsp9u / Dockerfile
Created February 13, 2020 06:57
Alpine tmux build
FROM alpine
RUN apk add --no-cache gcc g++ make automake autoconf pkgconfig git libevent-dev ncurses-dev byacc bsd-compat-headers
RUN \
git clone https://github.com/tmux/tmux.git && \
cd tmux && \
./autogen.sh && \
./configure && \
make && \
make install
@rsp9u
rsp9u / example
Created January 9, 2020 08:38
Convertor for drawing a plantuml gantt chart with new syntax in Growi. This should be added to Custom Script.
@startgantt
project starts the 2020/1/1
-- milestones --
[マイルストーンA] as msA
[マイルストーンB] as msB
[マイルストーンC] as msC
-- tasks --
[タスク1] as task1
@rsp9u
rsp9u / plantuml_encoder.go
Created December 27, 2019 16:26
The PlantUML encoder written by Go
package pumlencode
import (
"bytes"
"compress/zlib"
"encoding/base64"
)
func makeTable() map[rune]rune {
src := []rune{}
@rsp9u
rsp9u / Raspi2-Arch.md
Created December 14, 2019 04:21
Installation guide of Archlinux into Raspberry Pi 2
  1. Write to a SD card on the existing linux machine
    # pacman -Syu dosfstools
    # cfdisk /dev/sdb
    # mkfs.vfat /dev/sdb1
    # mkfs.ext4 /dev/sdb2
    # mount /dev/sdb2 /mnt
    # mkdir /mnt/boot
    # mount /dev/sdb1 /mnt/boot
    # wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz  #see https://archlinuxarm.org/about/downloads