Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Tatsuya Arai cutmail

🏠
Working from home
View GitHub Profile
View gist:8d477f47c2a1fdef583a
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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// 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 Aug 29, 2015
Macのターミナルで桜が降る
View gist:ce4f359c34dc7d90ed12
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}'
View setiptables.sh
#!/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 Feb 19, 2012 — forked from sugyan/activity.pl
Twitter activity API test
View activity.pl
#!/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 Sep 30, 2011
application screenshot from code
View gist:1252292
#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 Apr 8, 2011
全角スペースもtrimしちゃう
View trim.java
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 Mar 4, 2011
Here is the function that would checking whether the given path is directory or not, using ftp_nlist;
View ftp_file_list.php
<?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;
}
}