Skip to content

Instantly share code, notes, and snippets.

View cutmail's full-sized avatar
🏠
Working from home

Tatsuya Arai cutmail

🏠
Working from home
View GitHub Profile
map <C-f> scrollPageDown
map <C-b> scrollPageUp
let blacklists = ["https://mail.google.com/*", "*://mail.google.com/*", "@https://mail.google.com/mail/*", "*://feedly.com/*"]
@cutmail
cutmail / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@cutmail
cutmail / gist:ce4f359c34dc7d90ed12
Last active August 29, 2015 14:00
Macのターミナルで桜が降る
ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S="\xf0\x9f\x8c\xb8";a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.01}'
#!/bin/bash
# フィルタリングルールを消去する
/sbin/iptables -F
# デフォルトポリシーを設定
/sbin/iptables -P INPUT DROP
/sbin/iptables -P FORWARD DROP
/sbin/iptables -P OUTPUT DROP
@cutmail
cutmail / activity.pl
Created February 19, 2012 09:36 — forked from sugyan/activity.pl
Twitter activity API test
#!/usr/bin/env perl
use strict;
use warnings;
use Config::Pit;
use Data::Dumper;
use Furl;
use HTTP::Request::Common;
use JSON::XS 'decode_json';
use OAuth::Lite::Consumer;
@cutmail
cutmail / gist:1252292
Created September 30, 2011 00:04
application screenshot from code
#import <QuartzCore/QuartzCore.h>
- (UIImage*) buildImageFrom: (UIView*)view {
UIGraphicsBeginImageContext(view .bounds.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage* viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}
@cutmail
cutmail / trim.java
Created April 8, 2011 07:12
全角スペースもtrimしちゃう
public static String trimUni(String s){
int len = s.length();
int st = 0;
char[] val = s.toCharArray();
while (st < len && (val[st] <= ' ' || val[st] == ' ')) {
st++;
}
while (st < len && (val[len - 1] <= ' ' || val[len - 1] == ' ')) {
len--;
@cutmail
cutmail / ftp_file_list.php
Created March 4, 2011 02:36
Here is the function that would checking whether the given path is directory or not, using ftp_nlist;
<?php
function filecollect($conn_id,$dir='.') {
static $flist=array();
if ($files = ftp_nlist($cid,$dir)){
foreach ($files as $file) {
if (ftp_size($cid, $file) == "-1"){
filecollect($cid,$file);
} else $flist[] = $file;
}
}