Skip to content

Instantly share code, notes, and snippets.

View synsa's full-sized avatar

Steve Lang synsa

View GitHub Profile
@synsa
synsa / .chunkwmrc
Created July 27, 2018 06:22 — forked from mickaelperrin/.chunkwmrc
chunkwm configuration
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir ~/.chunkwm_plugins
#
@synsa
synsa / slack_notify.rake
Created July 27, 2018 18:48 — forked from davestevens/slack_notify.rake
Capistrano Slack integration.
# Capistrano Task that hooks into `deploy:finished` to send a message to Slack
#
# 1. Setup a Slack Incoming Webhook Integration (https://api.slack.com/incoming-webhooks)
# 2. Put the Webhook URL in an Environment variable (SLACK_WEBHOOK_URL)
# 3. Place this file in `lib/capistrano/tasks`
#
# This will then create a new message in the channel on deployment, including who, what and where information
require "net/http"
require "json"
@synsa
synsa / myweechat.md
Created July 31, 2018 01:46 — forked from autoferrit/myweechat.md
My always up-to-date WeeChat configuration (weechat-dev)

WeeChat Screenshot

Enable mouse support

/mouse enable

Encrypted password in sec.conf

@synsa
synsa / PostMessageToSlackChannel.php
Created August 1, 2018 02:02 — forked from nadar/PostMessageToSlackChannel.php
Post a message to a slack channel with PHP
<?php
/**
* Send a Message to a Slack Channel.
*
* In order to get the API Token visit: https://api.slack.com/custom-integrations/legacy-tokens
* The token will look something like this `xoxo-2100000415-0000000000-0000000000-ab1ab1`.
*
* @param string $message The message to post into a channel.
* @param string $channel The name of the channel prefixed with #, example #foobar
@synsa
synsa / slackpost
Created August 1, 2018 03:27 — forked from dopiaza/slackpost
Post a message to a Slack channel
#!/bin/bash
# Usage: slackpost <token> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=PUT_YOUR_HOST_HERE
token=$1
@synsa
synsa / slack.php
Created August 1, 2018 03:37 — forked from stefanzweifel/slack.php
Slack.com Webhook Integration (PHP) - Simple snippet which tells you, how to build your payload array.
<?php
//Options
$token = 'YOUR_TOKEN_HERE';
$domain = 'YOUR_SLACK_DOMAIN_GOES_HERE';
$channel = '#general';
$bot_name = 'Webhook';
$icon = ':alien:';
$message = 'Your message';
#!/bin/bash
set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
usage(){
local name=$(basename "$0")
@synsa
synsa / grep-postfix-message-ids-osx.sh
Created August 2, 2018 19:01 — forked from kennethkalmer/grep-postfix-message-ids-osx.sh
Grep for a pattern through a Postfix mail log, collect the message ids into a temporary file and then grep for all occurrences of the ID's in the maillog.
#!/bin/sh
# OSX friendly version by jeff donovan
#
# Grep for a pattern through a Postfix mail log, collect the message ids into a temporary
# file and then grep for all occurrences of the ID's in the maillog.
# This is a very intensive operation since it requires 1+N greps through the entire log file,
# where N is the number of unique ID's returned from the first grep.
#
# Usage sample:
@synsa
synsa / slack_nagios.sh
Created August 3, 2018 23:05 — forked from matt448/slack_nagios.sh
Script to post Nagios notifications into a Slack channel
#!/bin/bash
# This script is used by Nagios to post alerts into a Slack channel
# using the Incoming WebHooks integration. Create the channel, botname
# and integration first and then add this notification script in your
# Nagios configuration.
#
# All variables that start with NAGIOS_ are provided by Nagios as
# environment variables when an notification is generated.
# A list of the env variables is available here:
@synsa
synsa / gist:7b6a0dfd8cc13c60ee59df5771710fd4
Created August 20, 2018 17:20 — forked from jjarmoc/gist:1571540
Quoted Printable encode/decode bash aliases - suitable for pipelining
# To decode:
# qp -d string
# To encode:
# qp string
alias qpd='perl -MMIME::QuotedPrint -pe '\''$_=MIME::QuotedPrint::decode($_);'\'''
alias qpe='perl -MMIME::QuotedPrint -pe '\''$_=MIME::QuotedPrint::encode($_);'\'''
function qp {
if [[ "$1" = "-d" ]]
then