Skip to content

Instantly share code, notes, and snippets.

🍣
Nobody loves you

Hiroaki Yutani yutannihilation

🍣
Nobody loves you
Block or report user

Report or block yutannihilation

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View start_vagrant.ps1
$targetsfile_loc = "C:\Path\To\Script_Dir\vagrant.list"
$vagrant_cmd = "C:\HashiCorp\Vagrant\bin\vagrant.exe"
$putty_cmd = "C:\Path\To\putty.exe"
$current_loc = Get-Location
$targets = Get-Content $targetsfile_loc
ForEach ($target in $targets) {
$vagrant_dir,$putty_prof = $target.split(",")
Set-Location $vagrant_dir -PassThru
View cloud-config.yml
#cloud-config
hostname: HOSTNAME
write_files:
- path: /etc/iptables.rules
permissions: 0644
content: |
*filter
:INPUT DROP [13:1170]
@yutannihilation
yutannihilation / 00ggplot2_options.R
Last active Aug 29, 2015
options of ggplot2: fixing range and colors
View 00ggplot2_options.R
library(ggplot2)
library(animation)
library(dplyr)
set.seed(100)
data <- data.frame(value = rnorm(1000, mean = 5, sd = sqrt(5)))
### continuous-scale axis ###
# BAD EXAMPLE: Ranges are changing too fast...
View rcpp_hexdump.cpp
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
std::vector<std::string> rcpp_hello_world(std::vector<std::string> strings) {
for(std::vector<std::string>::iterator s_it = strings.begin(); s_it != strings.end(); ++s_it) {
std::vector<unsigned char> c((*s_it).begin(), (*s_it).end());
int length = c.size();
@yutannihilation
yutannihilation / nippon_vs_halfwidthr_vs_stringi.md
Last active Aug 29, 2015
benchmarks of conversion from 全角 to 半角
View nippon_vs_halfwidthr_vs_stringi.md

Libraries and constants

library(halfwidthr)
library(Nippon)
library(stringi)
library(microbenchmark)

a <- rep(zenkaku$number, 10000)
zen <- paste0(c(zenkaku$number, zenkaku$lower, zenkaku$upper), collapse = "")
@yutannihilation
yutannihilation / plus.R
Created Dec 5, 2014
speed of `base::+` and `.Primitive("+")`
View plus.R
> a <- runif(1000,1,10)
> microbenchmark(base::`+`(a, a), .Primitive("+")(a,a))
Unit: microseconds
expr min lq mean median uq max neval
base::`+`(a, a) 14.527 16.483 28.85315 19.556 20.6730 716.852 100
.Primitive("+")(a, a) 5.308 6.147 9.96258 9.220 10.1975 49.448 100
@yutannihilation
yutannihilation / named_argument.md
Last active Aug 29, 2015
data.frame is tricky!
View named_argument.md

When specifying named arguments, you have to use =, instead of <-.

This code

data.frame(x2 <- x2, y2 <- y2)

is actually iterpreted like this:

@yutannihilation
yutannihilation / yrmcds_similatity.md
Last active Aug 29, 2015
word distance of yrmcds and 夜マクド
View yrmcds_similatity.md
@yutannihilation
yutannihilation / console_d3js.png
Last active Aug 29, 2015
D3.js won't work in Rmarkdown document since it contains corrupted characters after converted by rmarkdown::render()
@yutannihilation
yutannihilation / gulpfile.js
Created Dec 29, 2014
Gulp file to compile JS/CSS for htmlwidgets
View gulpfile.js
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var uglifycss = require('gulp-uglifycss');
var mainBowerFiles = require('main-bower-files');
var gulpFilter = require('gulp-filter');
gulp.task('default', function() {
var jsFilter = gulpFilter('**/*.js');
var cssFilter = gulpFilter('**/*.css');
You can’t perform that action at this time.