Skip to content

Instantly share code, notes, and snippets.

View guillaumerose's full-sized avatar

Guillaume Rose guillaumerose

  • Red Hat
  • Paris
View GitHub Profile
@adrianriobo
adrianriobo / multi.sh
Created July 29, 2021 07:25
multipart download script using curl
#!/bin/bash
# Author: Param Aggarwal
# Multipart parallel downloader in Shell using cURL
if [[ $# -lt 1 ]]; then
echo "$0: Pass URL to download as argument"
exit 1
fi
url=$1
@jeanlaurent
jeanlaurent / .slate
Last active October 16, 2017 12:05
Slate config file
# https://github.com/mattr-/slate
#half left - full - half right
bind 1:alt,cmd move screenOriginX;screenOriginY screenSizeX/2;screenSizeY
bind 2:alt,cmd move screenOriginX;screenOriginY screenSizeX;screenSizeY
bind 3:alt,cmd move screenOriginX+screenSizeX/2;screenOriginY screenSizeX/2;screenSizeY
#1/3 left - center - right
bind 4:alt,cmd move screenOriginX;screenOriginY screenSizeX/3;screenSizeY
bind 5:alt,cmd move screenOriginX+screenSizeX/3;screenOriginY screenSizeX/3;screenSizeY
@hillar
hillar / flatten_json.lua
Last active August 29, 2015 14:11
heka :: flatten json before injecting message
require "cjson"
local util = require("util")
-- https://github.com/mozilla-services/lua_sandbox/blob/master/modules/util.lua
local message = {
Type = "IGNORE",
Fields = {}
}
@plentz
plentz / nginx.conf
Last active May 17, 2024 09:08
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@toobulkeh
toobulkeh / performance_data.rb
Last active January 3, 2024 09:08
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:
@vsergeev
vsergeev / beagle_elfs.md
Created April 15, 2012 09:45
Minimalist "Embedded Linux from Scratch" Beaglebone Distribution Build

Busybox "Embedded Linux from Scratch" Distribution for the Beaglebone

Prepare your Build Sandbox

$ mkdir -p beaglelfs/{sources,rootfs_install,boot_mnt,rootfs_mnt}

Acquire an ARM Toolchain

Download the latest i686 Binary TAR of the ARM GNU/Linux (glibc-based) Lite Toolchain:

@elbart
elbart / GuiceResource.java
Created October 18, 2011 20:12
Maven jetty guice jersey example
package com.elbart;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import com.google.inject.servlet.RequestScoped;
@Path("bound/perrequest")
class Numeric
def to_rad
self * Math::PI / 180
end
end
# http://www.movable-type.co.uk/scripts/latlong.html
# loc1 and loc2 are arrays of [latitude, longitude]
def distance loc1, loc2
lat1, lon1 = loc1