Skip to content

Instantly share code, notes, and snippets.

@blacknon
blacknon / example_p11_pubprint.go
Last active January 30, 2023 02:19
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内のpublic keyをssh-rsa形式で出力するsampleコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内のpublic keyをssh-rsa形式で出力するsampleコード
package main
import (
"crypto/rsa"
"crypto/x509"
@blacknon
blacknon / example_p11_getsinger.go
Last active January 30, 2023 02:25
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
package main
import (
"crypto"
@blacknon
blacknon / example_p11_privprint.go
Last active January 30, 2023 02:25
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
package main
import (
"crypto/rsa"
@blacknon
blacknon / example_p11_getsinger_bk4.go
Last active January 30, 2023 02:24
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
package main
import (
"crypto/rsa"
@blacknon
blacknon / example_p11_getsinger_bk5.go
Last active February 12, 2023 09:39
goで`github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
// Copyright (c) 2020 Blacknon. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
// `github.com/miekg/pkcs11/p11`を使って、Yubikey内からsshのCryptoSignerを取得するサンプルコード
package main
import (
"crypto/rsa"
@blacknon
blacknon / python_prompt_toolkit_test.py
Last active January 30, 2023 02:45
python_prompt_toolkitの動作検証用のスクリプト
#!/usr/bin/env python3
# -*- encoding: UTF-8 -*-
from prompt_toolkit import prompt
from prompt_toolkit.completion import FuzzyWordCompleter
# 単語の候補
my_completer = FuzzyWordCompleter(
["apple", "goole", "japan", "hoge", "hello world", "good morning"]
)
@blacknon
blacknon / get_google_image_url.py
Last active January 30, 2023 02:45
googleイメージ検索を行う検証用スクリプト(python)
#!/usr/bin/env python3
# -*- encoding: UTF-8 -*-
import chromedriver_autoinstaller
import time
import re
import demjson
from bs4 import BeautifulSoup
from selenium import webdriver
@blacknon
blacknon / a.py
Created February 9, 2022 04:20
pythonでregex matchしたとこをハイライトさせる場合のサンプルコード(どっかからのコピペだった…はず)
#!/usr/bin/env python3
# -*- encoding: UTF-8 -*-
import re
colourFormat = '\033[{0}m'
colourStr = colourFormat.format(32)
resetStr = colourFormat.format(0)
s = "This is a sentence where I talk about interesting stuff like sencha tea."
lastMatch = 0
@blacknon
blacknon / main.rs
Created February 9, 2022 05:04
regexでmatchした箇所をハイライト表示させるためのサンプルコード(rust版)
extern crate regex;
use regex::Regex; // 1.1.8
fn main() {
let seperator = Regex::new(r"is a").unwrap();
let splits: Vec<_> = seperator.split("this... is a, test").into_iter().collect();
for split in splits {
println!("\"{}\"", split);
}
@blacknon
blacknon / aa.py
Last active February 12, 2023 10:17
#!/usr/bin/env python3
# -*- encoding: UTF-8 -*-
import itertools
options = {
"x": ["a", "b"],
"y": [10, 20, 30]}
keys = options.keys()
values = (options[key] for key in keys)