Skip to content

Instantly share code, notes, and snippets.

View ytsutano's full-sized avatar

Yutaka Tsutano ytsutano

View GitHub Profile
@ytsutano
ytsutano / resize_viewport.html
Last active November 11, 2015 02:01
Bookmarklets to resize the viewport width.
<!DOCTYPE html>
<html>
<head>
<title>Bookmarklets: Resize Viewport</title>
</head>
<body>
<h1>Bookmarklets: Resize Viewport</h1>
<h2>Bookmarklets</h2>
@ytsutano
ytsutano / osxp.cpp
Created February 19, 2013 18:00
Turning on/off OS X displays.
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
#include <iostream>
void set_request_idle(bool request)
{
io_registry_entry_t entry = IORegistryEntryFromPath(kIOMasterPortDefault,
"IOService:/IOResources/IODisplayWrangler");
if (entry == MACH_PORT_NULL) {
@ytsutano
ytsutano / mutex.h
Created November 24, 2012 16:39
Simple mutex wrapper class
/**
* @file mutex.h
* @brief Declares Mutex class.
* @author Yutaka Tsutano
*/
#ifndef MUTEX_H
#define MUTEX_H
#ifdef _WIN32
@ytsutano
ytsutano / sync_all_ios_devices.applescript
Created October 28, 2012 19:46
Automator: sync all iOS devices.
on prepareGrowl()
tell application "Growl"
set the allNotificationsList to {"iTunes"}
set the enabledNotificationsList to {"iTunes"}
register as application "iTunes" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "iTunes"
end tell
end prepareGrowl
on notify(messageTitle, message)
tell application "Growl" to notify with name "iTunes" title messageTitle description ¬
@ytsutano
ytsutano / LaTeX.sh
Created October 28, 2012 19:40
TextWrangler: automated LaTeX compilation.
#!/bin/bash
# Change the current directory to the document path.
cd "${BB_DOC_PATH%/*}"
# Update PATH.
PATH=$PATH:/usr/bin/:/usr/local/bin/
PATH=$PATH:/usr/local/bin:/usr/X11/bin:/usr/texbin:/opt/local/bin
# Pre-compute the file names used.