Skip to content

Instantly share code, notes, and snippets.

#test.sh
#!/bin/bash
echo FUBAR is $FUBAR
. export_fubar.sh
echo FUBAR is $FUBAR
#export_fubar.sh
#!/bin/bash
Instead of this:
define set_fix {
file_line { "$name":
path => "$name",
line => 'JAVA_HOME=${JAVA_HOME:-/usr/jdk64/jdk1.6.0_31}',
match => 'JAVA_HOME=.*/jdk1\.6\.0.*',
ensure => "present",
}
}
cat | puppet apply
notify { [ '/path/file1', '/path/file2', ]:
message => "$name - $title - $value - $fubar",
}
^D
Output:
Notice: Compiled catalog for sandbox.hortonworks.com in environment production in 0.05 seconds
Notice: main - main - -
Snippit of default.pp:
class { "::mysql::server":
override_options => $mysql_override_options,
}
class { "java":
distribution => "jdk",
version => "latest",
}
class { "::mysql::bindings":
# Note I'm not defining any nodes since this particular VM is a single instance box.
$mysql_override_options = {
'mysqld' => {
'query_cache_limit' => '128M',
'query_cache_size' => '256M',
'query_cache_type' => '1',
},
'mysqld_safe' => {
# Set the MySQL timezone.
class { '::mysql::server':
override_options => { 'mysqld' => {
'query_cache_limit' => '128M',
'query_cache_size' => '256M',
'query_cache_type' => '1',
}, 'mysqld_safe' => {
# Set the MySQL timezone.
# @see http://stackoverflow.com/questions/947299/how-do-i-make-mysqls-now-and-curdate-functions-use-utc
# in manifests/default.pp
define append_if_no_such_line($file, $line, $refreshonly = 'false') {
exec { "/bin/echo '$line' >> '$file'":
unless => "/bin/grep -Fxqe '$line' '$file'",
path => "/bin",
refreshonly => $refreshonly,
}
}
@deinspanjer
deinspanjer / gist:8528424
Last active January 3, 2016 22:29
Postgres query that implements the "last non-null value"
steelwheels=# select a1_h0_l0
steelwheels-# , a1_h0_l1
steelwheels-# , a1_h0_l2
steelwheels-# , a0_h0_l0
steelwheels-# , a0_h0_l1
steelwheels-# , m0
steelwheels-# , first_value(m0)
steelwheels-# over (
steelwheels(# partition by p0
steelwheels(# order by a1_h0_l0
@deinspanjer
deinspanjer / Test.java
Last active January 3, 2016 19:49
Example of a problem where I'm trying to have a class implement an interface but return a couple of extra methods, but I cannot use that class in places where an interface method expects the return type to be the base interface. Edit: Now with a solution.
import java.util.*;
public class Test {
public static interface Position {}
public static interface Axis {
public List<? extends Position> getPositions();
}
public static class GoodAxis implements Axis {
private List<Position> positions = new ArrayList<>();
@deinspanjer
deinspanjer / gist:8476437
Last active January 3, 2016 14:29
Terminal log of my attempts to merge lagunitas branch into my tajo branch and ensure everything is up to date both locally and in my origin github user repo.
### ** From my first terminal window which was dealing with my local copy of the lagunitas branch. **
[1001][me@xxx: ~]$ cd src/mondrian-lagunitas/
[1001][me@xxx: mondrian-lagunitas (lagunitas)]$ git status
On branch lagunitas
nothing to commit, working directory clean
[1004][me@xxx: mondrian-lagunitas (lagunitas)]$ git log
commit 24b9fc2c84031bce388b5aa4f63684229c96d625