Skip to content

Instantly share code, notes, and snippets.

View FilBot3's full-sized avatar
😀
Working hard

FilBot3 FilBot3

😀
Working hard
View GitHub Profile
@FilBot3
FilBot3 / 00-knife_opc_user_remove.sh
Created August 17, 2015 16:36
Chef 12 Server Core User Deletion
PS> knife opc org user remove csm user01
ERROR: You authenticated successfully to https://chefserver01:443 as user01 but you are not authorized for this action
Response: Please remove user01 from this organization's admins group before removing him or her from the organization.
@FilBot3
FilBot3 / 00-config.yml
Last active August 29, 2015 14:27
Razor Server setup issue
---
# This is the configuration file for the Razor server. For each
# environment, the file contains a hash of configuration values. The
# special environment 'all' is used to set configuration values for all
# environments
#
# The *database_url* setting must be a connection URL for
# (Sequel)[http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html]
production:
@FilBot3
FilBot3 / zabbix_get_IO_stat.sh
Created August 20, 2015 21:08
Gets a stat from the Linux OS for LV read/write, i forget which field it was.
sudo -u zabbix -- cat /proc/diskstats | /bin/grep dm-`dmsetup ls | grep \`cat /etc/fstab | grep /u01/app/oracle/admin/mybi_domain/mserver/applications | awk '{print $1}' | awk -F/ '{print $NF}'\` | awk '{print $3}' | sed s'/.$//'` | awk '{print $13}'
@FilBot3
FilBot3 / CentOS_6_ChefDK_070_notworking.rb
Last active September 15, 2015 23:00
chef_knife_cookbook_upload_notworking
[vagrant@centos6 vagrant]$ chef exec knife cookbook upload confluence_install
ERROR: Could not find cookbook confluence_install in your cookbook path, skipping it
ERROR: Failed to upload 1 cookbook.
[vagrant@centos6 vagrant]$ chef exec knife cookbook upload confluence_install -o ./cookbooks/
ERROR: Could not find cookbook confluence_install in your cookbook path, skipping it
ERROR: Failed to upload 1 cookbook.
[vagrant@centos6 vagrant]$ chef exec knife cookbook upload confluence_install -o /vagrant/cookbooks/
ERROR: Could not find cookbook confluence_install in your cookbook path, skipping it
ERROR: Failed to upload 1 cookbook.
[vagrant@centos6 vagrant]$ chef exec knife cookbook upload confluence_install -o /vagrant/cookbooks/ --verbose
@FilBot3
FilBot3 / docker-zabbix-db.service
Last active December 1, 2015 17:15
Using SystemD to start Docker Containers but are failing
[Unit]
Description=Zabbix MariaDB for 2.4
Requires=docker.service
After=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStart=/usr/bin/docker run -d --name zabbix-db -v /backups:/backups --volumes-from zabbix-db-storage --env="MARIADB_USER=zabbix" --env="MARIADB_PASS=my_password" zabbix/zabbix-db-mariadbserver-2.4
ExecStop=/usr/bin/docker stop -t 2 zabbix-db
@FilBot3
FilBot3 / get_heap_used.sh
Last active December 5, 2015 08:01
jmx4r example.
CMD="get -b java.lang:type=Memory HeapMemoryUsage"
echo $CMD | java -jar jmxterm-1.0-alpha-4-uber.jar -l localhost:1099 -n
@FilBot3
FilBot3 / ruby_threading_example_1.rb
Last active December 21, 2015 03:48
Ruby Threading Example
#!/usr/bin/env ruby
#
#
#
@threads = []
6.times do |i|
@threads[i] = Thread.new do
sum = 1 + rand(100)
@FilBot3
FilBot3 / my.cnf
Created November 11, 2013 19:20
2013-11-11 MariaDB my.cnf
# cat /etc/my.cnf.d/server.cnf
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
@FilBot3
FilBot3 / ruby_check_yaml_example_1.rb
Last active February 10, 2016 15:20
Writing and Reading YAML from both Ruby code, and YAML Markup
#!/usr/bin/env ruby
#
#
#
require 'yaml'
require 'fileutils'
def create_config_file
default_options = {
"ruby_dir" => "#{ENV['HOME']}/rubies",
@FilBot3
FilBot3 / ps_delete_older_than_x_days.ps1
Created February 15, 2016 21:53
PowerShell Delete files older than x days
$limit = (Get-Date).AddDays(-2)
$path = "E:\SSP\AttachContent"
# Delete files older than the $limit.
Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
# Delete any empty directories left behind after deleting the old files.
Get-ChildItem -Path $path -Recurse -Force | Where-Object { $_.PSIsContainer -and (Get-ChildItem -Path $_.FullName -Recurse -Force | Where-Object { !$_.PSIsContainer }) -eq $null } | Remove-Item -Force -Recurse