Skip to content

Instantly share code, notes, and snippets.

#/usr/bin/env bash
set -e
set -x
apt-get update
apt-get upgrade
apt-get -y install build-essential curl git-core openssl libreadline6 libreadline6-dev \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
var gulp = require('gulp');
var connect = require('gulp-connect');
var modRewrite = require('connect-modrewrite');
var runSequence = require('run-sequence');
var shell = require('gulp-shell');
//proxy all requests to /api to localhost:3000 for rails api
gulp.task('connect', function(){
connect.server({
root: './app',
@ysaito8015
ysaito8015 / brew-cask-upgrade.sh
Last active April 2, 2017 20:43 — forked from n0ts/brew-cask-upgrade.sh
brew cask upgrade
#!/bin/bash [0/0]
set -Ceu
for c in $(brew cask list); do
info=$(brew cask info $c)
installed_ver=$(echo "$info" |awk 'NR==1' |cut -d" " -f 2)
current_ver=$(echo "$info" |awk 'NR==3' | cut -d" " -f 1 | rev |cut -d"/" -f 1| rev)
if [ "$current_ver" == "latest" ]; then
echo "$c is installed '$installed_ver', current is '$current_ver'"
echo -n "upgrade?[y/n]>"
@ysaito8015
ysaito8015 / x_means.py
Created March 6, 2018 07:48 — forked from yasaichi/x_means.py
Implementation of X-means clustering in Python
"""
以下の論文で提案された改良x-means法の実装
クラスター数を自動決定するk-meansアルゴリズムの拡張について
http://www.rd.dnc.ac.jp/~tunenori/doc/xmeans_euc.pdf
"""
import numpy as np
from scipy import stats
from sklearn.cluster import KMeans
@ysaito8015
ysaito8015 / hello.cpp
Last active November 30, 2022 22:46 — forked from snaka/hello.cpp
"Hello world" する LLVM assembly code を生成する C++ コード
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/BasicBlock.h>
#include <llvm/IR/CallingConv.h>
#include <llvm/IR/Constants.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/GlobalVariable.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/PassManager.h>
#include <llvm/IR/Verifier.h>
@ysaito8015
ysaito8015 / bash.js
Created November 1, 2019 01:13 — forked from BenHall/bash.js
Katacoda Embedded Example
<script src="//katacoda.com/embed.js"></script>
<div id="inline-terminal-1" data-katacoda-env="bash" style="height: 500px;"></div>
import base64
import pickle
from email.mime.text import MIMEText
from googleapiclient.discovery import build
def create_message(sender, to, subject, message_text):
"""Create a message for an email.
Args:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ysaito8015
ysaito8015 / lpmixnorm.R
Created December 26, 2023 02:17 — forked from abikoushi/lpmixnorm.R
posterior density of the mixture normal distribution
library(ggplot2)
library(gganimate)
logsumexp=function (logx1,logx2){
logx1 + log1p(exp(logx2-logx1))
}
llmixnorm <- function(par, y){
a0 <- par[1]
b0 <- par[2]
@ysaito8015
ysaito8015 / gnuplot_quickstart.md
Created January 2, 2024 04:15 — forked from darencard/gnuplot_quickstart.md
A quick-start guide for using gnuplot for in-terminal plotting

A quick-start guide for using gnuplot for in-terminal plotting

Sometimes it is really nice to just take a quick look at some data. However, when working on remote computers, it is a bit of a burden to move data files to a local computer to create a plot in something like R. One solution is to use gnuplot and make a quick plot that is rendered in the terminal. It isn't very pretty by default, but it gets the job done quickly and easily. There are also advanced gnuplot capabilities that aren't covered here at all.

gnuplot has it's own internal syntax that can be fed in as a script, which I won't get into. Here is the very simplified gnuplot code we'll be using:

set terminal dumb size 120, 30; set autoscale; plot '-' using 1:3 with lines notitle

Let's break this down: