Skip to content

Instantly share code, notes, and snippets.

@rerorero
rerorero / hosts2dnsmasq.sh
Last active August 29, 2015 14:06
hostsファイルをdnsmasq設定に変換する
#!/bin/sh
# usage:
# $ sudo hosts2dnsmasq.sh /etc/hosts
source=$1
tmphosts="$1.tmp"
maskhostsdir=/etc/dnsmasq.d
maskhostsfile=0hosts
dnsmasq_hosts="$maskhostsdir/$maskhostsfile"
@rerorero
rerorero / free-monad-sample.scala
Created February 4, 2015 11:01
free monad sample1
import scalaz._
import Scalaz._
sealed trait LogF[A]
object Logging {
type Log[A] = Free[LogF, A]
implicit def logFFunctor[B]: Functor[LogF] = new Functor[LogF]{
@rerorero
rerorero / list-of-readerT-sample1.scala
Last active August 29, 2015 14:15
List[ReaderT]をfoldしたい
package test
import scalaz._
import scala.util._
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
object main extends App {
type Input = String
@rerorero
rerorero / sandbox.scala
Last active July 28, 2020 11:21
luaj-sandbox-sampole
package main
import org.luaj.vm2.{LuaValue, Globals, Varargs}
import org.luaj.vm2.lib.jse.{JsePlatform}
import org.luaj.vm2.lib.{VarArgFunction}
import java.io.File
import scala.util.Try
class LuaArgFunction(val f: (Varargs) => Varargs) extends VarArgFunction {
override def invoke(args : Varargs) = f(args)
@rerorero
rerorero / Ast.scala
Created March 20, 2015 13:08
LuaParser
package luuuaaa
import scala.util.parsing.input.Positional
sealed trait Node extends Positional
case class Name(name:String) extends Node
case class Number(value:Any) extends Node
case class StringVal(value:String) extends Node
case class Nil() extends Node
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
for n in {1..2}; do ssh server$n "ls"; done
@rerorero
rerorero / pom.xml
Created November 27, 2016 23:38
proto-pom-example
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
@rerorero
rerorero / sample.html
Created December 2, 2016 13:17
bootstrap-nested-collapse
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->