Skip to content

Instantly share code, notes, and snippets.

View macbre's full-sized avatar
🏠
Working from home

Maciej Brencz macbre

🏠
Working from home
View GitHub Profile

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

@macbre
macbre / perfcap.js
Last active August 29, 2015 14:07 — forked from gleicon/perfcap.js
var page = require('webpage').create(),
MSG_SCREENSHOT = '123screenshot123';
page.onConsoleMessage = function(msg) {
if (msg === MSG_SCREENSHOT) {
page.render('screenshot.png');
phantom.exit()
}
console.log('INFO: ' + msg);
};
require "rspec/core/formatters/base_text_formatter"
require 'headless'
require 'fileutils'
class AcceptanceVideoFormatter < RSpec::Core::Formatters::BaseTextFormatter
def initialize(output)
@headless = Headless.new(
video: {
nomouse: true,
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run
import gdata.sites.client
import gdata.sites.data
# How to use the OAuth 2.0 client is described here:
# https://developers.google.com/api-client-library/python/guide/aaa_oauth
SCOPE = 'https://sites.google.com/feeds/'
@macbre
macbre / _service.md
Created August 5, 2016 17:13 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
# php7-fpm - The PHP FastCGI Process Manager
# Original script by Ondřej Surý. Adapted to php7-fpm by @bjornjohansen
description "The PHP FastCGI Process Manager"
author "Ondřej Surý <[email protected]>"
start on runlevel [2345]
stop on runlevel [016]
# Precise upstart does not support reload signal, and thus rejects the
src/searchdha.cpp | 3 +++
src/sphinx.cpp | 4 ++--
src/sphinxstd.cpp | 2 ++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/searchdha.cpp b/src/searchdha.cpp
index 27bc01e..2af933d 100644
--- a/src/searchdha.cpp
+++ b/src/searchdha.cpp
@@ -21,6 +21,9 @@
@macbre
macbre / tcpdump.txt
Created October 26, 2017 18:42 — forked from gstark/tcpdump.txt
Use tcpdump to monitor mysql
Use tcpdump to monitor mysql
# Capture the packets
sudo tcpdump -i eth0 port 3306 -s 65535 -x -n -q -tttt > tcpdump.out
# analyze all the requests from a given host
pt-query-digest --type=tcpdump --filter '($event->{host} || $event->{ip} || "") =~ m/192.168.248.64/' tcpdump.out
@macbre
macbre / gist:f52aa0c19d8b046b278584a88585bb0d
Created November 25, 2017 19:04 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@macbre
macbre / slack_nagios.sh
Last active March 23, 2018 10:43 — forked from matt448/slack_nagios.sh
Script to post Nagios notifications into a Slack channel // SUS-4340
#!/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: