Skip to content

Instantly share code, notes, and snippets.

View informationsea's full-sized avatar

Yasunobu Okamura informationsea

View GitHub Profile
@informationsea
informationsea / tableformat.c
Created January 17, 2012 12:50
Format tab-separated text
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <stdbool.h>
/**
* @berief Format text table
* @author informationsea
@informationsea
informationsea / gist:1626548
Created January 17, 2012 12:59
Count lines of files in the directory.
function countlines() {
local basedir=$1
local currentlines='0'
local thislines
shift 1
while [ $1 ] ;do
thislines=`find "$basedir" -type f -name "*.$1" -print0 | xargs -0 cat | wc -l`
currentlines=$(($thislines + $currentlines))
shift 1
done
@informationsea
informationsea / tabseparated.py
Created January 17, 2012 13:08
Read Tab-Separeted file by python
def suggest_type_from_str(string):
"""
Arguments:
- `string`:
"""
try:
return int(string)
except:
@informationsea
informationsea / rzip.py
Created February 23, 2012 11:31
Random Readable Compressed File (Licensed by GPL3 or later)
#!/usr/bin/env python2.7
__author__ = 'informationsea'
__copyright__ = 'Copyright (C) 2012 informationsea All Rights Reserved.'
import bz2
import gzip
import struct
class RandomZip(object):
@informationsea
informationsea / indexedfile.py
Created March 31, 2012 09:09
Indexed file reader
#!/usr/bin/env python
"""
Read indexed tab-delimited file
"""
__author__ = '@informationsea'
__copyright__ = 'Copyright (C) 2011 @informationsea All Rights Reserved.'
import sys
@informationsea
informationsea / Makefile
Last active August 22, 2019 00:02
Makefile template
# Hey Emacs, this is a -*- makefile -*-
# Copyright (C) 2013 Y.Okamura
# https://gist.github.com/2343121
# MIT License
# Target Executable file
TARGET = exefile
# C source code
SRC =
@informationsea
informationsea / emacs-24.0.95-lion-fullscreen.patch
Created April 17, 2012 13:28
Emacs 24.0.95 Lion Full Screen Support
=== modified file 'lisp/term/ns-win.el'
--- lisp/term/ns-win.el 2012-02-25 10:04:30 +0000
+++ lisp/term/ns-win.el 2012-04-17 14:04:58 +0000
@@ -533,6 +533,12 @@
(interactive)
(ns-hide-others))
+(declare-function ns-fullscreen-toggle-cocoa "nsfns.m" ())
+
+(defun ns-fullscreen-toggle ()
@informationsea
informationsea / rename-pdf.py
Created May 2, 2012 05:52
Rename PDF by meta data
#!/usr/bin/env python2.7
import argparse
import pyPdf
import os
import os.path
def _main():
parser = argparse.ArgumentParser(description='rename PDF files')
parser.add_argument('pdf', nargs='+', type=argparse.FileType('rb'))
@informationsea
informationsea / growl.applescript
Created June 3, 2012 05:38
iChat notify with Growl
-- Put at "~/Library/Scripts/iChat"
on showgrowl(theNotify, theImage, theTitle, theMessage)
tell application "Growl"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Login", "Logout", "Present", "Text Message", "Invitation"}
-- Make a list of the notifications
@informationsea
informationsea / emacs-24.1-lion-fullscreen.patch
Created June 3, 2012 07:39
Emacs 24.1 Fullscreen patch for Lion
=== modified file 'lisp/term/ns-win.el'
--- lisp/term/ns-win.el 2012-02-25 10:04:30 +0000
+++ lisp/term/ns-win.el 2012-05-17 06:21:33 +0000
@@ -533,6 +533,12 @@
(interactive)
(ns-hide-others))
+(declare-function ns-fullscreen-toggle-cocoa "nsfns.m" ())
+
+(defun ns-fullscreen-toggle ()