Skip to content

Instantly share code, notes, and snippets.

@ex-hota911
ex-hota911 / custom.css
Created February 25, 2019 01:57
Coloring tags at Dynalist.io
.DocumentContainer.has-tagBackground .node-tag[title~="#wip"] {
background: rgba(255, 0, 0, 0.5);
color: #7a7a7a;
}
.DocumentContainer.has-tagBackground .node-tag[title~="#waiting"] {
background: rgba(255, 255, 0, 0.5);
color: #7a7a7a;
}
@ex-hota911
ex-hota911 / dag.py
Last active October 10, 2018 14:29
import pytz
from airflow import models
tz = pytz.timezone('Asia/Tokyo')
def in_jst(execution_date):
"""Returns the execution date in JST."""
return tz.fromutc(execution_date)
def ds_in_jst(execution_date):
@ex-hota911
ex-hota911 / change_color.gs
Created July 25, 2018 06:58
Change color of text matching pattern in Google Docs.
var pattern = "//.*";
function changeColor(text, pattern) {
var foundText = text.findText(pattern);
while (foundText != null) {
foundText.getElement().asText().setForegroundColor(
foundText.getStartOffset(),
foundText.getEndOffsetInclusive(),
"#888888");
foundText = text.findText(pattern, foundText);
@ex-hota911
ex-hota911 / bookmarklet.js
Created May 3, 2018 02:39
Bookmarklet to copy the page title and the URL
javascript:(function()%7Bconst%20el%20%3D%20document.createElement('textarea')%3Bconst%20str%20%3D%20document.title%20%2B%20'%20-%20'%20%2B%20document.URL%3Bel.value%20%3D%20str%3Bel.setAttribute('readonly'%2C%20'')%3Bel.style.position%20%3D%20'absolute'%3Bel.style.left%20%3D%20'-9999px'%3Bdocument.body.appendChild(el)%3Bel.select()%3Bconst%20result%20%3D%20document.execCommand('copy')%3Bdocument.body.removeChild(el)%3Bif%20(result)%20%7Balert('copied%20%22'%20%2B%20str%20%2B%20'%22')%3B%7D%20else%20%7Balert('copy%20failed')%3B%7D%7D)()
@ex-hota911
ex-hota911 / Permutations.java
Last active October 14, 2017 06:29
next permutation for Java List.
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class Permutations {
/**
* Rearrange the list into the next lexicographically greater permutation if exists.
*
* @return true if such a permutation exists, otherwise false.
*/
@ex-hota911
ex-hota911 / add-events.gs
Last active October 18, 2017 22:39
Add events to Google Calendar listed in Google Spreadsheet.
/**
* | Start | End | | Calendar | Title | Done |
* |------------|------------|---|-----------|-------|------|
* | 3/26 13:00 | 3/26 14:00 | | | Lunch | |
* |------------|------------|---|-----------|-------|------|
* | 3/26 | | v | Birthdays | Alice | |
*/
var INDEX = {
START: 0,
END: 1,
#!/bin/bash
# Variables:
# JALAN_API_KEY - API key of Jalan web service
# Visit https://www.jalan.net/jw/jwp0400/jww0401.do to get new key.
# TO_ADDRES - The address to send mails.
URL="http://jws.jalan.net/APIAdvance/StockSearch/V1/?key=${JALAN_API_KEY}&stay_date=20151121&stay_count=1&room_count=1&adult_num=2&s_area=192002"
set -eux