Skip to content

Instantly share code, notes, and snippets.

View ryochin's full-sized avatar
🏠
Working at home

Ryo Okamoto ryochin

🏠
Working at home
View GitHub Profile
@ryochin
ryochin / Dockerfile
Last active February 5, 2023 22:27
openresty with ngx_http_proxy_connect_module
FROM debian:stable-slim
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libssl-dev ca-certificates wget git \
libpcre3 libpcre3-dev zlib1g zlib1g-dev \
&& apt-get clean
WORKDIR /tmp
RUN git clone --depth=1 https://github.com/chobits/ngx_http_proxy_connect_module.git ngx_http_proxy_connect_module \
--- a/ee.c 2019-01-22 12:05:19.000000000 +0900
+++ b/ee.c 2019-01-22 12:06:06.000000000 +0900
@@ -74,6 +74,7 @@
#endif
#include <signal.h>
+#define SIGUNUSED 31
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
@ryochin
ryochin / easyedit.rb
Created January 22, 2019 03:17
A homebrew formula of easyedit (ee) on FreeBSD
class Easyedit < Formula
desc "Easy editor on FreeBSD"
homepage "http://mahon.cwx.net/"
# url "https://mirrors.ustc.edu.cn/macports/distfiles/ee/ee-1.4.6.src.tgz"
# sha256 "a85362dbc24c2bd0f675093fb593ba347b471749c0a0dbefdc75b6334a7b6e4c"
url "http://web.archive.org/web/20120206120635/http://mahon.cwx.net/sources/ee-1.5.2.src.tgz"
sha256 "e08d7511a48b43ee354042fe3fe7d9cb3431238caedcf4ac729c61a447003918"
@ryochin
ryochin / python3_pit.patch
Created January 31, 2019 11:43
python3 patch for pit
diff --git a/pit.py b/pit.py
index 8b3dadd..47d8165 100644
--- a/pit.py
+++ b/pit.py
@@ -31,7 +31,7 @@ class Pit:
os.remove(path)
if result == c:
- print 'No Changes'
+ print('No Changes')
#!/bin/bash
# https://qiita.com/uasi/items/430f9403ac9b437c0499
# * -R を削除し固定した
# * 同名のファイルが存在する場合にエラーになる問題を修正した
# * 日付フォーマットを変更した
# * 現在のブランチにマークを付けた
# * いくつかのブランチを特別な色で表示するよう変更した
USAGE="\
usage: git branch-activity [-r | -a] [--no-color]
@ryochin
ryochin / userContent.css
Last active June 5, 2019 02:39
nicer Firefox Source Viewer CSS
@-moz-document url-prefix(view-source) {
body {
margin: 2px;
background-color: #333333;
color: #c5c5c5;
}
#viewsource {
font-size: 11pt;
line-height: 130%;
@ryochin
ryochin / geocoder.rb
Last active June 5, 2019 02:37
download geoip database file for authtrail gem on rails
Geocoder.configure(
ip_lookup: :geoip2,
geoip2: {
file: Rails.root.join('var', 'GeoLite2-City.mmdb')
},
language: :ja
)
@ryochin
ryochin / is_ie.ts
Created July 1, 2019 05:51
IE detection in TypeScript
import * as _ from 'lodash'
import * as Bowser from 'bowser'
isIE(): boolean {
const browser: Bowser.Parser.Parser = Bowser.getParser(window.navigator.userAgent)
const result: boolean | undefined = browser.satisfies({
windows: {
'internet explorer': '>0'
}
axios.interceptors.request.use((config: Axios.AxiosRequestConfig) => {
if (_.isUndefined(typeof config.params)) {
config.params = {}
}
if (_.isObject(config.params)) {
// prevent caching on IE
if (_.isFunction(URLSearchParams) && config.params instanceof URLSearchParams) {
config.params.append('_', Date.now())
}
@ryochin
ryochin / recursive_call.exs
Last active October 28, 2019 04:06
[Elixir] Call myself recursively
import :timer
defmodule Test do
def run(n) do
IO.puts "run: #{n}"
:timer.sleep(seconds(1))
{myfunc, _} = __ENV__.function
apply(__ENV__.module, myfunc, [n + 1])
end