Skip to content

Instantly share code, notes, and snippets.

Avatar

Taro Sato okomestudio

View GitHub Profile
@okomestudio
okomestudio / jwasham-anki-builder.py
Created Jul 20, 2020
Convert the CS flash cards by jwasham to CSV for Anki import.
View jwasham-anki-builder.py
#!/usr/bin/env python
"""Convert the CS flash cards by jwasham to CSV for Anki import.
On import:
- Choose tab as the field separator
- Ignore lines where first field matches existing note
- Allow HTML in fields
@okomestudio
okomestudio / table-1.5.54.el
Created Jun 30, 2020
Create and edit WYSIWYG text based embedded tables
View table-1.5.54.el
;;; table.el --- create and edit WYSIWYG text based embedded tables
;; Copyright (C) 2000, 2001 Takaaki "Tak" Ota
;; Emacs Lisp Archive Entry
;; Filename: table.el
;; Version: 1.5.54
;; Keywords: wp, convenience
;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
;; Maintainer: Takaaki Ota <Takaaki.Ota@am.sony.com>
@okomestudio
okomestudio / company-tern.el
Created May 17, 2020
Emacs company-tern mode source
View company-tern.el
;;; company-tern.el --- Tern backend for company-mode -*- lexical-binding: t -*-
;; Copyright (C) 2013-2016 by Artem Malyshev
;; Author: Artem Malyshev <proofit404@gmail.com>
;; URL: https://github.com/proofit404/company-tern
;; Version: 0.3.0
;; Package-Requires: ((company "0.8.0") (tern "0.0.1") (dash "2.8.0") (dash-functional "2.8.0") (s "1.9.0") (cl-lib "0.5.0"))
;; This program is free software; you can redistribute it and/or modify
@okomestudio
okomestudio / wait_for
Last active Apr 10, 2020
wait_for script for Docker
View wait_for
#!/bin/sh
TIMEOUT=15
QUIET=0
echoerr() {
if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
}
usage() {
@okomestudio
okomestudio / rmold.bash
Created Apr 1, 2020
rmold: Remove only old files
View rmold.bash
#!/usr/bin/env bash
set -e
readonly scriptname="${0##*/}"
function usage() {
cat <<USAGE >&2
Usage: $scriptname EXPIRE FILE
@okomestudio
okomestudio / shut_down_nas.bash
Created Feb 18, 2020
Shutdown script for Netgear ReadyNAS (RN312)
View shut_down_nas.bash
#!/usr/bin/env bash
set -e
function usage() {
cat <<USAGE >&2
Usage: ${0##*/} [OPTION] [host]
Shut down the network attached server (NAS). This script has been
tested on Netgear ReadyNAS 312 (RN312).
@okomestudio
okomestudio / google_style_docstrings.py
Created Aug 4, 2017
Google-style docstrings example
View google_style_docstrings.py
# -*- coding: utf-8 -*-
"""Example Google style docstrings.
This module demonstrates documentation as specified by the `Google Python
Style Guide`_. Docstrings may extend over multiple lines. Sections are created
with a section header and a colon followed by a block of indented text.
Example:
Examples can be given using either the ``Example`` or ``Examples``
sections. Sections support any reStructuredText formatting, including
@okomestudio
okomestudio / arc_setup.sh
Created Feb 9, 2016 — forked from thomas-barthelemy/arc_setup.sh
W.E. Bridge Phabricator Arcanist (arc) Setup script for Ubuntu
View arc_setup.sh
#!/bin/bash
if [ -z "$1" ]; then
echo -e "Missing 1 parameter: Phabricator URL."
echo -e "ex: arc_setup.sh https://phabricator.mycompany.com"
fi
if ! hash git &> /dev/null || ! hash php &> /dev/null; then
echo -e " *****\n ***** INSTALLING GIT AND PHP\n *****"
sudo apt-get install git-core php5-cli php5-curl
fi
@okomestudio
okomestudio / delete_s3_bucket.py
Last active Jan 14, 2016
Script to delete S3 bucket with contents.
View delete_s3_bucket.py
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""Delete a S3 bucket with contents.
"""
from __future__ import absolute_import
from gevent import monkey ; monkey.patch_all()
from argparse import ArgumentParser
import boto3
View singletonmixin.py
"""
A Python Singleton mixin class that makes use of some of the ideas
found at http://c2.com/cgi/wiki?PythonSingleton. Just inherit
from it and you have a singleton. No code is required in
subclasses to create singleton behavior -- inheritance from
Singleton is all that is needed.
Singleton creation is threadsafe.
USAGE:
You can’t perform that action at this time.