Skip to content

Instantly share code, notes, and snippets.

@unagi
unagi / rakuten_shukei_monthly.js
Last active June 25, 2020 12:58
rakuten_shukei_monthly.js
(function () {
var total = 0;
var yearmon = '100010';
var year = '2012';
var month = '00';
function init(num) {
num = (typeof num !== 'number' ? 0 : num);
if (num === 0) {
$('<div/>').css({
position: 'fixed',
@unagi
unagi / metrics_log_from_datadog.sh
Created March 15, 2018 10:59
datadogからメトリクスをログ的にとってくるやつ
#!/bin/sh
api_key=xxxxxxxxxxxxxxxx
app_key=xxxxxxxxxxxxxxxxxxxxxx
to_time=$(date +%s)
from_time=$(date -d '10 minutes ago' +%s)
curl -G \
"https://app.datadoghq.com/api/v1/query" \
-d "api_key=${api_key}" \
@unagi
unagi / sophos_to_csv.py
Created February 14, 2018 10:58
Sophos Central
#!/usr/bin/env python
import json
import urllib.request
import csv
import traceback
import dateutil.parser
ep_url = 'https://api1.central.sophos.com/gateway/migration-tool/v1/endpoints'
@unagi
unagi / lambda_function.py
Last active December 27, 2017 01:45
utf-8のBOM付きCSVからtransformするっぽい何か(Python 3.6)
from __future__ import print_function
import base64
import json
from datetime import datetime
print('Loading function')
@unagi
unagi / ping.py
Last active January 11, 2017 08:46
ping for datadog
#!/usr/bin/env python
import subprocess
import re
import time
from checks.network_checks import NetworkCheck, Status
class PingCheck(NetworkCheck):
def __init__(self, name, init_config, agentConfig, instances):
@unagi
unagi / parse_aws_invoice_pdf.rb
Created December 13, 2016 05:17
AWS請求書のParseサンプル
#!/usr/bin/env ruby
require 'pdf-reader'
reader = PDF::Reader.new("invoice.pdf")
start_point = false
data = []
reader.pages[0].text.split("\n").each do |line|
next if line.length == 0
@unagi
unagi / code_checker.rb
Last active November 5, 2015 03:51
PHPコードのバグ探し(作成途中)
#!/usr/bin/env ruby
class PhpClass
attr_reader :filepath, :body
def initialize(filepath)
@filepath = filepath
end