Skip to content

Instantly share code, notes, and snippets.

View baurzhan-konurbayev's full-sized avatar

Baurzhan Konurbayev baurzhan-konurbayev

View GitHub Profile
sys_dns hostname do
provider "sys_dns_#{node[:ebet][:cluster_dns]}"
ip_address endpoint_connection('sys_dns)
hostname external_hostname
zone node[:sys][:host_domain]
comment 'Host Servername'
action :append
end
ohai 'reload' do
action :nothing
end.run_action(:reload)
cookbook_file '/opt/ohai/plugins/openstack_v2.rb' do
mode '0755'
notifies :reload, 'ohai[reload]', :immediately
source 'ohai.openstack_v2.rb'
action :nothing
end.run_action(:create)
def install_gem(gem_name, gem_source, gem_version, gem_options, gem_compile_time)
# Chef::Log.warn("gem_name #{gem_name} gem_version #{gem_version} gem_source #{gem_source}")
# Install gem from private gem server
res = Chef::Resource::ChefGem.new gem_name, run_context
res.clear_sources true
res.compile_time gem_compile_time
res.options if gem_options
res.version gem_version
res.source gem_source
res.run_action :install
Stove experienced an error!
E: ArgumentError
E: wrong number of arguments (2 for 1)
E: /home/baurzhan/.chefdk/gem/ruby/2.1.0/bundler/gems/stove-942341752e19/lib/stove/cookbook/metadata.rb:60:in `gem'
/opt/chefdk/chef-repo/cookbooks/sys_dns/metadata.rb:18:in `from_file'
/home/baurzhan/.chefdk/gem/ruby/2.1.0/bundler/gems/stove-942341752e19/lib/stove/cookbook/metadata.rb:160:in `instance_eval'
/home/baurzhan/.chefdk/gem/ruby/2.1.0/bundler/gems/stove-942341752e19/lib/stove/cookbook/metadata.rb:160:in `from_file'
/home/baurzhan/.chefdk/gem/ruby/2.1.0/bundler/gems/stove-942341752e19/lib/stove/cookbook/metadata.rb:28:in `from_file'
/home/baurzhan/.chefdk/gem/ruby/2.1.0/bundler/gems/stove-942341752e19/lib/stove/cookbook.rb:112:in `load_metadata!'
/home/baurzhan/.chefdk/gem/ruby/2.1.0/bundler/gems/stove-942341752e19/lib/stove/cookbook.rb:57:in `initialize'
import java.util.Random;
public class ConnectDemo {
public static void main(String[] args) {
ConnectionManager connMngr =new ConnectionManager();
connMngr.createConnection();
connMngr.createConnection();
connMngr.createConnection();
connMngr.createConnection();
https://github.com/facebook/chef-cookbooks/blob/master/README.md
https://github.com/facebook/chef-utils/blob/master/Philosophy.md
Example cookbook: https://github.com/facebook/chef-cookbooks/tree/master/cookbooks/fb_cron
public List<Evaluation> findEvaluationsAssignedToUser(String login, Integer tenderId, Integer proposalId) {
Connection connection = null;
PreparedStatement preparedStatement = null;
List<Evaluation> evaluations = new ArrayList<>();
System.out.println("from EvaluationDaoImpl findEvaluationsAssignedToUser start" + evaluations);
try {
System.out.println("from findEvaluationsAssignedToUser page login" +login+" tenderId "+ tenderId+" proposalId "+proposalId);
connection = ConnectionPool.getInstance().getConnection();
preparedStatement = connection.prepareStatement(PREPARED_STATEMENT_EVALUATION_FIND_BY_USER);
preparedStatement.setString(1, login);
@baurzhan-konurbayev
baurzhan-konurbayev / git-pre-receive-hook.sh
Created February 20, 2019 17:13 — forked from caniszczyk/git-pre-receive-hook.sh
A reasonable git pre-receive-hook
#!/bin/sh
#
# For each ref, validate the commit.
#
# - It disallows deleting branches without a /.
# - It disallows non fast-forward on branches without a /.
# - It disallows deleting tags without a /.
# - It disallows unannotated tags to be pushed.
# recipe1.rb, which I am writing test for
powershell_script "Check if service needs to be restarted" do
code XXXX
notifies :restart, windows_service[resource_from_other_collection], :delayed
action :run
end
# recipe2.rb, which I am writing test for
windows_service "resource_from_other_collection" do
action :nothing
@baurzhan-konurbayev
baurzhan-konurbayev / gist:5eb4eebeaa0da3f5bc2fdf560e977f75
Created July 13, 2020 20:10 — forked from t2psyto/gist:f5453707d2658173715f49293d096fe5
powershell oneliner for encode/decode base64 to file
# encode from binary file to base64txt
powershell -C "& {$outpath = (Join-Path (pwd) 'out_base64.txt'); $inpath = (Join-Path (pwd) 'data.jpg'); [IO.File]::WriteAllText($outpath, ([convert]::ToBase64String(([IO.File]::ReadAllBytes($inpath)))))}"
# decode from base64txt to binary file
powershell -C "& {$outpath = (Join-Path (pwd) 'outdata2.jpg'); $inpath = (Join-Path (pwd) 'out_base64.txt'); [IO.File]::WriteAllBytes($outpath, ([convert]::FromBase64String(([IO.File]::ReadAllText($inpath)))))}"