Skip to content

Instantly share code, notes, and snippets.

@markgoodyear
markgoodyear / 01-gulpfile.js
Last active May 5, 2023 03:21
Comparison between gulp and Grunt. See http://markgoodyear.com/2014/01/getting-started-with-gulp/ for a write-up.
/*!
* gulp
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev
*/
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
@t-yuki
t-yuki / 1_2_export_redmine_wiki.bash
Last active April 2, 2019 05:25
1. a script to grab redmine wiki pages in markdown format and convert to standard markdown link format. 2. Makefile to convert markdown to sphinx reST.
#!/bin/bash
#
if [ -z "$APIKEY" ]; then
echo "API Key for Redmine is required."
exit 1
fi
mkdir -p doc/specs
cd doc/specs
@dopiaza
dopiaza / slackpost
Created September 5, 2013 12:33
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
@deepesh-agarwal
deepesh-agarwal / net_priority.sh
Last active February 10, 2022 15:57
Linux Traffic Prioritization Script
#!/bin/bash
# Personal note : add rules to /etc/rc.local file so they will be loaded after booting up
# Change modemif to your network interface value
modemif=eth0
iptables -t mangle -N ack
iptables -t mangle -A ack -m tos ! --tos Normal-Service -j RETURN
iptables -t mangle -A ack -p tcp -m length --length 0:128 -j TOS --set-tos Minimize-Delay
iptables -t mangle -A ack -p tcp -m length --length 128: -j TOS --set-tos Maximize-Throughput
@ysugimoto
ysugimoto / filewatch.sh
Created October 9, 2012 10:38
inotifywait file watching handler
#!/bin/sh
# kill already process
PROC=`pgrep -f inotifywait`
if [ -n "${PROC}" ]; then
echo $PROC | xargs kill
fi
/usr/bin/inotifywait -e create,modify -mrq /home/my.file | while read line; do
path=`echo $line | /bin/awk '{print $1$3}'`
@yanunon
yanunon / 6bridge
Created October 7, 2012 04:42
Openwrt config file for TP-Link WR703N
#file /etc/init.d/6bridge
#!/bin/sh /etc/rc.common
START=46
STOP=46
start_service() {
local section="$1"
. /lib/functions/network.sh
# http://wiki.openwrt.org/doc/devel/packages
include $(TOPDIR)/rules.mk
# PKG_NAME -The name of the package, as seen via menuconfig and ipkg
PKG_NAME:=bridge
# PKG_VERSION -The upstream version number that we're downloading
PKG_VERSION:=1.0.6
# PKG_RELEASE -The version of this package Makefile
PKG_RELEASE:=1
@mdodsworth
mdodsworth / gist:3490042
Created August 27, 2012 16:23
node: multicast example
var dgram = require('dgram');
var socket = dgram.createSocket('udp4');
var testMessage = "[hello world] pid: " + process.pid;
var multicastAddress = '239.1.2.3';
var multicastPort = 5554;
socket.bind(multicastPort, '0.0.0.0');
socket.addMembership(multicastAddress);
@mwcz
mwcz / watchrun.sh
Last active May 28, 2016 06:42
watchrun script for running a command when any file in the current dir tree changes
#!/bin/sh
# USAGE: ./watchrun.sh COMMAND
# New credit to: http://exyr.org/2011/inotify-run/
# this script will wait for changes in the current directory tree, and when one occurs, it will run COMMAND, then resume waiting
# requires inotify-tools:
# sudo apt-get install inotify-tools
# or: