Skip to content

Instantly share code, notes, and snippets.

@kaito834
kaito834 / KeePass-export.bat
Last active August 29, 2015 14:17
Export some Entries from KeePass KDBX(2.x) file by KPScript
@echo off
setlocal
set originalKdbxFile=KeePass\myDatabase.kdbx
set exportedKdbxFile=KeePass\myDatabaseProtableGroup.kdbx
REM ToDo: mask password on command prompt by Powershell
REM https://gallery.technet.microsoft.com/scriptcenter/59807ef4-f17a-4a12-a389-f9bb407c4e5a
set /P originalKdbxFile_pass="%originalKdbxFile% password: "
set /P exportedKdbxFile_pass="%exportedKdbxFile% password: "
@kaito834
kaito834 / robocopy.bat
Created March 15, 2015 14:01
Backup files to remote folder by robocopy on Windows 8.1
REM Copy local folder to remote folder
REM I executed this batch on Windows 8.1
robocopy "C:\Users\sample\Documents\mydata" "\\192.168.0.120\backup\" /E /FFT /R:3 /W:5 /NP /TEE /LOG+:"\\192.168.0.120\backup\robocopy.log"
@kaito834
kaito834 / urllib-request-Request.py
Last active July 19, 2023 23:37
Python 3: urllib.request and json sample
#!/usr/bin/env python
#
# tested by Python 3.4.3 on Windows 8.1
# Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
# If you need to access web site/service via proxy, set http_proxy or https_proxy.
# https://docs.python.org/3/library/urllib.request.html#urllib.request.ProxyHandler
# set http_proxy=http://127.0.0.1:8888/
# set https_proxy=https://127.0.0.1:8888/
@kaito834
kaito834 / Microsoft.PowerShell_profile.ps1
Last active August 29, 2015 14:18
My Windows Powershell Profile, Microsoft.PowerShell_profile.ps1
# https://technet.microsoft.com/ja-jp/scriptcenter/powershell_owner06.aspx (in Japanese)
# New-Item -path $profile -type file -force
# notepad $profile
#
# https://technet.microsoft.com/ja-jp/scriptcenter/powershell_owner05.aspx#EEAA (in Japanese)
# Run Set-ExecutionPolicy cmdlet on powershell prompt as administrator
# Set-ExecutionPolicy RemoteSigned
#
# tested by PowerShell 4.0 on Windows 8.1
@kaito834
kaito834 / generateKeysByGpg.md
Last active August 29, 2015 14:19
Generate openPGP public/private keys by GPG

An Environment for this procedure

  • GnuPG(GPG) 2.0.x on Windows 8.1
    • We should latest gpg if no specific reasons.
    • I have used one Gpg4win contains

Procedure to generate keys

  1. Define parameters
  2. Generate public/private keys
  3. Generate revocation certificate
@kaito834
kaito834 / re-multilines.py
Created April 26, 2015 12:32
Python 3.x script to match string over multi-lines by re library
#!/usr/bin/env python
#
# tested by Python 3.4.3 on Windows 8.1
# Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
import re
# https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
# http://d.hatena.ne.jp/itasuke/20090815/p1 (in Japanese)
filename=r"C:\\Users\\kaito\\Documents\\mydata\\scripts\\re-multilines_sample.txt"
@kaito834
kaito834 / generateSSHkeysOnWindows.md
Created May 4, 2015 07:05
Generate SSH public/private keys on Windows.
@kaito834
kaito834 / curl_range-globbing_sample.txt
Created June 1, 2015 15:18
Sample results of cURL's range globbing feature
# This is sample results of cURL's range globbing feature.
# I tested this on Windows 8.1.
#
# References:
# 'URL' section, http://curl.haxx.se/docs/manpage.html
$> curl -V
curl 7.38.0 (i386-pc-win32) libcurl/7.38.0 zlib/1.2.7
Protocols: dict file ftp gopher http imap ldap pop3 rtsp smtp telnet tftp
Features: AsynchDNS IPv6 Largefile libz
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@kaito834
kaito834 / urllib-request_basicAuth.py
Last active October 26, 2022 17:52
Python 3.x snippet code for Basic Authentication HTTP request by urllib.request
#!/usr/bin/env python
#
# I tested by Python 3.4.3 on Windows 8.1
# Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
import urllib.request
import getpass
# If you access to url below via Proxy,
# set environment variable 'http_proxy' before execute this.