Skip to content

Instantly share code, notes, and snippets.

def send_log_to_datadog(data, dd_api_token, ingestion_endpoint=LOG_INGESTION_ENDPOINT):
try:
req = requests.request(
"POST",
"https://{url}/v1/input".format(url=ingestion_endpoint),
headers={"Content-Type": "application/json", "DD-API-KEY": dd_api_token},
json=data,
)
req.raise_for_status()
except requests.exceptions.HTTPError as err:
@xen0l
xen0l / Vagrantfile
Last active September 21, 2017 12:27
Vagrantfile for Ansible workshop at Barcelona SDN meetup
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version('>= 2.0')
unless Vagrant.has_plugin?('vagrant-vyos')
system('vagrant plugin install vagrant-vyos') || exit!
exit system('vagrant', *ARGV)
end
Vagrant.configure("2") do |config|
diff --git a/components/developer/jenkins/files/jenkins-standalone.xml b/components/developer/jenkins/files/jenkins-standalone.xml
index 1cda73652..1bcdb93b1 100644
--- a/components/developer/jenkins/files/jenkins-standalone.xml
+++ b/components/developer/jenkins/files/jenkins-standalone.xml
@@ -58,7 +58,7 @@
both for JAVA and the JAR itself... Or keep it simple? -->
<exec_method type='method'
name='start'
- exec='/usr/bin/java -DsessionTimeout=1440 -jar %{jenkins_war_file} --httpPort=%{httpPort}'
+ exec='/usr/bin/java -DsessionTimeout=1440 -jar %{httpd/jenkins_war_file} --httpPort=%{httpd/httpPort}'
#!/usr/bin/env bash
# Colors
NOCOLOR='\e[0m'
BLACK='\e[0;30m'
RED='\e[0;31m'
GREEN='\e[0;32m'
YELLOW='\e[0;33m'
BLUE='\e[0;34m'
PURPLE='\e[0;35m'
https://gist.github.com/f60a78d4f85675b95f6efb4ab8994d0a
@xen0l
xen0l / gist:2792654274bc57470cb1b4217eaf76d9
Last active October 19, 2016 19:16
epoll on illumos vs linux (python example)
Linux:
Python 3.5.1 (default, Mar 3 2016, 09:29:07)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import select
>>> os.uname()
posix.uname_result(sysname='Linux', nodename='archlinux.vagrant.vm', release='4.5.0-1-ARCH', version='#1 SMP PREEMPT Tue Mar 15 09:41:03 CET 2016', machine='x86_64')
>>> select.epoll(select.EPOLL_CLOEXEC).close()
@xen0l
xen0l / ipf.conf
Created October 14, 2016 09:17
Sample ipf.conf
# This file is managed by Ansible. Any manual changes will be overwritten!
#
# ipf.conf
#
# IP Filter rules to be loaded during startup
#
# See ipf(4) manpage for more information on
# IP Filter rules syntax.
# Do not filter loopback
# dark colors
$colors[0][0] = "5299AD"; # blue1
$colors[0][1] = "5D549A"; # violet
$colors[0][2] = "87B457"; # green
$colors[0][3] = "CF545E"; # red
$colors[0][4] = "CDDA13"; # lemon
$colors[0][5] = "5DAE99"; # turquise
$colors[0][6] = "DD844C"; # orange
$colors[0][7] = "AE5C8A"; # mauve
$colors[0][8] = "BD9F83"; # ltbrown
@xen0l
xen0l / hosts.cfg
Created September 27, 2016 12:09
How to use zone connection with Ansible and OpenIndiana
# If you want to run this as a non-root user, assign "Zone Management" RBAC profile to non-root account.
root@openindiana:/root/ansible# ansible www -m ping
www | SUCCESS => {
"changed": false,
"ping": "pong"
}
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'