Skip to content

Instantly share code, notes, and snippets.

View thombashi's full-sized avatar
💤
Please create an issue if you have any bug-reports/requests to my repos🚫📧

Tsuyoshi Hombashi thombashi

💤
Please create an issue if you have any bug-reports/requests to my repos🚫📧
View GitHub Profile
@thombashi
thombashi / iam_roles_list.yaml
Last active February 7, 2024 23:51
GCP IAM roles
# gcloud iam roles list
---
description: Ability to view or act on access approval requests and view configuration
etag: AA==
name: roles/accessapproval.approver
stage: GA
title: Access Approval Approver
---
description: Ability to update the Access Approval configuration
etag: AA==
@thombashi
thombashi / make_xdg-open_to_be_worked_on_WSL.md
Last active October 2, 2022 08:08
Make xdg-open to be worked on WSL

Install wsl-open:

sudo npm install -g wsl-open

Update alternatives for xdg-open:

@thombashi
thombashi / detect_wsl.sh
Created January 18, 2020 01:46
Detect WSL by shell commands
#!/bin/sh
if uname -r | \grep -q Microsoft ; then
echo "WSL"
else
echo "non WSL"
fi
@thombashi
thombashi / copy_mdlink_bookmarklet.js
Last active November 23, 2023 00:26
Bookmarklet to copy URL and title as Markdown link
@thombashi
thombashi / detectbrowser.html
Created March 31, 2017 15:34
Javascript: Detect browser
<!doctype html>
<html>
<body>
<script>
const isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") !== -1;
const isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
console.log(`isChrome: ${isChrome}`);
console.log(`isFirefox: ${isFirefox}`);
</script>
@thombashi
thombashi / voluptuous_python25.patch
Created February 10, 2017 15:10
voluptuous_python25.patch
diff -u org_voluptuous-0.8.8/voluptuous-0.8.8/setup.py modified_voluptuous-0.8.8/voluptuous-0.8.8/setup.py
--- org_voluptuous-0.8.8/voluptuous-0.8.8/setup.py 2015-12-15 23:10:46.000000000 +0900
+++ modified_voluptuous-0.8.8/voluptuous-0.8.8/setup.py 2016-01-01 15:50:05.766400230 +0900
@@ -1,3 +1,4 @@
+from __future__ import with_statement
try:
from setuptools import setup
except ImportError:
diff -u org_voluptuous-0.8.8/voluptuous-0.8.8/voluptuous.py modified_voluptuous-0.8.8/voluptuous-0.8.8/voluptuous.py
--- org_voluptuous-0.8.8/voluptuous-0.8.8/voluptuous.py 2015-12-15 23:10:46.000000000 +0900
@thombashi
thombashi / rfc_date.sh
Created January 22, 2017 05:27
date command with RFC-2822/RFC-3399 format
#!/bin/bash
function date_wrapper() {
command="date --rfc-3339=$1"
echo "$ ${command}"
echo -e "`${command}`\n"
}
@thombashi
thombashi / iso_date.sh
Created January 22, 2017 05:21
date command with ISO8601 format
#!/bin/bash
function date_wrapper() {
command="date --iso-8601=$1"
echo "$ ${command}"
echo -e "`${command}`\n"
}
@thombashi
thombashi / read_csv.py
Created January 21, 2017 08:23
Read a CSV file with Python 2/3
#!/usr/bin/env python
# encoding: utf-8
"""
Sample program to read a CSV file.
This works for both Python 2/3.
"""
from __future__ import print_function
from __future__ import unicode_literals
@thombashi
thombashi / local_ci_python.md
Last active January 15, 2017 11:38
Local CI for Python

pytest w/ pytest-runner

watchmedo shell-command --patterns="*.py" --recursive --command='python setup.py test' .

package upgrade

watchmedo shell-command --patterns="*.py" --recursive --command='pip install -e .'