Skip to content

Instantly share code, notes, and snippets.

Avatar
🌸

久我山菜々 nna774

🌸
View GitHub Profile
View jq_or_cat
#! /bin/bash
# どうせjsonっぽいものにしか使わないから有限長でしょ。
STDIN=$(cat)
echo "${STDIN}" | jq "$@" > /dev/null 2>&1
if [ $? -eq 0 ]; then
# 前段で出力をバッファしたりすると、色とかが消えちゃうのでもう一回実行する。
echo "${STDIN}" | jq "$@"
View all_see_eye.sh
#! /bin/bash -xeu
BUCKET='nana-camera'
: ${SLACK_WH:?'define SLACK_WH'}
report() {
local MSG=${1:-'コケた'}
curl -X POST --data-urlencode "payload={\"text\": \"${MSG}\"}" ${SLACK_WH}
}
View report.rb
#! /usr/bin/env ruby
require 'json'
require 'shellwords'
require 'net/https'
require 'uri'
MAHIRO = URI.parse "~~"
MORI = URI.parse "~~"
View vimrc
syntax enable
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set smartindent
set number
@nna774
nna774 / otomemaru.txt
Last active Oct 23, 2018
yuniちゃんのヘッダ
View otomemaru.txt
1100101010000110001101100010111010100110001001101111101011111010101011110110000111000100000010011110000011000001000100001001111011011001101001001000001011000110010100000110001001010011000001011110000001101001000101001101111001010110011100010111011011010100
View deflate.cpp
#include <algorithm>
#include <memory>
#include "deflate.h"
#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
#include "miniz.c"
// using std::begin;
// using std::end;
@nna774
nna774 / qif.gs
Last active Jul 16, 2018
かけいぼgoogle app script
View qif.gs
function date2str(date, sep) {
function pad(number) {
return number < 10 ? "0" + number : number.toString();
}
return date.getYear() + sep + pad(date.getMonth()+1) + sep + pad(date.getDate());
}
function toQif(date, desc, debit, credit, amount) {
return [
"!Clear:AutoSwitch",
View imagediff.sh
#! /bin/bash -e
if [ $# -ne 2 ]; then
CMD=`basename $0`
echo "$CMD A.jpg B.png" 1>&2
exit 1
fi
TMP=`mktemp --suffix=.png`
@nna774
nna774 / get_tenki.sh
Last active Oct 31, 2017
天気予報を保存します。
View get_tenki.sh
#! /bin/bash -xe
BASE="/home/nona7/codes/tenki"
DATE=`date +'%Y/%m/%d'`
JIKKYO="${BASE}/data/${DATE}-jikkyo12.txt"
TSUHO="${BASE}/data/${DATE}-tsuho12.txt"
mkdir -p "${BASE}/data/`date +'%Y/%m'`"
wget http://www.data.jma.go.jp/fcd/yoho/gyogyou/jikkyo12.txt -O "${JIKKYO}"
@nna774
nna774 / journalctl
Created Apr 21, 2017
mastodon-daily.service
View journalctl
Apr 22 02:04:21 yumemi systemd[1]: Starting mastodon daily jobs...
Apr 22 02:04:21 yumemi docker-compose[2090]: Traceback (most recent call last):
Apr 22 02:04:21 yumemi docker-compose[2090]: File "/usr/lib/python3.6/site-packages/dockerpty/pty.py", line 334, in start
Apr 22 02:04:21 yumemi docker-compose[2090]: self._hijack_tty(pumps)
Apr 22 02:04:21 yumemi docker-compose[2090]: File "/usr/lib/python3.6/site-packages/dockerpty/pty.py", line 367, in _hijack_tty
Apr 22 02:04:21 yumemi docker-compose[2090]: read_ready, write_ready = io.select(read_pumps, write_streams, timeout=60)
Apr 22 02:04:21 yumemi docker-compose[2090]: File "/usr/lib/python3.6/site-packages/dockerpty/io.py", line 59, in select
Apr 22 02:04:21 yumemi docker-compose[2090]: timeout,
Apr 22 02:04:21 yumemi docker-compose[2090]: File "/usr/lib/python3.6/site-packages/dockerpty/io.py", line 351, in fileno
Apr 22 02:04:21 yumemi docker-compose[2090]: return self.from_stream.fileno()