Skip to content

Instantly share code, notes, and snippets.

View mh-mobile's full-sized avatar
🏠
Working from home

mh-mobile mh-mobile

🏠
Working from home
View GitHub Profile
@mh-mobile
mh-mobile / answser1.js
Created August 18, 2022 12:14
js_problem
const array1 = [1, 2, 3, 4, 5, 6]
const array2 = array1.flatMap((x) => new Array(x % 2 == 0 ? 2 : 3).fill(null).map(() => x))
console.log(array2)
@mh-mobile
mh-mobile / pipr_macos.dockerfile
Last active April 5, 2023 06:59
piprのmacOSの設定
FROM ubuntu
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y curl && apt-get install -y jq
RUN curl -OL https://github.com/elkowar/pipr/releases/download/v0.0.16/pipr
RUN chmod +x ./pipr
RUN mv ./pipr /usr/local/bin
WORKDIR /var/pipr
RUN apt-get install bubblewrap
@mh-mobile
mh-mobile / review_requests_count.sh
Last active May 16, 2022 15:01
GitHubの指定のユーザーのreiew数を取得
#!/usr/bin/env bash
token=$1
shift
for user in "${@}"; do
echo "${user}: $(curl -s -H "Authorization: ${token}"\
"https://api.github.com/search/issues?q=is%3Apr+is%3Aopen+review-requested%3A${user}" \
| jq '.total_count')"
done
@mh-mobile
mh-mobile / net_add.sh
Last active December 21, 2021 03:15
bridge network
#/usr/bin/env bash
sudo ip netns add ns1
sudo ip netns add ns2
sudo ip netns exec ns1 ip link set lo up
sudo ip netns exec ns2 ip link set lo up
sudo ip link add br0 type bridge
sudo ip link add name ns-veth1 type veth peer name br-veth1
sudo ip link add name ns-veth2 type veth peer name br-veth2
sudo ip link set ns-veth1 netns ns1
@mh-mobile
mh-mobile / discord-enter-modification.json
Last active December 8, 2023 11:48
DiscordのEnterキーの挙動変更(Karabiner-Elements)- Enterで改行 / Command + Enterで送信
{
"title": "Discord-Enter-Modification",
"rules": [
{
"description": "Discord-Enter-Modification",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "return_or_enter"
use std::io;
trait Fruit {
fn get_size(&self) -> f32;
}
struct Apple {
size: f32,
}
@mh-mobile
mh-mobile / convert.rb
Last active October 30, 2020 02:48
Twitter API v1の日付フォーマットのISO8601変換
DateTime.parse("Fri Oct 30 02:20:44 +0000 2020").new_offset("+09:00").iso8601
@mh-mobile
mh-mobile / twitter_retweet_search.rb
Last active October 29, 2020 03:36
request twitter retweet search
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
gem "activerecord", "6.0.0"
end
@mh-mobile
mh-mobile / twitter_quote_search.rb
Created October 29, 2020 02:52
require twitter quote search
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
gem "activerecord", "6.0.0"
end
@mh-mobile
mh-mobile / twitter_event_search.rb
Last active October 30, 2020 01:47
request Twitter Event Search
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
gem "activerecord", "6.0.0"
end