Skip to content

Instantly share code, notes, and snippets.


Gosuke Miyashita mizzy

View GitHub Profile
View generate_import.go
package main
import (
gohcl2 ""
hcl2parse ""
View rename_resources.go
package main
import (
gohcl2 ""
View compare.go
func compare(t *testing.T, actual, expected interface{}) error {
if actual == nil {
return fmt.Errorf("Expected response should include %#v, but actually %#v", expected, actual)
a := actual.(map[string]interface{})
for k, v := range expected.(map[string]interface{}) {
switch p := v.(type) {
case int:
v = float64(p)
View asn1.go
package main
import (
type attr struct {
Type int
Version int
View convert-tfstate.rb
#!/usr/bin/env ruby
require 'json'
tfstate_file = ARGV[0]
tfstate = '', 'r') do |f|
tfstate = JSON.load(f)
extern crate dbus;
use dbus::{Connection, BusType, Message, Path};
use dbus::arg;
fn main() {
// Get object path by service name
let c = Connection::get_private(BusType::System).unwrap();
let m = Message::new_method_call("org.freedesktop.systemd1",
View gist:7d92736648cddd91acf627899cb80da5
dbus-send --system \
--dest=org.freedesktop.systemd1 \
--type=method_call \
--print-reply \
/org/freedesktop/systemd1 \
dbus-send --system \
--dest=org.freedesktop.systemd1 \
View rand.c
#include "mruby.h"
#include <stdlib.h>
static mrb_value mrb_rand(mrb_state *mrb, mrb_value recv)
int n = rand();
return mrb_fixnum_value(n);
static mrb_value mrb_srand(mrb_state *mrb, mrb_value recv)
View gist:9e521b0ace564ce053fc
cmd = %q{DEBIAN_FRONTEND='noninteractive' apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install mysql-community-server}
Open3.popen3(cmd) do |i, o, e, w|
e.each {|line| puts line }
You can’t perform that action at this time.