Skip to content

Instantly share code, notes, and snippets.

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
public class TextOutputExample {
public static void main(String args[]) throws FileNotFoundException {
PrintWriter out = new PrintWriter(new FileOutputStream("file.txt"));
out.println("hi there, graham");
out.println("how are you");
out.close(); // important
@gaffo
gaffo / index.ts
Last active October 7, 2018 20:03
CDK Lambda Gateway
import cdk = require('@aws-cdk/cdk');
// import apigateway = require('@aws-cdk/aws-apigateway');
import lambda = require('@aws-cdk/aws-lambda');
// import assets = require('@aws-cdk/assets');
// import s3 = require('@aws-cdk/aws-s3');
import path = require('path');
class MyStack extends cdk.Stack {
constructor(parent: cdk.App, id: string, props?: cdk.StackProps) {
super(parent, id, props);
#define DEFAULT_AXIS_STEPS_PER_UNIT {96.97, 96.97, 4535.44, 1031.820970132} // default steps per unit for Ultimaker
#define DEFAULT_MAX_FEEDRATE {500, 500, 5, 25} // (mm/sec)
#define DEFAULT_MAX_ACCELERATION {9000,9000,100,10000} // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for Skeinforge 40+, for older versions raise them a lot.
#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for retracts
exec "sudo apt-get update --fix-missing" do
user "root"
end
package 'vim'
package 'mysql-server'
package 'mysql-client'
package 'git-core'
package 'python'
package 'python-twisted'
#include <iostream>
#include <stdio.h>
using namespace std;
#include <mruby.h>
#include <mruby/compile.h>
#include <mruby/value.h>
class CTest{
public:
@gaffo
gaffo / gist:4975146
Created February 18, 2013 04:38
Synfig build error
libtool: compile: g++ -DHAVE_CONFIG_H -I../../.. -I../../../src -I/usr/include/libxml2 -I/usr/include/glibmm-2.4 -I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include -I/usr/local/include -I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/include -DSYNFIG_NO_DEPRECATED -DLOCALEDIR=\"/usr/local/share/locale\" -DNDEBUG -O2 -W -Wall -MT libmod_magickpp_la-main.lo -MD -MP -MF .deps/libmod_magickpp_la-main.Tpo -c main.cpp -fPIC -DPIC -o .libs/libmod_magickpp_la-main.o
mv -f .deps/libmod_magickpp_la-main.Tpo .deps/libmod_magickpp_la-main.Plo
/bin/bash ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I../../.. -I../../../src -I/usr/include/libxml2 -I/usr/include/glibmm-2.4 -I/usr/lib/x86_64-linux-gnu/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/x86_64-linux-gnu/sigc++-2.0/includ
input {
udp {
format => json_event
port => 19898
type => "spp"
}
}
group {"puppet" : ensure => "present"}
# general config options
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
exec { 'apt-get update':
command => 'sudo apt-get update'
}
group {"puppet" : ensure => "present"}
# general config options
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
exec { 'apt-get update':
command => 'sudo apt-get update'
}
@gaffo
gaffo / gist:3118768
Created July 15, 2012 21:46
cucumber rails 3.2
➜ moveatron git:(cucumber) rake
Loaded suite /home/mike/workspace-web/moveatron/vendor/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader
Started
..........................
Finished in 0.481750882 seconds.
26 tests, 39 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed