The program reads a sequence of integers (sorted), and outputs x-y ranges for consecutive integers, outputting it verbatim otherwise.
cat | python ranges.py
1
2
3
7
8
9
^D
| '''A-1''' | |
| alpha2num = lambda s: (ord(char) - ord('A') + 1 for char in s) | |
| '''0-0''' | |
| num2num = lambda s: (ord(num) - ord('0') for num in s) | |
| import itertools | |
| import re | |
| LOOKUP = ('A', 'Z', 'Y', 'X', 'U', 'T', 'S', 'R', 'P', 'M', 'L', 'K', 'J', 'H', 'G', 'E', 'D', 'C', 'B') |
The program reads a sequence of integers (sorted), and outputs x-y ranges for consecutive integers, outputting it verbatim otherwise.
cat | python ranges.py
1
2
3
7
8
9
^D
After running the command, you'll now be in your tmux session, in copy mode, with the contents
echo \-17 | sudo tee /proc/1234/oom_adj
You can then copy this, exit copy mode, paste and execute.
Note: in Ubuntu Raring tmux 1.7-3, copying the line caused a crash.
| let eval_stable n one_step x : lambda * int = | |
| let ctr = new Gen.counter 0 in | |
| let tick () = ctr # inc in | |
| let step = one_step tick in | |
| let rec aux x prev = | |
| let curr = ctr # get in | |
| if prev = curr then | |
| x | |
| else if ctr#get > n then ( | |
| print_endline ("exceeded "^(string_of_int n)^" reductions"); |
| module EvalLibrary = struct | |
| (* Our familiar friend, the pipe operator *) | |
| let ( |> ) (x:'a) (f:'a->'b) : 'b = f x | |
| (* Takes/returns functions that take a expression to be wrapped *) | |
| let bind name expr (fn:string -> string) = | |
| (* (head^"let "^name^" = "^expr^" in ", " end"^tail) *) | |
| fun body -> | |
| fn ((Printf.sprintf "let %s = %s in %s end") name expr body) |
| (* | |
| Instructions: | |
| - copy test_parse_eval.ml into the same directory as lab3.ml (Right-click the | |
| <> to the right of the filename, Save as) | |
| - include the let expression below; feel free to replace the body with your | |
| own tests | |
| *) | |
| let module T = Test_parse_eval.Tester (Calc) (struct let reader = Parser.reader expr2 end) in | |
| let test = T.test in | |
| print_endline "\n= examples ="; |
| <!doctype html> | |
| <html ng-app> | |
| <head> | |
| <meta charset='utf-8'> | |
| <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script> | |
| <script src="script.js"></script> | |
| </head> | |
| <body> | |
| <div ng-controller="Controller"> |
| // Code goes here | |
| angular.module('aModule', []) | |
| .service('quant_alg', function() { | |
| return quant_alg; | |
| }) | |
| .controller('ControllerA', function($scope, quant_alg) { | |
| var qa = quant_alg; | |
| angular.extend($scope, qa); | |
| }) |
| <?php | |
| /* | |
| Plugin Name: Login, Relaxed | |
| Description: Logins to the admin dashboard are always redirected to `siteurl` by default. This plugin relaxes this to allow logins from URLs apart from `siteurl`. This is useful if you are logging in to WordPress from localhost. | |
| Plugin URI: https://gist.github.com/rctay/6219624 | |
| Version: 0.1 | |
| Author: Tay Ray Chuan | |
| */ | |
| function wp_login_loginform_action_blank($url, $path, $orig_scheme=null) |
| # next try: `test` before `export` | |
| val=`tmux show-environment | grep '^SSH_AUTH_SOCK='`;\ | |
| test -n "$val" && export "$val" | |
| # with the $_ bash-ism: | |
| test -n `tmux show-environment | grep '^SSH_AUTH_SOCK='`\ | |
| && export "$_"; |