Skip to content

Instantly share code, notes, and snippets.

@superdaigo
superdaigo / gist:8131115
Last active January 1, 2016 10:19
Redmine 2.3-stable: Append project identifier into mail header 'List-ID'
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index c12195a..9819776 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -388,6 +388,31 @@ class Mailer < ActionMailer::Base
'From' => Setting.mail_from,
'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
+ # set List-ID
+ if @issue
@superdaigo
superdaigo / init.el
Created October 7, 2015 03:49
Simple init.el
;; Encoding
(setq default-file-name-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(setq default-process-coding-system '(utf-8 . utf-8))
;; Misc
(setq inhibit-startup-message t) ;; Hide Startup Cow
(setq visible-bell t) ;; Visible bell
(menu-bar-mode -1) ;; Menu bar (1: Enable, -1: Disable)
(blink-cursor-mode 0) ;; Blink Cursor (0: off, 1: blink)
@superdaigo
superdaigo / tasks.py
Created April 22, 2016 04:46
Celery rate_limit test script
"""
# Test celery's rate_limit
Tested version of python
$ python --version
Python 2.7.11
## Requirements
$ pip install celery==3.1.23
$ pip install SQLAlchemy==1.0.12
@superdaigo
superdaigo / random_password
Last active June 10, 2016 09:15
One Liner: Generate Random Password and Copy to Clipboard (OS X)
$ python -c 'import random,string,sys;sys.stdout.write("".join(random.sample(string.printable[:94],16)))' | pbcopy
@superdaigo
superdaigo / ForcePasswordRequiredImmediatelyAfterScreenSaver.mobileconfig
Created July 15, 2016 05:18
This profile force OS X (at least 10.11.5) to require password immediately after screen saver begins. (ref. http://www.johnkitzmiller.com/blog/security-privacy-configuration-profile-bug-in-casper-9-82/)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string>Screen saver password settings</string>
<key>PayloadIdentifier</key>
@superdaigo
superdaigo / Shonan Beach FM.asx
Created December 16, 2017 04:38
Japanese Internet Radio "Shonan Beach FM" https://www.beachfm.co.jp/
<Asx Version="3.0">
<Entry>
<Title>Shonan Beach FM 78.9</Title>
<author>Shonan Beach FM 78.9</author>
<copyright>Shonan Beach FM 78.9</copyright>
<ref href="mms://simul.freebit.net/shonanbeachfm"/>
<ref href="http://150.95.174.29:8000/by_the_sea"/>
</Entry>
</Asx>
#!/bin/bash
STOP_AT=$(date -j -v "+1H" "+%H:%M")
if [ ! -z $1 ] && [[ $1 =~ ^[0-9]{1,2}:[0-9]{2}$ ]] ; then
STOP_AT="${1}"
if [ ${#1} -eq 4 ] ; then
STOP_AT="0${1}"
fi
fi
echo "Will stop at ${STOP_AT}"
@superdaigo
superdaigo / tokyo_tour_2019-08-14.rst
Last active August 14, 2019 11:34
Googled Tokyo Tour for English speakers 2019-08-14

Multiples of 3

If the natural number X is a multiple of 3, the summary of each digit number of X is a multiple of 3 too.

Example:

3 = 3 * 1; For single digit, it's ovbious that the result is multiple of 3.
@superdaigo
superdaigo / org
Created December 4, 2019 15:09
IDEA - Setup MacOS Local Environment

To use Homebrew task in the Ansible, both Homebrew and Ansible should be installed in the system. That means at least Homebrew and Ansible must be installed using shell script. Following installation and configuration will be done by Ansible, so that the shell script can be use for up-to-date the local environment.

  1. Shell script
    1. Install homebrew
    2. Install ansible using homebrew
    3. Execute ansible
      • specifying /usr/local/bin/ansible to avoid PATH configured following ansible script