Skip to content

Instantly share code, notes, and snippets.

@YOwatari
YOwatari / main.py
Last active September 18, 2023 07:54
The Amount of Code Written in Roughly One Month
import requests
from datetime import datetime, timedelta
TOKEN = ""
USERNAME = ""
one_month_ago = (datetime.now() - timedelta(days=30)).isoformat()
headers = {
"Authorization": f"token {TOKEN}",
@YOwatari
YOwatari / main.go
Created July 4, 2023 04:01
Go Uses FTPS (require_ssl_reuse=YES)
package main
import (
"crypto/tls"
"fmt"
"io"
"log"
"net"
"net/textproto"
"strconv"
@YOwatari
YOwatari / go.mod
Last active April 19, 2023 04:43
Get a rough list of domains from route53 and verify the certificate
module gist.github.com/3e268b08b9427b45941f5d3b88dbceb7
go 1.20
require (
github.com/aws/aws-sdk-go-v2 v1.17.8
github.com/aws/aws-sdk-go-v2/config v1.18.21
github.com/aws/aws-sdk-go-v2/service/route53 v1.27.7
golang.org/x/sync v0.1.0
)
@YOwatari
YOwatari / lastpass.js
Last active August 29, 2022 09:18
LastPassの共有フォルダのメンバーをcsvで引っ張ってくる
const table = document.querySelector('table.settings');
const settingsRow = Array.from(table.querySelectorAll('tr.settingsRow'));
const folderName = document.querySelector('#sharedFolderDialogTitle').innerText.replace('Manage Shared Folder: ', '') ;
const rows = settingsRow.map(tr => {
const row = [];
row.push(folderName);
tr.querySelectorAll('td').forEach(td => {
if (td.className == 'name') {
row.push(td.innerText);
@YOwatari
YOwatari / main.go
Created August 23, 2018 02:28
kinesis producer library put and get example
package main
import (
"flag"
"time"
"github.com/YOwatari/kinesis-aggregation-go"
"github.com/a8m/kinesis-producer"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
diff -up ext/openssl/ossl.c.ossl10 ext/openssl/ossl.c
--- ext/openssl/ossl.c.ossl10 2007-02-13 00:01:19.000000000 +0100
+++ ext/openssl/ossl.c 2009-08-26 12:29:41.000000000 +0200
@@ -92,7 +92,7 @@ ossl_x509_ary2sk(VALUE ary)
#define OSSL_IMPL_SK2ARY(name, type) \
VALUE \
-ossl_##name##_sk2ary(STACK *sk) \
+ossl_##name##_sk2ary(STACK_OF(type) *sk) \
{ \
@YOwatari
YOwatari / tour44.go
Last active November 18, 2015 04:51
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
n1, n2 := 0, 1
@YOwatari
YOwatari / gist:594b4803181fa635a5cf
Last active August 29, 2015 14:19
q学習による迷路探索を1時間で作ってみる
#!/usr/bin/env python
# coding: utf-8
import random
# 学習条件
ALPHA = 0.2 # Learning raito
GAMMA = 0.9 # discount ratio
SIGMA = 0.2 # greeding ratio
LEARNING_COUNT = 1000
@YOwatari
YOwatari / gist:454b31925e133f863975
Created April 9, 2015 09:45
macセットアップとかtipsとか.md

全般

  • キー配置の変更
    • Karabiner(KeyRemap4MacBookから名前が変わりました)
  • ショートカットカスタマイズ
    • BetterTouchTool(タッチパッドによるショートカットが便利。3本指クリックでタブ閉じとかできる)
  • アプリランチャー
    • Alfred
      • ちょっとした計算もできたり、有料の拡張でアプリ連携などが容易になる
    • Flashlight
  • 標準Spotlightを強化してくれる。最近話題になってきた。
@YOwatari
YOwatari / MakeSlideProgressLine.bas
Last active August 29, 2015 14:14
パワポにプログレスバーを追加するマクロ
Function hex2rgb(HexColor As String) As Long
'HEX表記をRGB値に変換する
Color = Replace(HexColor, "#", "")
Red = CInt("&H" & Mid(Color, 1, 2))
Green = CInt("&H" & Mid(Color, 3, 2))
Blue = CInt("&H" & Mid(Color, 5, 2))
hex2rgb = RGB(Red, Green, Blue)
End Function
Function Reset()
With ActivePresentation