Skip to content

Instantly share code, notes, and snippets.

View grandeforesta's full-sized avatar

Yusuke Obayashi grandeforesta

View GitHub Profile
@Nihisil
Nihisil / jail.local
Last active September 5, 2023 06:20
Send notifications to the Slack from fail2ban
...
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$
slack[name=%(__name__)s]
action = %(action_with_slack_notification)s
...
@hjuutilainen
hjuutilainen / extractIdentityAndTrustTests
Created June 11, 2014 19:48
SecPKCS12Import fiddling
OSStatus extractIdentityAndTrust(CFDataRef inP12data, SecIdentityRef *identity, SecTrustRef *trust)
{
OSStatus securityError = errSecSuccess;
CFStringRef password = CFSTR("ThePassword");
const void *keys[] = { kSecImportExportPassphrase };
const void *values[] = { password };
CFDictionaryRef options = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL);
@hirohitokato
hirohitokato / ViewController.m
Created December 17, 2013 05:52
Video capturing with the highest fps.
@import AVFoundation;
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic)AVCaptureSession *session;
@end
@implementation ViewController
- (void)viewDidLoad

すぐれた PHP ライブラリとリソース

Awesome PHP の記事をフォークして翻訳したものです (2013年4月25日)。おどろくほどすごい PHP ライブラリ、リソースやちょっとした情報のリストです。

【訳者コメント】 PHP 入門者のかたにはクィックリファレンスとして PHP: The Right Way 、セキュリティに関しては2011年3月に出版された 体系的に学ぶ 安全なWebアプリケーションの作り方 をおすすめします。

Composer

@yorozu
yorozu / post-is-in-descendant-category.php
Last active December 11, 2015 09:59
「子カテゴリー内の投稿かテストする http://j.mp/XKtkab 」をプラグイン化。 さらに、カスタムタクソノミーにも対応し、スラッグでも利用できるように拡張
<?php
/**
Plugin Name: Post is in Descendant Category
Version: 1.1.0
Plugin URI: https://gist.github.com/yorozu/4583960
Description: Tests if any of a post's assigned categories are descendants of target categories or taxonomies
Author: KATO Yoshitaka
Author URI: http://curious-everything.com/
Original:
@rkmathi
rkmathi / deploy.rb
Created December 5, 2012 15:24
http://blog.has-key.org/208 - 4. デプロイの準備
require "capistrano_colors"
require "bundler/capistrano"
# RVM settings
# $:.unshift(File.expand_path("./lib", ENV["rvm_path"]))
require "rvm/capistrano"
set :rvm_type, :user
set :rvm_ruby_string, "1.9.3"
# Repository settings
@rummelonp
rummelonp / undersky.md
Last active April 16, 2023 03:57
Ubuntu+Nginx+Unicorn+Rails+Capistrano
@ellneal
ellneal / gist:2557400
Created April 30, 2012 11:06
Static View at top of UIScrollView - place in layoutSubviews
UIView *staticHeaderView = <#static view#>;
CGRect visibleBounds = self.bounds;
CGRect staticHeaderFrame = staticHeaderView.frame;
CGRect contentRect = CGRectMake(0, 0, self.contentSize.width, self.contentSize.height);
if (CGRectGetMinY(visibleBounds) < CGRectGetMinY(contentRect)) {
staticHeaderFrame = CGRectMake(visibleBounds.origin.x, CGRectGetMinY(contentRect), staticHeaderFrame.size.width, staticHeaderFrame.size.height);
}
@Abizern
Abizern / uuidgen.m
Created December 20, 2011 11:51
A method that returns a UUID in an ARC environment.
- (NSString *)uuidString {
// Returns a UUID
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
NSString *uuidStr = (__bridge_transfer NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);
CFRelease(uuid);
return uuidStr;
}
import os
import csv
from subprocess import Popen, PIPE
from Foundation import NSMutableDictionary
build_number = os.popen4("git rev-parse --short HEAD")[1].read()
info_plist = os.environ['BUILT_PRODUCTS_DIR'] + "/" + os.environ['WRAPPER_NAME'] + "/Info.plist"
# Open the plist and write the short commit hash as the bundle version
plist = NSMutableDictionary.dictionaryWithContentsOfFile_(info_plist)