Skip to content

Instantly share code, notes, and snippets.

View shoito's full-sized avatar
🏠
Working from home

shoito shoito

🏠
Working from home
View GitHub Profile
@rmeissner
rmeissner / safe_sig_gen_uport_eip712.ts
Last active March 12, 2023 19:54
Example Safe signature generation with uport eip712 lib
import EIP712Domain from "eth-typed-data";
import BigNumber from "bignumber.js";
import * as ethUtil from 'ethereumjs-util';
import { ethers } from "ethers";
import axios from "axios";
/*
* Safe relay service example
* * * * * * * * * * * * * * * * * * * */
@devgrok
devgrok / cloud-init-cloudwatch-agent
Created July 2, 2018 11:32
Installs CloudWatch Agent for monitoring ECS-Agent log files
Content-Type: multipart/mixed; boundary="==BOUNDARY=="
MIME-Version: 1.0
--==BOUNDARY==
MIME-Version: 1.0
Content-Type: text/cloud-boothook; charset="us-ascii"
#!/bin/bash +x
# optionally set ECS agent options (increase base container size)
cloud-init-per once docker_options echo 'OPTIONS="${OPTIONS} --storage-opt dm.basesize=100G"' >> /etc/sysconfig/docker
@azu
azu / server-react.md
Last active February 25, 2021 04:30
サーバサイドとReact production build

サーバサイドとReact

要約: Reactをサーバサイドで使うときも、クライアントサイドのように圧縮(code eliminate)しないと遅いよ

Reactはdev向けのコードを大量に含んでいる。 これはprocess.env.NODE_ENV !== 'production'の時実行されるassertや警告などが主となりproductionには必要ない。 そのため、process.env.NODE_ENV = 'production'をしないとかなり不利な結果を得る。

I tend to agree that "compiling server side code with webpack to remove access to process" is not what Node developers would typically do, and likely many React users are not even aware of this possibility. So the current results are probably more representative of React SSR perf in the wild. However, it can also be a bit unfair to not show React's perf with full optimization.

Get/set ID3 meta tags using ffmpeg

A quick guide on how to read/write/modify ID3 metadata tags for audio / media files using ffmpeg.

FFmpeg has a free-form command line option that allows the user to specify key-value-pairs for encoding metadata. Let's take a look.

1. Read ID3 metadata

To list all global metadata tags for a media file, just set an input but no output file.

@azu
azu / react-toggle.md
Last active August 22, 2018 02:01
ReactでToggleコンポーネントを作るケース
  1. ABToggleButtonのような実装を各Toggleしたいコンポーネントごとに作る
    • クラスが増える
    • class ABToggleButton extends React.Component{}
    • ToggleButtonごとに明示的な名前をつけられる
    • <ABToggleButton isEditing={true}/>
    • 必要なコンポーネント = 3ファイル
  2. 関数を使う
    • 引数にa, b
    • createToggleButton(a, b);
  • 高階関数を使うパターン
@mercul3s
mercul3s / gist:56d73cb74ed71bf0813e
Created September 3, 2014 20:34
Example dashing job for elasticsearch cluster health
require 'elasticsearch'
# defaults to "localhost"
client = Elasticsearch::Client.new log: true
SCHEDULER.every '5s', :first_in => 0 do |job|
health = client.cluster.health
send_event('es_health', {value: health['status']})
end
@voluntas
voluntas / shiguredo.rst
Last active June 6, 2024 02:04
時雨堂コトハジメ
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
@voluntas
voluntas / shiguredo_tech.rst
Last active April 11, 2024 08:30
時雨堂を支える技術

時雨堂を支える技術

日時:2024-04-11
作:時雨堂
バージョン:2024.4
URL:https://shiguredo.jp/

時雨堂クラウドサービスを支える技術