This article is now published on my website: Prefer Subshells for Context.
#!/usr/bin/env bash | |
# memusg -- Measure memory usage of processes | |
# Usage: memusg COMMAND [ARGS]... | |
# | |
# Author: Jaeho Shin <[email protected]> | |
# Created: 2010-08-16 | |
############################################################################ | |
# Copyright 2010 Jaeho Shin. # | |
# # | |
# Licensed under the Apache License, Version 2.0 (the "License"); # |
#!/usr/bin/env python | |
import socket | |
import os | |
import struct | |
if getattr(socket, "NETLINK_CONNECTOR", None) is None: | |
socket.NETLINK_CONNECTOR = 11 | |
CN_IDX_PROC = 1 |
/* | |
* To compile objective-c on the command line: | |
* | |
* gcc -framework Foundation objc-gcc.m | |
* | |
* You may have to link with -lobjc or other libs, | |
* as required. | |
*/ | |
#import <Foundation/Foundation.h> |
// Compile with $ gcc -o lmutracker lmu.m -framework IOKit -framework CoreFoundation -framework Foundation | |
// Usage: ./lmu [now] | |
// Prints out the value from the ambient light sensor and the back light LED every 1/10 of a second. Optionally print just one value. | |
// Inspired by the code found at | |
// http://google-mac-qtz-patches.googlecode.com/svn-history/r5/trunk/AmbientLightSensor | |
// and http://osxbook.com/book/bonus/chapter10/light/ | |
// and http://en.wikipedia.org/wiki/Wikipedia:Reference_desk/Archives/Computing/2010_February_10#Mac_OS_X_keyboard_backlight_drivers | |
// http://forums.macrumors.com/showthread.php?t=1133446 | |
#include <stdio.h> |
openssl s_client -crlf -connect imap.gmail.com:993 | |
tag login [email protected] passwordhere | |
tag list "" "*" | |
tag select "inbox" | |
tag fetch 1:3 body[header] | |
tag fetch 3 body[header] | |
tag fetch 3 body[text] | |
tag fetch 2 all | |
tag fetch 2 fast | |
tag fetch 2 full |
## The MIT License (MIT) | |
## --------------------- | |
## | |
## Copyright (C) 2014 Nicco Kunzmann | |
## | |
## https://gist.github.com/niccokunzmann/6038331 | |
## | |
## Permission is hereby granted, free of charge, to any person obtaining | |
## a copy of this software and associated documentation files (the "Software"), |
I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.
This isn't practical for larger texts, like when I want to copy the whole contents of a file.
If I had been editing large-file.txt
locally, I could easily copy its contents by using the pbcopy
command:
import collections | |
import threading | |
__author__ = 'ashw7n' | |
import socket | |
import json | |
import logging | |
logging.basicConfig(level=logging.DEBUG) |
On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this
object, and we've seen some awesome benefits from doing such.
Up until recently, a typical unit test for us looked something like this:
describe('views.Card', function() {