Skip to content

Instantly share code, notes, and snippets.

@momota
momota / one_time_password.ps1
Last active August 17, 2023 00:25
This PowerShell script generates a random string for a one-time password and copies it to the clipboard. It is convenient to register in your launcher.
param(
[Int32] $password_length = 15
)
$numbers = 0..9
$lower_case = @('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z')
$upper_case = $lower_case.toUpper()
$symbols = @('-','+','_','@','=','&','$','#','!','?')
$inputs = $numbers + $lower_case + $upper_case + $symbols
@momota
momota / datetime.py
Created February 6, 2020 15:42
get datetime with 0 padding
import datetime
now = datetime.datetime.now()
now_str = now.strftime('%Y-%m-%d-%H-%M')
year, month, day, hour, minute = now_str.split('-')
@momota
momota / moneyforward_scraping.js
Last active April 13, 2019 08:31
UserScript for copying family budget detail data to clipboard from the moneyfoward page.
// ==UserScript==
// @name moneyforward_scraping
// @namespace http://momota.github.io/
// @include https://moneyforward.com/cf
// @version 1
// @grant GM.setClipboard
// ==/UserScript==
function copyTransaction() {
let tsv = '',
@momota
momota / install-golang-on-ubuntu.md
Created November 6, 2018 08:03
Install golang (version 1.11.2) on Ubuntu 18.04.1

Environment

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"
@momota
momota / venv.md
Last active October 29, 2018 09:41

environment

OS is Ubuntu 18.04.1 LTS.

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.1 LTS"

Install chromium on ubuntu (WSL) on Windows 10

My computer is under a proxy environment in a private network.

Install chromium

$ sudo -E apt-get update
$ sudo -E apt-get install chromium-browser -y
$ sudo -E apt-get install fonts-ipafont-gothic fonts-ipafont-mincho -y

Develop your codes for Cloud Functions in the local environment.

Make a work directory

~$ mkdir functions_test
~$ cd functions_test

Create your sctipts for Cloud Functions

@momota
momota / build_python_environment.md
Last active May 28, 2018 05:16
Build a python environment for Mac OSX

1: Install pyenv

  • Install pyenv via github and set your *shrc
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.zshrc
$ source ~/.zshrc

Ansible

Inventory

Create inventory file ./hosts as below.