Skip to content

Instantly share code, notes, and snippets.

View peccu's full-sized avatar
🦉
Information is the network

peccu peccu

🦉
Information is the network
View GitHub Profile
#!/bin/bash
#-*- shell-script -*-
cat <<EOF
# history setting
HISTSIZE=100000
HISTFILESIZE=1000000
# append (default)
shopt -s histappend
# sync on multiple terminals
@peccu
peccu / insert-date.el
Last active August 15, 2016 04:01
insert date with specified format.
(defvar insert-date-format-history '())
(defun insert-date (arg)
"Insert date with specific format.
Default format is %Y/%m/%d.
Call with `C-u' inserts %Y%m%d.
with `C-u C-u' inserts %Y-%m-%d.
with `C-u C-u C-u' prompts format."
(interactive "p")
(let* ((default-format "%Y/%m/%d %H:%M:%S")
@peccu
peccu / HogeFormHelper.php
Last active June 3, 2016 07:07
localize datetime form in CakePHP
<?php
App::uses('FormHelper', 'View/Helper');
class HogeFormHelper extends FormHelper {
/**
* Returns a set of SELECT elements for a full datetime setup: day, month and year, and then time.
*
* ### Attributes:
*
@peccu
peccu / index.html
Created May 27, 2016 07:33
preview image form
<form>
<input type="file" id="form_image" onchange="previewImg(this, 'image');">
<img id="image" style="visibility: hidden;">
<a href="#" onclick="deleteImg(this, 'image')" id="delete_image" style="visibility: hidden;">unset image</a>
</form
@peccu
peccu / freenom.com.ddns.sh
Created May 14, 2016 03:00 — forked from kampro/freenom.com.ddns.sh
Dynamic DNS support shell script for freenom.com
#!/bin/bash
# settings
# Login information of freenom.com
freenom_email="main@address"
freenom_passwd="pswd"
# Open DNS management page in your browser.
# URL vs settings:
# https://my.freenom.com/clientarea.php?managedns={freenom_domain_name}&domainid={freenom_domain_id}
freenom_domain_name="domain.name"

Keybase proof

I hereby claim:

  • I am peccu on github.
  • I am peccu (https://keybase.io/peccu) on keybase.
  • I have a public key ASBBOwgpqZUDhPObj_I85BwwiMUT62pQ3W0QsDJY6XixJAo

To claim this, I am signing this object:

@peccu
peccu / mew-summary-form-considering-timezone.el
Created November 6, 2015 05:40
Mewのサマリモードで、タイムゾーンを考慮した日時を表示する
;; mew summary date/time considering timezone
;; http://permalink.gmane.org/gmane.mail.mew.general.japanese/2355
(defun mew-summary-form-time-z ()
"A function to return a message time, HH:MM"
(let ((s (MEW-DATE)))
(setq s (timezone-make-date-arpa-standard
(if (or (string= s "")
(not (string-match mew-time-rfc-regex s)))
(mew-time-ctz-to-rfc
(mew-file-get-time (mew-expand-folder (MEW-FLD) (MEW-NUM))))
@peccu
peccu / delete-horizontal-big-space.el
Created November 6, 2015 00:37
update delete-horizontal-space for deleting big(wide) space
(defun delete-horizontal-big-space (&optional backward-only)
"Delete all spaces and tabs and big space around point.
If BACKWARD-ONLY is non-nil, only delete them before point."
(interactive "*P")
(let ((orig-pos (point)))
(delete-region
(if backward-only
orig-pos
(progn
(skip-chars-forward " \t ")
@peccu
peccu / lem.ros
Last active August 27, 2015 01:22
launch lem from shell
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(ql:quickload :lem)
(defun main (&rest argv)
(declare (ignorable argv))
(if (car argv)
(lem:lem (car argv))