Skip to content

Instantly share code, notes, and snippets.

View y-yoshinoya's full-sized avatar

Yuki Yoshinoya y-yoshinoya

View GitHub Profile
@y-yoshinoya
y-yoshinoya / Build.scala
Created August 29, 2012 15:20
jdi connection sample
import sbt._
import Keys._
object MyBuild extends Build {
lazy val root = Project("root", file("."),
settings = Project.defaultSettings ++ Seq(
version := "0.1",
scalaVersion := "2.9.2",
libraryDependencies ++= Nil,
unmanagedJars in Compile <+= (javaHome) map { javaHome =>
#!/bin/bash
# Create zip archive within multibyte-named files for Windows PC.
# (utf-8 -> sjis)
#
# Dependencies:
# sudo apt-get install zip convmv
if [ $# -lt 2 ]; then
echo "usage: $0 zipfile files" 1>&2
@y-yoshinoya
y-yoshinoya / direct_hb.js
Created October 28, 2013 09:15
direct_hb.js for Firefox 22+ and Vimperator 3.7+
// Vimperator plugin: 'Direct Hatena Bookmark'
// Last Change: 10-Apr-2008. Jan 2008
// License: Creative Commons
// Maintainer: Trapezoid <[email protected]> - http://unsigned.g.hatena.ne.jp/Trapezoid
// Parts:
// http://d.hatena.ne.jp/fls/20080309/p1
// Pagerization (c) id:ofk
// AutoPagerize (c) id:swdyh
//
// Hatena Bookmark direct add script for Vimperator 0.6.*
@y-yoshinoya
y-yoshinoya / Bundled.scala
Created September 29, 2014 08:56
bundling implicit conversions
class Rich[S] {
def conversion(s: S) = new Foo {}
def optionConversion(s: Option[S]) = new Foo {}
}
trait Foo {
def foo = "foo"
}
object Foo {
import java.io.File
import org.clapper.classutil.ClassFinder
Object App extends App {
val classloader = Thread.currentThread.getContextClassLoader // some classloader
val classpath = classloader.getResource(".").toURI
val finder = ClassFinder(Seq(File(classpath)))
val classes = finder.getClasses.toIterator
val subClasses = ClassFinder.concreteSubclasses("com.foo.bar.ParentInterface", classes)
subClasses.foreach(println)
@y-yoshinoya
y-yoshinoya / gist:413fcd3f6bfcfce54456
Created January 27, 2015 00:49
Install headless VirtualBox and Vagrant for Ubuntu 14.04 Server
wget -q -O - http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian precise non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list'
sudo apt-get update
sudo apt-get install linux-headers-$(uname -r) build-essential virtualbox-4.3 dkms
cd /tmp
wget http://download.virtualbox.org/virtualbox/4.3.20/Oracle_VM_VirtualBox_Extension_Pack-4.3.20-96996.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.20-96996.vbox-extpack
wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.deb
sudo dpkg -i vagrant_1.7.2_x86_64.deb
@y-yoshinoya
y-yoshinoya / .vimrc
Last active September 3, 2017 05:54
vimrc for TypeScript code completion
"NeoBundle Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath^=/home/vagrant/.vim/bundle/neobundle.vim/
" Required:
call neobundle#begin(expand('/home/vagrant/.vim/bundle'))
import os
import yaml
import xml.etree.ElementTree as ET
directory_path = "/path/to/src/main/mule"
global_config_path = "/path/to/src/main/resources/properties/global-config.yaml"
def load_global_config(path):
# YAMLファイルの読み込み
with open(path, 'r') as file:
@y-yoshinoya
y-yoshinoya / Main.scala
Created April 18, 2025 07:32
Squeryl sample (Scala 3, SQLite)
import org.squeryl.adapters.SQLiteAdapter
import org.squeryl.{Schema, SessionFactory, Session, KeyedEntity}
import java.sql.DriverManager
import org.squeryl.PrimitiveTypeMode._
class Person(
val id: Long,
var name: String,
var age: Option[Int]