Skip to content

Instantly share code, notes, and snippets.

@blacknon
blacknon / create-cloud-template.sh
Created August 17, 2023 01:24 — forked from chriswayg/create-cloud-template.sh
This script will download a cloud image of many Linux distros and create a Proxmox 6 KVM template from it.
#!/bin/bash
set -o errexit
clear
printf "\n*** This script will download a cloud image and create a Proxmox VM template from it. ***\n\n"
### HOW TO USE
### Pre-req:
### - run on a Proxmox 6 server
### - a dhcp server should be active on vmbr1
@blacknon
blacknon / google-dorks
Last active March 15, 2023 05:36 — forked from mehdichaouch/google-dorks
Listing of a number of useful Google dorks.
Explanations:
cache: If you include other words in the query, Google will highlight those words within
the cached document. For instance, [cache:www.google.com web] will show the cached
content with the word “web” highlighted. This functionality is also accessible by
clicking on the “Cached” link on Google’s main results page. The query [cache:] will
show the version of the web page that Google has in its cache. For instance,
[cache:www.google.com] will show Google’s cache of the Google homepage. Note there
can be no space between the “cache:” and the web page url.
------------------------------------------------------------------------------------------
@blacknon
blacknon / kaomoji.txt
Created February 25, 2023 02:35
ちょっと後で使いたくなりそうな顔文字系のメモ
`ʕ•͡ᴥ•ʔ ʕ•͡ᴥ•ʔ ʕ•͡ᴥ•ʔ`
@blacknon
blacknon / test_parseopt.nim
Created January 4, 2023 23:36
nimでshort optionを書いているコマンドラインをパースしてseqにするサンプルコード
import std/parseopt
import hashes
import sets
import sequtils
var p = initOptParser("-ab -c:123 -d xyz -e:5 --foo --bar=20 file.txt")
var cmdline: OrderedSet[string] = initOrderedSet[string]()
while true:
p.next()
@blacknon
blacknon / hwatch_logviewer.py
Last active January 30, 2023 01:36
hwatchのlogをパースして出力するpythonスクリプト
#!/usr/bin/env python3
# -*- encoding: UTF-8 -*-
# Copyright(c) 2021 Blacknon. All rights reserved.
# Use of this source code is governed by an MIT license
# that can be found in the LICENSE file.
#
# User:
# blacknon
# Description: [hwatch](https://github.com/blacknon/hwatch)のlogをパースして出力するスクリプト
# =============================================
@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)
@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 / 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 / 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 / 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"