Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / radiko_player_air.log
Created November 19, 2013 22:47
Log of radiko_player_air (Version 3.1.0) Display was slept around 7:10. Hope fixed latest version.
2013/11/20 6:40:04.725 radiko_player_air[58661] CoreText performance note: Client called CTFontCreateWithName() using name "Times Roman" and got font with PostScript name "Times-Roman". For best performance, only use PostScript names when calling this API.
2013/11/20 6:40:04.725 radiko_player_air[58661] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
2013/11/20 6:40:08.184 radiko_player_air[58661] The function `CGFontSetShouldUseMulticache' is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance.
2013/11/20 7:10:14.354 radiko_player_air[58661] HIToolbox: received notification of WindowServer event port death.
2013/11/20 7:10:14.357 radiko_player_air[58661] port matched the WindowServer port created in BindCGSToRunLoop
2013/11/20 7:10:14.559 radiko_player_air[58661] CGError CGSGetDisplaySystemState(uint64_t, CGSDis
@superdaigo
superdaigo / check_pip_download_time.sh
Created August 15, 2013 10:21
Check pip download time (sec) for each pypi mirror servers.
#!/bin/bash
# System Requirements
# pip ... python package install command
# requirements.txt ... package list to install via pip
TMP_DIR="${HOME}/tmp"
REQUIREMENTS_TXT="requirements.txt"
In [1]: for i in range(1,100):
...: if pow(i, 17) % 3569 == 915:
...: print i
...:
2012
5581
9150
@superdaigo
superdaigo / insert-date.el
Last active December 14, 2015 14:59
The sample function to insert current date in emacs. The format is "yyyy-mm-dd (aaa)" in this snippet.
;; insert-date
(defun insert-date ()
"Insert current date yyyy-mm-dd (aaa)"
(interactive)
;; Print weekday in English
(setq tmp-locale woman-locale)
(set-locale-environment "en_US.UTF-8")
(insert (format-time-string "%Y-%m-%d (%a)"))
(set-locale-environment tmp-locale)
)
#!/bin/bash
find . -name ".git" -type d -prune -print -execdir git pull \;
@superdaigo
superdaigo / init.el
Created October 5, 2012 22:55
Klipper copy & paste for emacs terminal (KDE)
;; linux
(when (eq 'gnu/linux system-type)
;; terminal
(unless window-system
;; I don't know how to detect the system was KDE or not. :(
(defun copy-from-kde()
(let ((output (shell-command-to-string "qdbus org.kde.klipper /klipper getClipboardContents")))
(unless (string= (car kill-ring) output)
output )))
(defun paste-to-kde (text &optional push)
@superdaigo
superdaigo / zabbix-alert-smtp.sh
Created September 20, 2012 04:58
Zabbix SMTP Alert script for gmail
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Zabbix SMTP Alert script for gmail.
"""
import sys
import smtplib
from email.MIMEText import MIMEText
from email.Header import Header