Skip to content

Instantly share code, notes, and snippets.

Avatar

Yasunobu Okamura informationsea

View GitHub Profile
@informationsea
informationsea / tableformat.c
Created Jan 17, 2012
Format tab-separated text
View tableformat.c
#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 Jan 17, 2012
Count lines of files in the directory.
View gist:1626548
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 Jan 17, 2012
Read Tab-Separeted file by python
View tabseparated.py
def suggest_type_from_str(string):
"""
Arguments:
- `string`:
"""
try:
return int(string)
except:
@informationsea
informationsea / rzip.py
Created Feb 23, 2012
Random Readable Compressed File (Licensed by GPL3 or later)
View rzip.py
#!/usr/bin/env python2.7
__author__ = 'informationsea'
__copyright__ = 'Copyright (C) 2012 informationsea All Rights Reserved.'
import bz2
import gzip
import struct
class RandomZip(object):
View indexedfile.py
#!/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 Aug 22, 2019
Makefile template
View Makefile
# 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 Apr 17, 2012
Emacs 24.0.95 Lion Full Screen Support
View emacs-24.0.95-lion-fullscreen.patch
=== 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
Rename PDF by meta data
View rename-pdf.py
#!/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'))
View growl.applescript
-- 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 Jun 3, 2012
Emacs 24.1 Fullscreen patch for Lion
View emacs-24.1-lion-fullscreen.patch
=== 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 ()
You can’t perform that action at this time.