Skip to content

Instantly share code, notes, and snippets.

@squarepegsys
squarepegsys / resources.groovy
Created August 19, 2015 00:43
HikariCP in Grails
// Shameless stolen from http://stackoverflow.com/questions/25772324/defining-an-alternate-connection-pool-in-grails-2-3-6
def config = Holders.config
def dataSources = config.findAll {
it.key.toString().contains("dataSource_")
}
dataSources.each { key, value ->
def ds = value
@mathifonseca
mathifonseca / GRAILS - Assigned id for domains.md
Last active July 15, 2019 00:26
GRAILS - Assigned id for domains

If you have a Domain class with an assigned id (not the default autoincremented long), the id assignment must not be in the constructor, but in a different line.

That means, having this domain:

class State implements Serializable {
    String id
    static mapping = {
    	id column: 'id', generator: 'assigned'
 }
@rakeshsingh
rakeshsingh / Java Code - Url Shortener.java
Last active January 4, 2024 03:42
Java Code - Url Shortener
package testjava;
import java.util.HashMap;
import java.util.Random;
/*
* URL Shortener
*/
public class URLShortener {
// storage for generated keys
@ostinelli
ostinelli / jenkins_ci_on_osx.md
Last active February 28, 2023 02:38
Setup Jenkins CI on OSX.

Jenkins CI on OSX

Instructions on how to setup a secured Jenkins CI on a Mac.

Download & Install dependencies

All of these operations are done with your admin user.

Developer tools

Install the command line developer tools.

@johnbintz
johnbintz / simple-capistrano-docker-deploy.rb
Last active April 3, 2023 08:23
Simple Capistrano deploy for a Docker-managed app
# be sure to comment out the require 'capistrano/deploy' line in your Capfile!
# config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'my-cool-application'
# the base docker repo reference
set :name, "johns-stuff/#{fetch(:application)}"
@gboudreau
gboudreau / install-ffmpeg-amazon-linux.sh
Last active November 21, 2023 19:48
How to compile ffmpeg on Amazon Linux (EC2)
#!/bin/sh
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264
if [ "`/usr/bin/whoami`" != "root" ]; then
echo "You need to execute this script as root."
exit 1
fi
cat > /etc/yum.repos.d/centos.repo<<EOF
@Starefossen
Starefossen / remoteDataTableView.swift
Last active January 16, 2023 09:50
Remote JSON Data to tableView in iOS 8.0 (Swift)
import UIKit
import Foundation
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely()
class RemoteAPI {
func getData(completionHandler: ((NSArray!, NSError!) -> Void)!) -> Void {
let url: NSURL = NSURL(string: "http://itunes.apple.com/search?term=Turistforeningen&media=software")
let ses = NSURLSession.sharedSession()
@xdamman
xdamman / install_ffmpeg_ubuntu.sh
Created July 2, 2014 21:03
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@thomasfr
thomasfr / autossh.service
Last active January 5, 2024 08:11
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@esfand
esfand / typescript_angular.adoc
Last active September 30, 2022 12:37
AngularJS with TypeScript