Skip to content

Instantly share code, notes, and snippets.

View nweddle's full-sized avatar
:octocat:

Nathan Weddle nweddle

:octocat:
View GitHub Profile
#--------------------
#
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
#
@maxnasonov
maxnasonov / Proxy.ps1
Last active December 13, 2016 22:15 — forked from p0w3rsh3ll/Proxy.ps1
# Define a proxy
Configuration Proxy {
$whitelist = '*.google.com;*.example.com;192.168.*;127.*;localhost'
$prefix_hex = [String]::Format("{0:X}", [Convert]::ToUint32($prefix.tochararray()[0]))
$suffix_hex = [String]::Format("{0:X}", [Convert]::ToUint32($suffix.tochararray()[0]))
$proxy_url = "proxy.example.com:3128"
$proxy_url_length = '{0:X}' -f $proxy_url.length
$proxy_url_hex = StringToHex -string $proxy_url
$whitelist_hex = StringToHex -string $whitelist
$whitelist_length = '{0:X}' -f $whitelist.length
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@rf-
rf- / nvim-client
Last active December 9, 2024 06:07
#!/usr/bin/env python
import pynvim, os, re, sys, time
# Get a list of buffers that haven't been deleted. `nvim.buffers` includes
# buffers that have had `:bdelete` called on them and aren't in the buffer
# list, so we have to filter those out.
def get_listed_buffers(nvim):
return set(buf.number for buf in nvim.buffers \
if nvim.eval('buflisted(%d)' % buf.number))
@dougireton
dougireton / knife.rb
Last active November 4, 2018 02:41
Flexible knife.rb to support switching between multiple Chef orgs - ~/.chef/knife.rb
# Copyright 2015 Nordstrom, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@scarolan
scarolan / gist:f93a8f9b362c4d3a4436
Last active November 20, 2015 19:27
Set the tab name in iTerm to contain the current directory and git branch
function set_iterm_title {
echo -ne "\e]1;$1\a"
}
function git_branch {
BRANCH_REFS=$(git symbolic-ref HEAD 2>/dev/null) || return
GIT_BRANCH="${BRANCH_REFS#refs/heads/}"
[ -n "$GIT_BRANCH" ] && echo "$GIT_BRANCH "
}

Creating a Custom Cookbook Generator

There are a few resources on the internet today about creating custom cookbook generators. The most popular is chef-gen-flavors.

These resources are generally pretty meta and slightly hard to understand, so I'm going to walk you through customizing a cookbook generator from the ground up. To do this we're going to start with a great generator called pan. After we customize the generators we're going to build the gem and install it locally.

One thing to know about chef-gen-flavors is that its heavily name based, so where-ever you see Pan and I'm replacing it with awesomesauce, you can replace with whatever the name of your flavor is, but it must be replaced in all of the same places.

Clone the repo

@alexpop
alexpop / kitchen_sink.rb
Last active March 16, 2017 10:04
Script to export Chef Server nodes and add them to Chef Compliance
# encoding: utf-8
### Sample script to export Chef Server nodes and import them to Chef Compliance
### Change the 'api_url', 'api_user', 'api_pass' and 'api_org' variables below
### Change the nodes_array json suit your environment
### Go to your chef-repo and check Chef Server access first
# cd chef-repo; knife environment list
### Save this Ruby script as kitchen_sink.rb and run it like this:
# cat kitchen_sink.rb | knife exec
### Chef Compliance API docs: https://docs.chef.io/api_compliance.html
@lmarkus
lmarkus / README.MD
Last active November 27, 2025 15:56
Extracting / Exporting custom emoji from Slack

Extracting Emoji From Slack!

Slack doesn't provide an easy way to extract custom emoji from a team. (Especially teams with thousands of custom emoji) This Gist walks you through a relatively simple approach to get your emoji out.

If you're an admin of your own team, you can get the list of emoji directly using this API: https://api.slack.com/methods/emoji.list. Once you have it, skip to Step 3

HOWEVER! This gist is intended for people who don't have admin access, nor access tokens for using that list.

Follow along...

@Hexalon
Hexalon / Install-WMF5.ps1
Last active June 21, 2017 12:36
Automates installation of Windows Management Framework 5
#Requires -Version 4.0
[CmdletBinding()]
Param(
[switch]$OnlineInstall = $false
)
<#
.NOTES