Skip to content

Instantly share code, notes, and snippets.

@yenjoji
yenjoji / create_ansible_directories.sh
Last active Oct 24, 2017
create ansible directory structure
View create_ansible_directories.sh
#!/bin/sh
mkdir -p playbook
cd playbook
touch production staging integration site.yml
mkdir -p group_vars host_vars library filter_plugins
mkdir -p roles/template/{tasks,handlers,templates,files,vars,defaults,meta}
touch roles/template/{tasks,handlers,templates,files,vars,defaults,meta}/main.yml
@yenjoji
yenjoji / am2321.c
Last active Aug 29, 2015
Raspberry Pi で AM2320/AM2321 を使うプログラムの Mackerel対応版
View am2321.c
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h> /* for O_RDWR */
#include <string.h> /* for memcpy */
#include <linux/i2c-dev.h> /* for I2C_SLAVE */
#include <time.h>
#include <inttypes.h>
#include <math.h>
/* define room id for mackrel*/
View gist:f29553357d3a28566e7e
@Grab('com.pi4j:pi4j-core:0.0.5')
@Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.7.1')
import com.pi4j.io.gpio.GpioFactory
import com.pi4j.io.gpio.Pin
import com.pi4j.io.gpio.PinState
import com.pi4j.io.gpio.RaspiPin
import groovyx.net.http.HttpResponseException
import groovyx.net.http.RESTClient
import org.apache.http.HttpRequest
@yenjoji
yenjoji / gist:a7444e5f2ddb4a94ca5f
Last active Aug 29, 2015
Raspberry Pi で DHT11を使うプログラムのMackerel対応版
View gist:a7444e5f2ddb4a94ca5f
/*
* dht11.c:
* Simple test program to test the wiringPi functions
* DHT11 test
*/
#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
@yenjoji
yenjoji / gist:5310058
Created Apr 4, 2013
どうでもいいテスト用の画像ファイルを生成するGroovy
View gist:5310058
import java.awt.*
import java.awt.image.*
import javax.imageio.*
long lastmod = System.currentTimeMillis()
(1..2000).each{
def bi = new BufferedImage(2048, 1364, BufferedImage.TYPE_INT_RGB)
def g = bi.createGraphics()
g.setBackground(Color.black)
@yenjoji
yenjoji / gist:3620946
Created Sep 4, 2012
groovy で ls -la
View gist:3620946
def proc = [ "ls", "-la"].execute()
proc.inputStream.eachLine{
println it
}
You can’t perform that action at this time.