start new:
tmux
start new with session name:
tmux new -s myname
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| #!/usr/local/bin/perl | |
| ### check_tap.pl | |
| # By Nathan Vonnahme, n8v at users dot sourceforge dot net, June 2 2011 | |
| # Allows Nagios to check the output of anything that emits Test Anything | |
| # Protocol. | |
| # See http://en.wikipedia.org/wiki/Test_Anything_Protocol |
| # | |
| # Wide-open CORS config for nginx | |
| # | |
| location / { | |
| if ($request_method = 'OPTIONS') { | |
| add_header 'Access-Control-Allow-Origin' '*'; | |
| # |
| #!/bin/bash | |
| # | |
| # Report time to first byte for the provided URL using a cache buster to ensure | |
| # that we're measuring full cold-cache performance | |
| while (($#)); do | |
| echo $1 | |
| curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \ | |
| -w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \ | |
| "$1?`date +%s`" |
| #!/bin/sh | |
| set -e | |
| if [ -z "$1" ]; then | |
| ruby-build --definitions | |
| exit 1 | |
| fi | |
| if [ -z "$2" ]; then | |
| rev=1 |
| # Do a bunch of shit that should only happen at initial setup | |
| # file: cookbooks/foo/recipes/bootstrap.rb | |
| # initial runlist role[foo],recipe[foo::bootstrap] | |
| # useful for downloading an initial codebase of an application | |
| # as opposed to attempting to reinstall each time | |
| ruby_block "remove_bootstrap_recipe" do | |
| block do | |
| Chef::Log.info("Removing foo boostrap from runlist") | |
| node.run_list.remove("recipe[foo::bootstrap]") if node.run_list.include?("recipe[foo::bootstrap]") |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| #!/usr/bin/env python | |
| """ Sends Jenkins build duration statistics to Graphite. """ | |
| import requests | |
| import json | |
| from graphite import Graphite # This is our closed-source library but you get the idea. | |
| JENKINS_URL='http://jenkins' | |
| GRAPHITE_HOST='10.x.x.x' | |
| GRAPHITE_PREFIX='jenkins.main.build_time.' |
These are only examples, for a few very common actions. You are expected to write your own rules for the rest. The syntax is regular JavaScript, but see the polkit(8) manpage for the object structure and available API. These examples are for polkit versions 106 and later, with the JS interpreter. They won't work with Debian's polkit v105.
If you don't know the action name, either run pkaction and look for anything similar:
pkaction | grep cups
...or try to perform the actual action, cancel it, then look in your system logs:
journalctl -t polkitd -n 10 | grep action