This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Example ruby client of winlist-server. | |
HOST = '172.22.22.1' | |
PORT = 4015 | |
require 'socket' | |
require 'timeout' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name PhabricatorGerritLink | |
// @namespace http://localhost | |
// @description Make Gerrit's "Change-Id" clickable from Phabricator Diffusion | |
// @include http://phabricator.localdomain/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
var elements = document.getElementsByTagName('p'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original Author: David Morrow | |
# https://github.com/dperrymorrow/callbacks.js | |
# MIT license | |
# | |
# Modified: | |
# - Rename method names. For example, remove `Callback` | |
# - Fix `remove` | |
# - Remove `instance`, change `method` from string to real method | |
# - Callbacks.add = Callbacks.get().add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# For Linux only | |
# Limit: 2.5G, change it if needed | |
GIGA = 1024 ** 3 | |
MEMORY_LIMIT = GIGA * 5 / 2 | |
CG_DIR = "/sys/fs/cgroup/memory/lm.#{MEMORY_LIMIT}" | |
if ARGV.any?{|s|s.start_with? '-h'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# quick egress traffic limit for linux | |
# Usage: $0 dev kbps | |
MIN_RATE = 512 | |
devs = [] | |
rate = 0 | |
dev_names = Dir['/sys/devices/**/net/*'].map{|x|File.basename(x)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'thread_safe' | |
require 'resolv' | |
exit 1 if Process.uid != 0 | |
SERVERS = %w[ | |
site-g1.example.com | |
site-g2.example.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Python.h> | |
#include <libiptc/libiptc.h> | |
#include <xtables.h> | |
#include <stdio.h> | |
#include <netdb.h> | |
#include <string.h> | |
#define buffer_printf(...) {\ | |
char temp_buf[1024];\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### functions | |
f() { echo "Failed."; exit; } | |
check_packages() | |
{ | |
hash linux || apt-get install user-mode-linux || f | |
hash debootstrap || apt-get install debootstrap || f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Find git root | |
while !File.exists?('.git/config') | |
Dir.chdir('..') | |
raise 'git root not found' if Dir.pwd == '/' | |
end | |
args = ARGV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
copy () { | |
cat "$@" 2> /dev/null | xsel -b | |
local _path | |
for _path in "$@" | |
do | |
if [ "${_path[1]}" = '/' ] | |
then | |
echo "${_path}" | |
else | |
echo "${PWD}/${_path}" |
OlderNewer