Skip to content

Instantly share code, notes, and snippets.

@NeoCat
NeoCat / multi_column.css
Created July 30, 2011 18:32
user CSS for twicli - multi columns view sample
.tw-parent > div > div { width: 400px; float: left; }
#tw { left:0; }
#re { left:402px; }
#tw2 {left:804px; }
#menu { left: 804px; }
.tw-parent, #tw2 { width: 400px; height: 92%; overflow: scroll; display: block !important; }
a#TL, a#reply { display: none; }
@NeoCat
NeoCat / gtest.html
Created September 16, 2011 00:01
Google+ API JavaScript Sample
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Google+ API Test</title>
</head>
<body>
<button onclick="authBegin()">Login</button><br>
<button onclick="getPublicActivities($('user').value)">Get activities of user </button><input id="user" size="10" value="me"><br>
@NeoCat
NeoCat / count-window.sh
Created December 6, 2011 16:22
Count windows of the specified application in MacOS X
#!/bin/sh
osascript -e 'tell application "System Events"
try
count every window of process "'"$1"'"
on error
0
end try
end tell' 2>/dev/null
@NeoCat
NeoCat / LibHook.h
Created December 25, 2011 13:48
Hook hidden symbol call (x86_64)
#include <string.h>
#include <dlfcn.h>
#include <err.h>
#include <errno.h>
#include <sys/mman.h>
#define LIB_PATH "libc.so.6"
template <class RET, class... ARGV>
class LibHook {
@NeoCat
NeoCat / play-ipaddr.sh
Created April 17, 2012 16:47
flu-card - play sound based on IP address ( 0=B↓, 1=C, 2=D, 3=E, ... 7=B, 8=C↑, 9=D↑ )
ifconfig | awk '/inet addr:/{split($2,a,".");split(a[4],b,"");for(x in b) print "QUERY_STRING=\"fn=" int(246*(2**(1/12))**(b[x]*2-(b[x]>0)-(b[x]>3)-(b[x]>7))) "\" playNote"}' | sh
@NeoCat
NeoCat / .emacs
Created May 23, 2012 07:40
.emacs to bind "C-c c" to `make' in the directory with the nearest Makefile
(require 'cl)
(defun* get-closest-file-dir (&optional (file "Makefile"))
"Determine the directory of the first instance of FILE starting from the current directory towards root.
This may not do the correct thing in presence of links. If it does not find FILE, then it shall return nil."
(let ((root (expand-file-name "/")))
(loop
for d = default-directory then (expand-file-name ".." d)
if (file-exists-p (expand-file-name file d)) return d
if (equal d root) return nil)))
@NeoCat
NeoCat / mv_sata_standby.c
Created September 27, 2012 14:26
HDD Spin down driver for marvell SATA controller (mvSATA) in LS-GL
#include <linux/module.h>
#include <linux/kernel.h>
#include <scsi/scsi_host.h>
#define MV_LINUX
#define MV_ARM
#define MV_CPU_LE
#include "mvSata.h"
#include "mvLinuxIalHt.h"
/*アイコン縮小*/
.uicon{width:16px;height:16px;}
/*行間*/
.status{line-height: 1.5;}
/*リンク背景透明化*/
span.status a.link,span.status a.resolved,span.status a.link:hover{background-color:transparent !important;border:0;}
/*RTアイコン非表示*/
@NeoCat
NeoCat / fb2bmp.c
Created October 20, 2012 16:32
Kobo Screen captute via HTTP
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
struct __attribute__((packed)) bitmapFileHeader {
unsigned char bfType[2];
unsigned int bfSize;
unsigned short bfReserved1;
unsigned short bfReserved2;
@NeoCat
NeoCat / RC-heli.ino
Created December 9, 2012 08:02
Kinect Controller for Helicopter FS-IRH100
// Arduino Sketch to send IR signal to FS-IRH100
// Connect Infra-red LED to pin 3 & GND
// bit set / clear
#ifndef cbi
#define cbi(PORT, BIT) (_SFR_BYTE(PORT) &= ~_BV(BIT))
#endif
#ifndef sbi
#define sbi(PORT, BIT) (_SFR_BYTE(PORT) |= _BV(BIT))