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 / 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 / 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. ---"
@petericebear
petericebear / swapon recipe for forge.laravel.com
Created April 18, 2016 19:02
Adds a permanent 4gb swapfile
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
@petericebear
petericebear / pivot-generator.php
Created March 16, 2016 09:25 — forked from laracasts/pivot-generator.php
Artisan Pivot Migration Generator
<?php
namespace App\Console\Commands;
use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class PivotMigrationMakeCommand extends GeneratorCommand
{