Skip to content

Instantly share code, notes, and snippets.

Avatar

buty4649 buty4649

View GitHub Profile
@buty4649
buty4649 / mkr_inventry.rb
Last active December 21, 2022 03:49
Mackerel APIを使ってサーバインベントリ収集を行うスクリプト
View mkr_inventry.rb
#!/usr/bin/env ruby
# MIT License
#
# Copyright (c) 2022 buty4649
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@buty4649
buty4649 / boot.py
Last active September 14, 2022 03:04
Sparrow62(+1)用のキーマップ
View boot.py
import supervisor
import board
import digitalio
import storage
import usb_cdc
supervisor.set_next_stack_limit(4096 + 4096)
# disable USB storage, CDC
@buty4649
buty4649 / cloud-init-docker-setup.yaml
Created December 27, 2021 03:18
multipass launch --cloud-init cloud-init-docker-setup.yaml
View cloud-init-docker-setup.yaml
#cloud-config
timezone: Asia/Tokyo
locale: ja_JP.utf8
runcmd:
- apt-get remove -y docker docker-engine docker.io containerd runc
- apt-get update -y
- apt-get install-y ca-certificates curl gnupg lsb-release
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- apt-get update
View pandas.py
>>> pd = pd.DataFrame({'a':[1,2,3], 'b':[10,20,30], 'c':[100,200,300]}
>>> pd["a"]
0 1
1 2
2 3
Name: a, dtype: int64
>>> pd["a"].head(1)
0 1
Name: a, dtype: int64
@buty4649
buty4649 / settings.json
Created July 7, 2020 14:43
VSCodeVimで <details>〜</details>で括るやつ
View settings.json
"vim.visualModeKeyBindings": [
{
"before": ["<C-d>"],
"after": ["d", "o",
"<","d","e","t","a","i","l","s",">","<CR>",
"<","s","u","m","m","a","r","y",">","<","/","s","u","m","m","a","r","y",">","<CR>","<CR>",
"<","/","d","e","t","a","i","l","s",">","<","b","r",">","<ESC>","k","p","k","k","9","l"
]
}
]
@buty4649
buty4649 / gist:e858370ad8f87a066694e462bd2156cd
Last active July 6, 2020 16:26
引越し費用(2020年7月)
View gist:e858370ad8f87a066694e462bd2156cd

前提

引越し費用を見積もりにあたり、今回の場合以下のような前提条件があったのを最初に書いておく。 同じ条件でも変わることもあると思うので参考程度に。

  • 新居のオーナー特典で提携引越し業者を使うと様々な特典を得られた
    • 割引(20〜25%)
    • 資材が無料(ダンボールN箱無料など)
    • などなど
  • 同じ区内の引越し
View signal_test.rb
def exec
pids = []
pid = Process.fork do
Exec.execve_override_procname(ENV.to_hash, "sleep", "/bin/sleep", "10")
end
pids << pid
puts "sleep(pid: #{pid})"
th = SignalThread.trap(:INT, {detailed:true}) do |info|
View 20200124_octavia-servergroup.log
Script started on Fri 24 Jan 2020 11:09:46 PM JST
]0;root@api001: ~root@api001:~# bash servergroup.py
+ nyah_servergroup_add_member.py a0070db6-627c-47b4-b1ed-8acc8d2f30cf b535478d-fa6b-4068-8fd4-1b653c1d0d71
Option "logdir" from group "DEFAULT" is deprecated. Use option "log-dir" from group "DEFAULT".
Option "verbose" from group "DEFAULT" is deprecated for removal. Its value may be silently ignored in the future.
Option "notification_driver" from group "DEFAULT" is deprecated. Use option "driver" from group "oslo_messaging_notifications".
Could not load nova.openstack.common.notifier.rpc_notifier
Could not load nova.openstack.common.notifier.rpc_notifier
/usr/lib/python2.7/dist-packages/pymysql/cursors.py:158: Warning: '@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead
result = self._query(query)
View gist:22dc0da0fb341e8f74f576db858b7839
❯ docker run -it --rm centos:7 bash
[root@ebd7f940179c /]# mkdir test
[root@ebd7f940179c /]# cd test
[root@ebd7f940179c test]# chmod 000 .
[root@ebd7f940179c test]# find /tmp
/tmp
/tmp/.Test-unix
/tmp/ks-script-rnBCJB
/tmp/.font-unix
/tmp/.XIM-unix
View kitaichi.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.