- L1 cache reference
0.5 ns
- Branch mispredict
5 ns
(on a bad CPU architecture you're pretty much screwed) - L2 cache reference
7 ns
- Mutex lock/unlock
25 ns
- Main memory reference
100 ns
- Compress 1K bytes with Zippy
3,000 ns
- Send 2K bytes over 1 Gbps network
20,000 ns
- Read 1 MB sequentially from memory
250,000 ns
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
#source : http://superuser.com/a/620051 | |
#!/usr/bin/env bash | |
## Print header | |
echo -e "Size\tResid.\tShared\tData\t%" | |
while [ 1 ]; do | |
## Get the PID of the process name given as argument 1 | |
pidno=`pgrep $1` | |
## If the process is running, print the memory usage | |
if [ -e /proc/$pidno/statm ]; then |
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
<?xml version='1.0' encoding='UTF-8'?> | |
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0"> | |
<rootfiles> | |
<rootfile media-type="application/oebps-package+xml" full-path="content.opf"/> | |
</rootfiles> | |
</container> |
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
/* From some a gist by someone */ | |
function next_tab_by_title(title_re) { | |
var tabContainer = window.getBrowser().tabContainer; | |
var tabs = tabContainer.childNodes; | |
var numTabs = tabs.length; | |
var startIndex = tabContainer.selectedIndex; | |
var testIndex; | |
for (i = 0; i < numTabs - 1; i++) { | |
testIndex = (startIndex + i + 1) % numTabs; |
I hereby claim:
- I am navtej on github.
- I am nsbuttar (https://keybase.io/nsbuttar) on keybase.
- I have a public key ASDzGy9U324k2ryf5KqeY5n6gIIrX7SNPMDPbDqsWeYKyQo
To claim this, I am signing this object:
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 bash | |
ENV_PATH="$(dirname "$(dirname "$(which pip)")")" | |
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)" | |
BAD_ENV_PATHS="/usr/local" | |
echo "Ensure the root of the broken virtualenv:" | |
echo " $ENV_PATH" |
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
// pieced together from various online sources. Meat of the logic in fn convertFile came from SO answer. | |
// the script moves the original pdf to trash after conversion. You might want to change that. | |
function getFilesList(folder, filetype) { | |
var allfiles = new Array(); | |
const files = folder.getFilesByType(filetype); | |
while (files.hasNext()) { | |
var file = files.next(); | |
allfiles.push(file); | |
} |