Skip to content

Instantly share code, notes, and snippets.

View derekmurawsky's full-sized avatar

Derek Murawsky derekmurawsky

View GitHub Profile
@Iristyle
Iristyle / gist:1776477
Created February 9, 2012 02:03
CloudInit.NET script for Windows Core 2008 R2 with IIS, .NET 4 and WebDeploy 2.0
#! /powershell/
Set-StrictMode -Version Latest
$log = 'c:\cloudfu.txt'
Add-Content $log -value "Initial Execution Policy: [$(Get-ExecutionPolicy)]"
Set-ExecutionPolicy Unrestricted
Add-Content $log -value "New Execution Policy: [$(Get-ExecutionPolicy)]"
Add-Content $log -value "Path variable [${env:Path}]"
Add-Content $log -value "PSModulePath variable [${env:PSModulePath}]"
#!/usr/bin/env ruby
require 'snmp'
#include SNMP
require 'logger'
require 'sensu-plugin/check/cli'
# Usage: Import specific MIB modules into the snmp gem mib folder
# - : Import specific MIB modules into the snmp gem mib folder
# - : Performs some SNMP Checks
@mcauser
mcauser / gist:5250601
Created March 27, 2013 00:34
SQL Server script for exporting a table to json
--
-- Author: Thiago R. Santos
-- Create date: Aug 3rd 2008
-- Description: Returns the contents of a given table
-- in JavaScript Object Notation.
-- Params:
-- @table_name: the table to execute the query
-- @registries_per_request: equivalent to "select top N * from table"
--
-- replacing N by the actual number
@burnsie7
burnsie7 / tracing_w_nodejs.md
Last active April 8, 2020 13:47
Native Tracing w/ NodeJS

Create service and add dependencies

serverless create --template hello-world
npm init
npm install dd-trace@dev
npm install serverless-plugin-datadog

Install Lambda Forwarder

@macox
macox / data.yaml
Last active June 29, 2021 03:43
OPA exceptions - data driven
dockerfile:
policies:
- name: warn_latest_tag
enabled: true
function _cdk_completer {
STACK_CMDS="list synthesize bootstrap deploy destroy diff metadata init context docs doctor"
if [ "$3" == "cdk" ]; then
COMPREPLY=($(compgen -W "$STACK_CMDS" $2))
elif [[ -d "cdk.out" ]] && ! [[ "$2" == "-"* ]]; then
TEMPLATES=$(ls -1 cdk.out/*.template.json | awk '{split($0,t,/\/|\./); print t[3]}')
COMPREPLY=($(compgen -W "$TEMPLATES" $2))
else
COMPREPLY=()
@casecode
casecode / secure-websockets
Last active April 19, 2023 17:50
Basic Config for SSL with Secure Websockets using Nginx 1.6.0 + Puma + Thin
=========================
# /etc/nginx/nginx.conf
=========================
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
@cdhunt
cdhunt / Get-CredentialFromWindowsCredentialManager.ps1
Last active June 1, 2023 23:48 — forked from toburger/Get-CredentialFromWindowsCredentialManager.ps1
Gets a PowerShell Credential [PSCredential] from the Windows Credential Manager. This only works for Generic Credentials.
<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
This module will return a [PSCredential] object from a credential stored in Windows Credential Manager. The
Get-StoredCredential function can only access Generic Credentials.
Alias: GSC
@danrigsby
danrigsby / packer-ami-id
Last active December 14, 2023 15:07
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@drmalex07
drmalex07 / README-setup-socket-activated-systemd-service.md
Last active December 26, 2023 05:13
An example inetd-like socket-activated service. #systemd #inetd #systemd.socket

README

This is an example of a socket-activated per-connection service (which is usually referred to as inetd-like service). A thorough explanation can be found at http://0pointer.de/blog/projects/inetd.html.

Define a socket unit

The key point here is to specify Accept=yes, which will make the socket accept connections (behaving like inetd) and pass only the resulting connection socket to the service handler.