Skip to content

Instantly share code, notes, and snippets.

View xtha's full-sized avatar
💭
k8s,openstack

zsh xtha

💭
k8s,openstack
  • China
  • 14:58 (UTC +08:00)
View GitHub Profile
@lalyos
lalyos / README.md
Last active February 28, 2023 03:38
proxy docker /var/run/docker.sock to port 2375 with socat

The new Docker daemon uses port: 2376 with TLS enable by default. Sometimes I want to play with curl on the old plain http port 2375. The trick is: use socat in a container to proxy the unix socket to a real port.

docker run -d \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --name docker-http \
  deb socat -d -d TCP-L:2375,fork UNIX:/var/run/docker.sock
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@lyoshenka
lyoshenka / ssl_oneline.sh
Created June 23, 2014 13:31
One-liner to create a self-signed SSL cert
#!/bin/bash
# http://stackoverflow.com/questions/10175812/how-to-build-a-self-signed-certificate-with-openssl
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 10000
# if you don't want a password for your cert
openssl genrsa -out key.pem 4096 && openssl req -x509 -new -nodes -key key.pem -out cert.pem -days 10000 -subj "/CN=DOMAIN"
@KonradIT
KonradIT / goproled.md
Last active October 19, 2017 16:25
DIY GoPro LED Indicator

When you are up there, ready to fly, you need to make sure your gopro is turned on, and recording. So you hope your GoPro is turned on and recording, you jump and fly... Then when you arrive, you press the shutter button to stop the gopro, but you dont hear anything. The story has just began.

###Parts

@DavidWittman
DavidWittman / mongo-ansible.py
Last active April 18, 2023 18:16
MongoDB-backed dynamic inventory script for Ansible
#!/usr/bin/env python
#
# MongoDB-backed dynamic inventory script for Ansible
# http://docs.ansible.com/intro_dynamic_inventory.html
import os
from argparse import ArgumentParser
import pymongo
@rjsalts
rjsalts / discover_checkmk.yml
Created January 16, 2014 00:38
Ansible playbook to discover all the hosts which have the check_mk agent setup.
- hosts: all
vars:
- monitoring_agent : "nrpe_server"
tasks:
- name: test check_mk
local_action: wait_for port=6556 timeout=2 host={{inventory_hostname}}
register: check_mk
ignore_errors: True
- name: set fact
set_fact: monitoring_agent="check_mk_agent"
@ipmb
ipmb / schedule.sls
Created December 17, 2013 18:05
Sample schedule pillar for Salmon
{% set minutes = 5 %}
{% set returner = "salmon_return" %}
schedule:
# all servers no args
{% for func in ['ps.physical_memory_usage', 'ps.virtual_memory_usage', 'ps.disk_io_counters', 'ps.network_io_counters'] %}
stat{{ loop.revindex }}:
function: {{ func }}
minutes: {{ minutes }}
returner: {{ returner }}
@cemerson
cemerson / chrome.reg
Created October 3, 2013 17:33
Chrome Default Browser Registry keys
; REPLACE USERNAME w/your username
; ============ for Chrome Browser
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\http\shell\open\command]
@="\"C:\\Users\\USERNAME\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe\" -- \"%1\""
[HKEY_CURRENT_USER\Software\Classes\https\shell\open\command]
@="\"C:\\Users\\USERNAME\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe\" -- \"%1\""
@gordonm
gordonm / gist:2896872
Created June 8, 2012 16:59
Salt state example
include:
- yum.omd
mon-required-pkgs:
pkg.installed:
- names:
- omd-0.54
- mod_ssl
- check_mk-agent-mon
- require:
@SEJeff
SEJeff / check_salt.py
Created March 27, 2012 04:08
nagios check to make sure the salt minion is available and responding to commands from @bastichelaar
#!/usr/bin/env python
import salt.cli.caller
import salt.config
import argparse
import sys
parser = argparse.ArgumentParser(description='Check if minions are online.')
parser.add_argument('hostname', help='The name of the minion to be checked')
args = parser.parse_args()