Skip to content

Instantly share code, notes, and snippets.

View Superbil's full-sized avatar
:shipit:
Working in Cloud

Superbil Superbil

:shipit:
Working in Cloud
View GitHub Profile
@Superbil
Superbil / ido-find-file.el
Created October 17, 2013 17:31
auto use root to open file
(defadvice ido-find-file
(after find-file-sudo activate)
"Find file as root if necessary."
(unless (and buffer-file-name
(file-writable-p buffer-file-name))
(find-alternate-file (concat "/sudo:root@localhost:"
buffer-file-name))))
@Superbil
Superbil / readme.md
Last active December 25, 2015 16:09
covert Excel file to localizable files
dispatch_group_t group = dispatch_group_create();
dispatch_semaphore_t semaphore = dispatch_semaphore_create(10);
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
for (int i = 0; i < 100; i++)
{
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
dispatch_group_async(group, queue, ^{
NSLog(@"%i",i);
sleep(2);
dispatch_semaphore_signal(semaphore);
#!/user/bin/env python
import zipfile
import os.path
import time
from shutil import copyfile
def zipdir(path, zip):
relroot = os.path.abspath(os.path.join(path, ".."))
@Superbil
Superbil / signing-party-install.md
Last active December 22, 2015 09:29
install signing-party on mac

Env

  • Mac OSX 10.9.3
  • homebrew 0.9.5
  • perl 5.16.2
  • signing-party 1.1.7

Install flow

# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
# Example
# {"expanded":false,
# "classes":"folder",
# "hasChildren":true,
# "id":"100000000A",
@Superbil
Superbil / pycheckers.sh
Created July 9, 2013 02:22
my pyflakes
#!/usr/bin/env zsh
pyflakes "$1"
# pep8 --repeat "$1"
true
@Superbil
Superbil / wtf_do_while_0.m
Created July 3, 2013 10:32
你是不會用 return 嗎?!
- (id)initWithOperationQueue:(NSOperationQueue *)operationQueue
{
id object = nil;
////////////////////////////////////////////////////////////////////////////////////////////////////
do
{
if(operationQueue==nil)
{
@Superbil
Superbil / talk-org-mode.org
Last active February 12, 2023 07:37
[PyHUG] July: Use Python in Org-mode

[PyHUG] July: Use Python in Org-mode

About

# -*- encoding: utf-8 -*-
import wx
import os.path
from wx.lib.dialogs import openFileDialog
from SimpleCV import Image, Color, Display
# Make a function that does a half and half image.
def halfsies(left, right):
result = left