Skip to content

Instantly share code, notes, and snippets.

@yenjoji
yenjoji / gist:a7444e5f2ddb4a94ca5f
Last active August 29, 2015 14:18
Raspberry Pi で DHT11を使うプログラムのMackerel対応版
/*
* dht11.c:
* Simple test program to test the wiringPi functions
* DHT11 test
*/
#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
@yenjoji
yenjoji / am2321.c
Last active August 29, 2015 14:19
Raspberry Pi で AM2320/AM2321 を使うプログラムの Mackerel対応版
#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*/
@yenjoji
yenjoji / gist:3620946
Created September 4, 2012 13:00
groovy で ls -la
def proc = [ "ls", "-la"].execute()
proc.inputStream.eachLine{
println it
}
@yenjoji
yenjoji / gist:5310058
Created April 4, 2013 12:42
どうでもいいテスト用の画像ファイルを生成するGroovy
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)
@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 / create_ansible_directories.sh
Last active October 24, 2017 04:53
create ansible directory structure
#!/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