Skip to content

Instantly share code, notes, and snippets.

function devel() { cd ~/public_html/devel/"$@"; }
alias dev='devel'
_dev()
{
local cur opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$(ls -d ~/public_html/devel/* | xargs -l basename | tr "\\n" " ")
COMPREPLY=( $(compgen -W "${opts}" ${cur}) )
@ksaua
ksaua / Example.java
Last active July 26, 2017 10:26
@Profile equivalent for Constretto
package com.example;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@WithConstrettoTag("development")
public class Example {
@Bean
public DataSource developmentDataSource() {
eclipse {
classpath {
file {
whenMerged { classpath ->
classpath.entries.each {
if (it instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency) {
//println "${it.class}, $it"
if (it.path.toString().contains('Implementation')) {
def accessRule = new org.gradle.plugins.ide.eclipse.model.AccessRule("nonaccessible", "**")
it.accessRules.add(accessRule)
@ksaua
ksaua / build.gradle
Last active October 15, 2018 20:28
Gradle plugin which uses itself
// Let's say we have a gradle plugin. Now we want that gradle plugin project to actually use the exact plugin.
// There are probably multiple ways we can bootstrap this. One way is to build the jar, and use that, but that's boring.
// Here we show how we can have the plugin-project use the actual plugin we are building.
// :: We load the groovy script on runtime, only then are we able to apply the plugin
// Setup the groovy classpath. Start with our own files
def classpaths = [file('src/main/groovy').absolutePath, file('src/main/resources').absolutePath]
// The groovy script engine wants a string array
String[] classpathArray = classpaths.toArray(new String[classpaths.size()]);
// Start a groovy script engine with our classpaths
(require '[clojure.string :as str])
(def characters (apply str
" _ _ _ _ _ _ _ _ \n"
"| | | _| _||_||_ |_ ||_||_|\n"
"|_| ||_ _| | _||_| ||_| _|\n"
" \n"))
(defn chunk3 [line]
(->> (partition 3 line)
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cljs/repl__init.class or cljs/repl.clj on classpath: , compiling:(cemerick/piggieback.clj:1:1)
java.io.FileNotFoundException: Could not locate cljs/repl__init.class or cljs/repl.clj on classpath:
...
clojure.core/load/fn core.clj: 5641
clojure.core/load core.clj: 5640
...
clojure.core/load-one core.clj: 5446
clojure.core/load-lib/fn core.clj: 5486
clojure.core/load-lib core.clj: 5485
...
@ksaua
ksaua / cygwin.bat
Created March 20, 2017 15:42
Open cygwin in current directory
@echo off
SET currentdir=%cd%
C:
chdir C:\ksm\programmer\cygwin64\bin
for /f "tokens=*" %%i in ('cygpath %currentdir%') do set DIR_CYGPATH=%%i
bash --login -i -c "cd \"%DIR_CYGPATH%\"; exec bash"