Skip to content

Instantly share code, notes, and snippets.

@esycat
esycat / .vimrc
Last active December 15, 2015 15:08
My Vim config file.
" Don't be compatible with Vi
set nocompatible
" Indentation style
set autoindent
"set smartindent
"set cindent
" Tab behavior
set tabstop=4
@esycat
esycat / README.md
Last active October 30, 2023 10:52
How to get GNU's readlink -f behavior on OS X.

readlink.sh is a pure shell implementation that uses dirname, basename, readlink and pwd utils. Note that you cannot rename it to just readlink as then the script will call itself instead of the system utility.

realpath script simply calls Python's os.path.realpath. Python is provided in OS X and major Linux distributions. You can use instead of the system utility by making a symlink: ln -s realpath readlink.

Another way is to install coreutils package via Homebrew or MacPorts and use greadlink.

The code is taken from the following page on StackOverflow: http://goo.gl/Yw9OY

@esycat
esycat / build.gradle
Last active June 6, 2018 21:48
An example Gradle build configuration that shows that `ext` does not always point to the same object as `project.ext`. The assertion on line 10 fails.
assert(project.ext == ext)
// assigning some values just for testing
project.ext.set('a', 'a-val')
ext.set('b', 'b-val')
assert(project.ext == ext)
task test() {
assert(project.ext == ext)
@esycat
esycat / PrettyPrinter.groovy
Last active November 5, 2024 13:54
A simple way to pretty print nested lists and maps in Groovy.
import static groovy.json.JsonOutput.*
def config = ['test': 'lalala']
println prettyPrint(toJson(config))
@esycat
esycat / indent.sh
Created September 27, 2013 06:16
indent params
TAB_SIZE=4
LINE_LENGTH=120
indent \
--no-tabs \
--tab-size${TAB_SIZE} \
--line-length${LINE_LENGTH} \
--space-after-cast \
--braces-on-if-line \
--braces-on-func-def-line \
@esycat
esycat / .gitignore
Last active January 17, 2018 00:17
/.gradle/
/build/
/buildSrc/
generated.conf
@esycat
esycat / .gitignore
Last active January 1, 2016 09:08
MinifyJsTask doesn't work from an included file https://github.com/eriwen/gradle-js-plugin/issues/61
.gradle
build
main.min.js
<?php //exit;
ini_set('display_errors', true);
require_once('config.php');
require_once($folders['lib_prefix'].'/common.php');
echo 'I am relatively healthy.', '<br />';
$filename = './t_second_rna_a14.log';
@esycat
esycat / yay-time.sql
Last active August 29, 2015 14:05
For Tim & Marley with Love :-)
SELECT
DATABASE(), table_name, column_name, data_type,
CONCAT(
"UPDATE ", table_name,
" SET ", column_name, " = CONVERT_TZ(", column_name, ", 'UTC', 'Australia/Sydney')",
" WHERE ", column_name, " > '2014-08-05 22:00:00';"
) AS query
FROM information_schema.columns
WHERE
table_schema = DATABASE()