Skip to content

Instantly share code, notes, and snippets.

@mamu7211
mamu7211 / FileMerge.groovy
Created June 9, 2017 06:13
Merging Textfiles with Groovy
import java.io.File
def dir = new File("~/temp/path/to/files")
def target = new File("~/temp/merged.file")
def files = dir.listFiles(new FilenameFilter() {
@Override
boolean accept(File directory, String name) {
return name.toLowerCase().endsWith("log");
}
import groovy.json.*
import org.yaml.snakeyaml.Yaml
new Yaml().dump(new JsonSlurper().parseText("http://.../v2/api-docs".toURL().text))
@mamu7211
mamu7211 / ClassCompare.md
Last active September 2, 2016 08:33
Class Field Information and Class Field Compare

Groovy Class Analyzer Script

This Groovy script can be used to summarize information of a classes fields and compare fields of several classes. If you use IntelliJ, you may know its Groovy Shell feature. Just paste the code into the editor, add classes to the compareTypes or showClass methods.

@mamu7211
mamu7211 / Logfile-Syntax.md
Last active August 9, 2016 16:21
Sublime Text 3 - Logfile Syntax Definition

Logfile Syntax for Sublime Text 3

A custom syntax for Sublime Text 3 for easier logfile analysis.

What it does you ask?

It uses Sublime Text 3's syntax highlighting to color keywords in logfiles. Coloring is based on standard Sublime Text highlighting and may look weird when you changed it.

Type Sample Keywords
@mamu7211
mamu7211 / .mintty.rc
Last active July 20, 2017 06:13
My personal .mintty.rc
BoldAsFont=no
Columns=120
Rows=32
Font=Consolas
FontHeight=14
ConfirmExit=no
Padding=10
ForegroundColour=131,148,150
BackgroundColour=0,43,54
CursorColour=133,153,0
@mamu7211
mamu7211 / part.agnoster.zsh
Created March 27, 2016 12:10
zsh agnoster newline prompt
# add this to agnoster
prompt_newline() {
if [[ -n $CURRENT_BG ]]; then
echo -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR \n%{%k%F{blue}%}$SEGMENT_SEPARATOR"
else
echo -n "%{%k%}"
fi
echo -n "%{%f%}"
CURRENT_BG=''
}
@mamu7211
mamu7211 / backup-postgres-db.sh
Last active February 16, 2016 13:03
Bash script to backup a PostgreSQL database.
#!/bin/bash
BASE_DIR="/.../.../..."
DATA_DIR="$BASE_DIR/work"
ARCHIVE_DIR="$BASE_DIR/archive"
NOW=$(date +"%Y-%m-%d_%H-%M-%S")
DB_NAME='...'
DB_USER='...'
@mamu7211
mamu7211 / spider-prototype-2.c
Created February 12, 2016 11:05
Spider in Arduino - rough sketch...
#include <Servo.h>
/**
* SlowServo =========================================
*/
class SlowServo : public Servo {
// ------------------------------------------
private:
int desiredAngle = 90;
@mamu7211
mamu7211 / redmine.conf
Created February 7, 2016 21:07
redmine.conf
# The passenger module (from the libapache2-mod-passenger package) must be
# enabled
<VirtualHost *:80>
ServerName pezi-redmine
# this is the passenger config
RailsEnv production
SetEnv X_DEBIAN_SITEID "default"
# CHANGE PassengerAppGroupName FOR OTHER INSTANCES
PassengerAppGroupName redmine_default
PassengerDefaultUser www-data
@mamu7211
mamu7211 / arduino-spider-proto-2.c
Created February 5, 2016 14:57
Sketch for one leg of a 'spider-leg' driven by three servos.
/*
* Sketch for my spider leg prototype.
*/
#import<Servo.h>
int interval = 5;
unsigned long lastInterval;
unsigned long deltaInterval;