Skip to content

Instantly share code, notes, and snippets.

View petericebear's full-sized avatar
🎯
Focusing on ElasticSearch and Laravel

Peter Steenbergen petericebear

🎯
Focusing on ElasticSearch and Laravel
View GitHub Profile
@petericebear
petericebear / sh
Created June 3, 2020 12:22 — forked from lobermann/sh
Install wkhtmltopdf on headless ubuntu 18 vps
wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
apt-get install fontconfig libxrender1 xfonts-75dpi xfonts-base
dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
@petericebear
petericebear / vsphere_vm_disk_iops.rb
Created September 11, 2018 08:54
vspere_vm_disk_iops.rb
require 'chef/knife'
require 'chef/knife/base_vsphere_command'
# Set specific disk IOPS for an aattached disk to the VM
# VsphereVmdisklist extends the BaseVspherecommand
class Chef::Knife::VsphereVmDiskIops < Chef::Knife::BaseVsphereCommand
banner 'knife vsphere vm disk iops VMNAME DISKINDEX IOPS'
common_options
@petericebear
petericebear / vsphere_vm_disk_remove.rb
Created September 10, 2018 12:27
vsphere_vm_disk_remove.rb
require 'chef/knife'
require 'chef/knife/base_vsphere_command'
# Remove specific disk attached to a VM
# VsphereVmdisklist extends the BaseVspherecommand
class Chef::Knife::VsphereVmDiskRemove < Chef::Knife::BaseVsphereCommand
banner 'knife vsphere vm disk remove VMNAME DISKINDEX'
common_options
@petericebear
petericebear / logstash-bikehare-status.conf
Created June 25, 2018 15:40 — forked from derickson/logstash-bikehare-status.conf
Logstash config for http_poller pulling of DC Capital bikeshare data and doing an XML split of the contents.
## Example of pulling data from DC Capital bikeshare to Elasticsearch in real time
## HTTP Poller -> XML Splitting -> Elasticsearch
input {
## pull data from Capital Bikeshare every 60 seconds
http_poller {
urls => {
bikeshare_dc => "https://www.capitalbikeshare.com/data/stations/bikeStations.xml"
}
request_timeout => 30
@petericebear
petericebear / performance_data.rb
Created August 17, 2017 09:07 — forked from toobulkeh/performance_data.rb
rbvmomi performance manager usage
vim = RbVmomi::VIM.connect host: vcenter.hostname, user: vcenter.username, password: vcenter.password, insecure: true
pm = vim.serviceInstance.content.perfManager
# this is for a single cluster with hosts directly in one cluster. 'first' returns the cluster object.
hosts = vim.serviceInstance.find_datacenter.hostFolder.children.first.host
pm.retrieve_stats([hosts[0]], ['cpu.usagemhz'], {interval: '300', start_time: (Time.now - 6.hours)}).first[1][:metrics]['cpu.usagemhz']
# This above query queries for the 'cpu.usagemhz' counter, which by default matches the (none) rollup counter (NOT THE AVERAGE) in vSphere API.
# This is a problem with the RbVmomi gem helper function "retrieve_stats" only. To override this, use the following manual counter selection:
@petericebear
petericebear / html5url.rb
Created April 14, 2017 12:24 — forked from bthornto/html5url.rb
html5 console connection to a vcenter guest
require 'rbvmomi'
require 'pry-byebug'
require 'socket'
require 'openssl'
require 'digest/sha1'
require 'io/console'
def get_thumbprint(vc)
ssl_context = OpenSSL::SSL::SSLContext.new
tcp_client = TCPSocket.new vc, 443
@petericebear
petericebear / laravel-mollie-access-token-from-refresh.php
Last active January 26, 2017 07:18
laravel-mollie get access token from refresh token
<?php
public function getRefreshTokenResponse($code)
{
$response = $this->getHttpClient()->post($this->getTokenUrl(), [
'headers' => ['Accept' => 'application/json'],
'form_params' => $this->getRefreshTokenFields($code),
]);
return json_decode($response->getBody(), true);
}
@petericebear
petericebear / update-ansible-devel.sh
Created January 19, 2017 12:49
Update Ansible to devel while using Homebrew
cd /usr/local/Cellar/ansible/ && git clone https://github.com/ansible/ansible.git --recursive devel
cd /usr/local/Cellar/ansible/devel && git submodule update --init --recursive
sudo make install
source hacking/env-setup
brew switch ansible devel
brew link --overwrite ansible
@petericebear
petericebear / after.sh
Created May 29, 2016 14:01 — forked from cluppi/after.sh
Turning SSL on for Homestead
#!/bin/sh
# Config for SSL.
echo "--- Making SSL Directory ---"
mkdir /etc/nginx/ssl
echo "--- Copying $i SSL crt and key ---"
openssl req -nodes -new -x509 -keyout /etc/nginx/ssl/server.key -out /etc/nginx/ssl/server.crt -subj "/C=US/ST=NY/L=NYC/O=Dis/CN=www.example.com"
echo "--- Turning SSL on in nginx.conf. ---"