Skip to content

Instantly share code, notes, and snippets.

@tmiz
tmiz / build_openssl_dylib.sh
Last active November 1, 2023 13:18
Build latest OpenSSL Universal Binary on OSX
#!/bin/bash
OPENSSL_VERSION="1.0.1g"
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386
@tmiz
tmiz / CoreLocationTest.m
Created December 1, 2011 12:08
Using CoreLocation on Mac OS X with command-line
//
// Using CoreLocation on Mac OS X with command-line
// $ clang CoreLocationTest.m -framework cocoa -framework CoreLocation
// $ ./a.out
// location service enabled
// 2011-12-01 21:03:01.839 a.out[10214:903] latitude,logitude : 35.606647, 140.695538
// 2011-12-01 21:03:01.842 a.out[10214:903] timestamp : 2011-12-01 21:01:36 +0900
// tmiz moo@tmiz.net
//
#import <cocoa/cocoa.h>
@tmiz
tmiz / myonetime
Last active December 30, 2016 07:21
One time pass word
#!/usr/bin/env python
import shelve
import sys,os
import onetimepass as otp
def usage():
print "myonetime <domain> <secret> : register secret"
print "myonetime <domain> : create one time password"
@tmiz
tmiz / test.py
Created December 25, 2015 18:08
import json
import numpy as np
from sets import Set
with open("BusinessSpending.json") as f:
data = json.load(f, 'latin-1')
entries = data["raw_data"]
keys = []
for entry in entries:
keys = entry.keys()
$(function(){
function startRotate() {
$("#reload").css("-webkit-animation-name", "loadingRotate");
$("#reload").css("-webkit-animation-duration", "1s");
$("#reload").css("-webkit-animation-iteration-count","infinite");
$("#reload").css("-webkit-animation-play-state", "running");
}
function stopRotate() {
$("#reload").css("-webkit-animation-play-state", "paused");
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import NewPost
from wordpress_xmlrpc.methods import posts
import os.path
import sys
def read_config(filepath):
with open(filepath) as f:
lines = f.readlines()
return lines[0:3]
@tmiz
tmiz / st
Last active December 11, 2015 14:58
I use Sublime Text through st command.
#!/bin/bash
if ! [ -f $1]
then
touch $1
fi
open -a /Applications/Sublime\ Text\ 2.app $1
@tmiz
tmiz / gist:4353968
Created December 21, 2012 16:49
How to build the specified revision of Chromium.
At first, install xcode.
And execute following commands.
XXXXXX is revision number.
$ svn co http://src.chromium.org/svn/trunk/tools/depot_tools
$ export PATH=$PATH:`pwd`/depot_tools
$ gclient config http://src.chromium.org/svn/trunk/src
$ gclient sync --revision src@XXXXXX
$ cd src/
$ GYP_GENERATORS=make GYP_DEFINES=mac_sdk=10.7 ./build/gyp_chromium
@tmiz
tmiz / main.m
Created December 20, 2011 03:13
interposing on objc sample
// (C)2011 to3oo mi2ukam1 tmiz.net
//
// interposing on objc sample
// $ g++ main.m -framework cocoa
// $ ./a.out
// 2011-12-20 12:12:37.159 a.out[533:903] hello
// 2011-12-20 12:12:37.164 a.out[533:903] world
#include <cocoa/cocoa.h>
#include <objc/objc-class.h>
@tmiz
tmiz / KVOTest.cs
Created December 15, 2011 20:14
KVOTest.cs 004
using System;
using System.Threading;
using MonoMac.Foundation;
namespace KVOTestClock
{
[Register("KVOTest")]
public class KVOTest : NSObject
{
public KVOTest ()