Skip to content

Instantly share code, notes, and snippets.

View gionn's full-sized avatar
⚔️

Giovanni Toraldo gionn

⚔️
View GitHub Profile
@telenieko
telenieko / GoogleCloudFileStorage.java
Created January 18, 2019 08:05
Sample of a CUBA Storage for Google Cloud Storage - very similar to the supplied AWS S3 one
package com.sample;
import com.google.cloud.storage.*;
import com.haulmont.bali.util.Preconditions;
import com.haulmont.cuba.core.app.FileStorageAPI;
import com.haulmont.cuba.core.entity.FileDescriptor;
import com.haulmont.cuba.core.global.Configuration;
import com.haulmont.cuba.core.global.FileStorageException;
import com.metanube.metai4.google.service.GoogleConfig;
import org.apache.commons.lang3.StringUtils;
@sethvargo
sethvargo / secret.rb
Created February 1, 2016 21:36
Example Chef extension to extract secrets from HashiCorp's Vault
# Please see the following blog post for more information:
#
# https://www.hashicorp.com/blog/using-hashicorp-vault-with-chef.html
#
resource_name :vault_secret
property :path, String, name_property: true
property :destination, String
@gionn
gionn / Comments.java
Last active February 2, 2018 15:01
Nice java code comments
{} // this is intentionally left blank
// Coming soon : backup plan
// However this is not a definitive solution
// This is an atrocity
// Questions overflow! Die Gosling!
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@leifg
leifg / Vagrantfile
Last active November 12, 2023 08:31
Add a second disk to system using vagrant
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
@arangamani
arangamani / chef_attribute_converge.rb
Last active February 20, 2023 02:44
Dynamically update attribute of a Chef resource during converge phase (Node variable assignment in Compile vs Converge)
# In Chef, when a resource is defined all its variables are evaluated during
# compile time and the execution of the resource takes place in converge phase.
# So if the value of a particular attribute is changed in converge
# (and not in compile) the resource will be executed with the old value.
# Example problem:
# Let's consider this situation where there are two steps involved in a recipe
# Step 1 is a Ruby block that changes a node attribute. Rubyblocks get executed
# in converge phase
# Step 2 is a Chef resource that makes use of the node attribute that was
from fabric.api import cd, env, local, prefix, run, sudo
env.hosts = ['cs01.actalis.vpn']
env.project_root = '/home/libersoft/visalaid'
env.user = 'libersoft'
def push():
local('git push')
@lusis
lusis / keytool.rb
Created March 26, 2012 04:51
recipe for adding certs to keytool
keystore = "/etc/java-6-sun/security/cacerts"
keystore_pass = "foobar"
# you'll need foo.cert et. al. in files/default
certs = %w{foo bar bang}
certs.each do |cert|
cookbook_file "#{Chef::Config[:file_cache_path]}/#{cert}.cert" do
source "#{cert}.cert"
end
@hoverlover
hoverlover / savon_client.rb
Created March 19, 2012 14:45
Using my forks of Akami and Savon to sign a request with a X.509 certificate. See https://github.com/genuitytech/akami and https://github.com/genuitytech/savon.
client = Savon::Client.new do
# This can be a URL also
wsdl.document = "/Path/to/your.wsdl"
# These are optional, only if your WSDL sucks :)
wsdl.endpoint = "https://your_endpoint"
wsdl.namespace = "http://your_namespace"
certs = Akami::WSSE::Certs.new :cert_file => "/path/to/cert.crt", :private_key_file => "/path/to/private/key.pem", :private_key_password => "password"
wsse.sign_with = Akami::WSSE::Signature.new certs
@fujin
fujin / foo.rb
Created January 31, 2012 21:49
template override between cookbooks
template "/tmp/foo.rb"
source "foo.rb.erb"
cookbook "banana"
end