Skip to content

Instantly share code, notes, and snippets.

View mikakoivisto's full-sized avatar

Mika Koivisto mikakoivisto

View GitHub Profile
@natecavanaugh
natecavanaugh / .gitconfig
Created November 16, 2011 23:09
Alias for 'git split'
# Paste this line into your .gitconfig
split = "!f() { git checkout -b $2 && msg=$(git stash save) && git checkout - && git reset --hard $1 && git checkout $2 && [[ ! $msg =~ ^'No local changes to save'$ ]] && git stash pop; }; f"
# move all commits after the SHA to a new branch
# use case: I accidentally make a bunch of commits into my master branch for a specific feature.
# I want to split off a feature branch and reset my current branch to some point in time before my changes.
# usage
# git split SHA NEW_BRANCH_NAME
@rotty3000
rotty3000 / search_articles.java
Created December 18, 2012 17:25
search for articles by tags
SearchContext searchContext = new SearchContext();
searchContext.setCompanyId(companyId);
// omit groups to search entire portal
searchContext.setGroupIds(new long[] {groupId});
// tags
searchContext.setAssetTagNames(assetTagNames);
@mikakoivisto
mikakoivisto / plexconnect
Last active December 23, 2015 23:19 — forked from natewalck/plexconnect
#!/bin/bash
### BEGIN INIT INFO
# Provides: plexconnect
# Required-Start: plexmediaserver networking
# Required-Stop: plexmediaserver networking
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This is the Plex Connect daemon
# Description: This script starts the Plex Connect
# Python scripts in a detached screen.

user name: liferay passwod : liferay

Commands:

Setting keyboard:

setxkbmap en_US
@rotty3000
rotty3000 / FileUploadSample.java
Created September 17, 2011 19:31
simple sample client for fileupload to dl, requires commons-httpclient and it's dependencies.
import java.io.File;
import java.io.IOException;
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import groovy.io.FileType
if ( args.length < 2 ) {
println "Scan's thread dump *.log files from directory";
println "";
println "Usage:";
println "groovy ThreadDumpAnalyzer.groovy <directory> <first value to look from thread dump> <second value to look from thread dump> <third value to look from thread dump>";
println "";
return;
}
@rotty3000
rotty3000 / freemarker.ftl
Created October 12, 2011 14:12
setting look and feel settings on a non-instancable portlet embedded in the theme
<#assign locPortletId = "82" />
<#assign PortletPreferencesFactoryUtil = staticUtil["com.liferay.portlet.PortletPreferencesFactoryUtil"] />
<#assign portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, locPortletId) />
<#if portletSetup.getValue("portletSetupShowBorders", "") != "false" >
<#assign temp = portletSetup.setValue("portletSetupShowBorders", "false") />
<#assign temp = portletSetup.store() />
</#if>
@awesomejt
awesomejt / Vagrant file
Created January 19, 2017 22:19
Vagrant file to install Jenkins 2 on Ubuntu 16.04 LTS, along with other tools.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# config.vm.box = "Ubuntu-16LTS"
config.vm.box = "ubuntu/xenial64"
config.vbguest.auto_update = false
config.vm.network "forwarded_port", guest: 8080, host: 8090

Display all renderRequest attribute names

    <ul>
    <#list renderRequest.getAttributeNames() as name >
        <li>${name}</li>
    </#list>
    </ul>
@pulsar256
pulsar256 / my_hetzner_xen_setup.md
Last active February 9, 2023 22:20
Hetzner Xen + v4 Subnet + v6 Subnet Setup HowTo

Hetzner Primary IPv4 IP + IPv4/2x Subnet + "Non-Routed" IPv6/64 Subnet HowTo

... so I do not forget the next time I have to figure this stuff out. And perhaps to help other poor souls fiddling with v6/v4 xen setups in a Hetzner network environment.

Basic setup

You can basically follow along the Xen Project Beginners Guide.

The short version

Install Debian Wheezy via Hetzner's installimage on the rescue system, the only important part about partitioning is that you have an LVM volume group named vg0 with enough space for your guests' disks.