Skip to content

Instantly share code, notes, and snippets.

@nna774
nna774 / 20250117.rb
Last active January 24, 2025 18:14
1012
def size = 400
def shake(base:, width:)
base + width / 2 - rand(width)
end
foots = 6.times.map { }
def setup
createCanvas(size, size)
# frozen_string_literal: true
source 'https://rubygems.org'
# gem "rails"
gem 'rubocop', '=1.67.0'
@nna774
nna774 / bookmark.js
Last active December 11, 2023 07:40
乗りつぶしオンライン 画像をsvgからpngへ。
javascript:(function () {
var map = document.getElementById('map');
map.width = 1800; // 特に意味のある値ではない。小さいとガビるので、適当にこれぐらい。元々のmapはサイズの指定のないimgなので適当に画面幅とかになっている?
var c = document.createElement('canvas');
c.width = map.width;
c.height = map.height;
var ctx = c.getContext('2d');
ctx.drawImage(map, 0, 0);
map.src = c.toDataURL();
})();
if ENV['MACKEREL_AGENT_PLUGIN_META'] == '1'
require 'json'
meta = {
:graphs => {
'dns.querytime' => {
:label => 'time',
:unit => 'integer',
:metrics => [
{
package main
import (
"flag"
"fmt"
"strconv"
)
type myVar struct {
V int64
@nna774
nna774 / main.cpp
Last active October 25, 2020 15:56
gyogun
#include <iostream>
#include <array>
#include <numbers>
#include <cmath>
int const N = 10;
int prev(int n) {
return (N + n - 1) % N;
}
double const dt = 0.0001;
@nna774
nna774 / co2.sh
Created September 23, 2020 12:53
HOST_ID='xxx'
API_KEY='xxx'
OUTS=`sudo get-co2`
CO2=`echo ${OUTS} | jq ".co2"`
TEMP=`echo ${OUTS} | jq ".temperature"`
TT=`echo ${OUTS} | jq ".TT"`
TIME=`date +%s`
JSON=$(cat << EOS
[
{
@nna774
nna774 / node.def
Created February 26, 2020 05:46
/opt/vyatta/share/vyatta-cfg/templates/interfaces/ipv6-tunnel/node.tag/encapsulation/node.def
type: txt
help: Encapsulation of this IPv6 tunnel interface [REQUIRED]
default: "ip6gre"
syntax:expression: $VAR(@) in "ip6gre", "ipip6", "any"; "Must be (ip6gre, ipip6, any)"
allowed: echo ip6gre ipip6 any
create:expression: "true"
update:expression: "false" ; \
"Encapsulation can only be set at tunnel creation for $VAR(../@)"
@nna774
nna774 / lifecycle.json
Created January 14, 2020 10:35
lifecycle.json
{
"lifecycle": {
"rule": [
{
"action": {
"type": "SetStorageClass",
"storageClass": "archive"
},
"condition": {
"age": 30
@nna774
nna774 / zatsu_monitor.yml
Last active January 4, 2020 07:28
zatsu_monitor.yml
default: &default
type: slack
channel: "#nana-memo"
webhook_url: https://hooks.slack.com/services/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
user_name: "zatsu_monitor(torifune)"
nna774.net:
<<: *default
check_url: "https://nna774.net/"
nna774.net/blog: