Skip to content

Instantly share code, notes, and snippets.

View kazufusa's full-sized avatar

kazufusa kazufusa

  • Japan
View GitHub Profile
@kazufusa
kazufusa / dagrun_timeout_example.py
Created February 3, 2024 15:26
Notify DAG timed out.
import logging
import time
from datetime import datetime, timedelta
from airflow.decorators import dag, task
def dag_timed_out_logging(context):
if context.get("reason") == "timed_out":
logging.error(f"""DAG timed out: {context.get("dag").safe_dag_id}""")
@kazufusa
kazufusa / test.sh
Created December 23, 2021 04:16
達人に学ぶSQL徹底指南書 第2版 1-1. CASE式のススメ の CASE式の中で集約関数を使うサンプル
#!/bin/sh
# 達人に学ぶSQL徹底指南書 第2版 1-1. CASE式のススメ の CASE式の中で集約関数を使うサンプル
# "HAVING句で条件分岐させるのは素人のやること。プロはSELECT句で分岐させる"
set -Ceux
cat << EOF | sqlite3 test.sqlite3
DROP TABLE student_club;
CREATE TABLE student_club (
private fun fadeIn(view: View) {
view.apply {
alpha = 0f
visibility = View.VISIBLE
animate()
.alpha(1f)
.setDuration(300)
.setListener(null)
}
}
# Insert your preferred key mappings here.
map d removeTab
map u restoreTab
map b Vomnibar.activateTabSelection
map t Vomnibar.activateInNewTab
@kazufusa
kazufusa / main.go
Last active September 17, 2020 10:27
Go - job queue, worker, and gracefull shutdown
// Go - job queue, worker, and gracefull shutdown
package main
import (
"context"
"errors"
"log"
"net/http"
"os"
"os/signal"
map d closeTab
map u lastClosedTab
map b :buffer<Space>
map B :bookmarks<Space>
let locale = "jp"
let completionengines = ["google"]
let defaultengine = "google.co.jp"
@kazufusa
kazufusa / gist:c205bc828ffcc28362af
Last active November 12, 2015 13:36
Shape class
class Shape(object):
__delimiter = "_"
def __init__(self):
"""
>>> shape = Shape()
>>> shape.add([1, 2, 3, 4])
>>> shape.add([1, 2, 5, 6])
>>> shape.add([3, 4, 7, 8])
>>> shape.outlines()
puts "# Test 1"
class Base1
def self.set_message message
@@message = message
end
def put_message point
@@message % point
end
end
@kazufusa
kazufusa / crawler
Last active August 29, 2015 14:01
web_crawler_with_CasperJS
window.urls = {}
search_urls = (url) ->
casper.thenOpen url, ->
window.urls[url] = []
children = @evaluate ->
search_innner_href()
window.urls[url] = children
casper.then ->
# vim: set fileencoding=utf-8 :
# Created: 2014-01-19
# Git submodule update within python subprocess
import os
import subprocess
GIT = "git"
SUBMODULE = "submodule"
FOREACH = "foreach"