As websites become more JavaScript heavy, it's harder to automate things like screenshotting for archival purposes. I've seen examples and suggestions to use PhantomJS for visual testing/archiving of websites, but have run into issues such as the non-rendering of webfonts. I've never tried out Selenium until today...and while I'm not thinking about performance implications yet, Selenium seems far more accurate than PhantomJS...which makes sense since it actually opens a real browser. And it's not too hard to script to do complex interactions: here's an [example of how to log in to Twitter, write a tweet, upload an image, and send a tweet via Selenium and DOM element selection](https://gist.github.com/dannguyen/8a6fa49253c1d6a0eb92
""" | |
Test performance of these counting methods: | |
- count_if_else: Set to 1 if not yet seen and increment otherwise | |
- count_if: Set to 0 if not yet seen, then increment regardless of containment | |
- count_exception: Attempt to increment and set to 1 if KeyError caught | |
- count_setdefault: Set default value to 0, then increment | |
- count_fromkeys: Create dict with necessary keys set to 0, then increment each | |
- count_set_and_comprehension: Create dict of items and counts using a set | |
- count_defaultdict: Increment count, automatically setting unseen values to 0 |
At DICOM Grid, we recently made the decision to use Haskell for some of our newer projects, mostly small, independent web services. This isn't the first time I've had the opportunity to use Haskell at work - I had previously used Haskell to write tools to automate some processes like generation of documentation for TypeScript code - but this is the first time we will be deploying Haskell code into production.
Over the past few months, I have been working on two Haskell services:
- A reimplementation of an existing socket.io service, previously written for NodeJS using TypeScript.
- A new service, which would interact with third-party components using standard data formats from the medical industry.
I will write here mostly about the first project, since it is a self-contained project which provides a good example of the power of Haskell. Moreover, the proces
I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).
In Vim I have key bindings C-h/j/k/l
set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W
.) I'd like to use the same keystrokes for switching tmux panes.
An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\
.
Here's how it should work:
Some scripts/configurations that greatly improve tmux/vim workflows. The shell scripts target zsh but should be adaptable without much effort for other unix shells.
Features:
- Transparently move between tmux panes and vim windows
- Using the shell, open files in one vim instance per project or directory
- Fully integrated copy/paste between tmux, vim and x11 using simple keybinds(need to install the xclip program)
- Easily send text to any tmux pane without breaking your edit workflow(needs slimux
'vim-tmux-move.zsh', '.vimrc' and '.tmux.conf' cooperate so you can move transparently between tmux panes and vim windows using ALT + (arrow keys or jkhl). It was based on this gist
JavaScript Code
var str = "hi";
Memory allocation:
Address | Value | Description |
---|---|---|
...... |
... |
# Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/ | |
# Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date. | |
################################################################## | |
Installing and Configuring SmartOS on a budget server (with a /29) | |
################################################################## | |
# if you find this gist useful, please star it | |
# please be aware that budget hosting companies usually cut corners somewhere, |
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
vmadm list | |
# remove your previous try | |
export ID=`vmadm list|grep run|cut -b-36` ; echo $ID | |
export ID=`vmadm list|grep stop|cut -b-36` ; echo $ID | |
vmadm stop $ID | |
vmadm destroy $ID | |
script | |
dladm show-phys -m | |
dladm show-link |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!