Skip to content

Instantly share code, notes, and snippets.

View krujos's full-sized avatar

Joshua Kruck krujos

View GitHub Profile
@krujos
krujos / example.java
Created March 16, 2015 19:56
ResponseEntity<?>
@RequestMapping(value = BASE_PATH + "/{instanceId}", method = RequestMethod.GET)
public ResponseEntity<?> getServiceInstance(
@PathVariable("instanceId") String instanceId) {
logger.debug("GET: " + BASE_PATH + "/{instanceId}"
+ ", getServiceInstance(), serviceInstanceId = " + instanceId);
ServiceInstance instance = service.getServiceInstance(instanceId);
if (null == instance) {
@krujos
krujos / cf-manifest.yml
Created February 20, 2015 02:50
bosh lite yaml
compilation:
cloud_properties:
name: random
network: cf1
reuse_compilation_vms: true
workers: 6
director_uuid: cf8dc1fc-9c42-4ffc-96f1-fbad983a6ce6
jobs:
- default_networks:
- name: cf1
@krujos
krujos / yanfs example
Created February 2, 2015 20:36
Java NFS client
package nfstest;
import com.sun.xfile.XFile;
/**
* Using YANFS
*
*/
public class Main {
@krujos
krujos / OpsMgr export & Alias
Created January 17, 2015 22:55
Export and alias to have bosh command "just work"
export BUNDLE_GEMFILE=/home/tempest-web/tempest/web/bosh.Gemfile
alias bosh='bundle exec bosh'
@krujos
krujos / sprint-boot-default-logger
Created December 20, 2014 01:08
Java log getter that i can never remember
import org.apache.log4j.Logger;
public class RedisCloudConfig extends AbstractCloudConfig {
private Logger log = Logger.getLogger(RedisCloudConfig.class);
//...
}
@krujos
krujos / convert.sh
Created November 13, 2014 02:09
Convert a directory full of tiffs to png
for f in *.tiff ; convert $f `(echo $f | sed -e 's/tiff/png/') `;
/**
* Checks if everything except id's and results are equal!
* An example of using the stream operator and a couple of gauva and apache
* language extensions to implement an equality check. We create a pair for
* each thing we want to compare then stream through and assert that
* everything matches the equality test. We use the hash code in the
* equality test as it's a little less finicky for equality tests. This is a
* pretty expensive and heavy weight implementation, not because of the
* functional stuff, but because of all the intermediary objects created. As
* this is example code we don't sweat the efficiency. A simpler
@krujos
krujos / Dockerfile
Created October 10, 2014 04:40
Dockerfile to build on top of postgres, brittle and gross, but works by more or less reimplementing the entry point.
FROM postgres:9.3
MAINTAINER krujos
ENV PGDATA /var/lib/postgresql/data #Why do I need this?
RUN chown -R postgres "$PGDATA"; gosu postgres initdb; sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf ; { echo; echo 'host all all 0.0.0.0/0 trust'; } >> "$PGDATA"/pg_hba.conf
RUN ( chown -R postgres "$PGDATA"; gosu postgres postgres & sleep 2 ; psql -U postgres -c "create user schedule_user;"; psql -U postgres -c "alter user schedule_user password 'schedule_password';"; psql -U postgres -c "create database schedule with owner schedule_user;"; )
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 5432

Keybase proof

I hereby claim:

  • I am krujos on github.
  • I am krujos (https://keybase.io/krujos) on keybase.
  • I have a public key whose fingerprint is 00E3 37A8 EB67 FB39 40BC C251 DCB6 BAFB 6CA7 484A

To claim this, I am signing this object:

tmux cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname