Skip to content

Instantly share code, notes, and snippets.

@mcrmfc
mcrmfc / VIM - Vertical Buffer Split
Last active December 19, 2025 17:04
VIM - My cheat sheet
search and replace
-------------------
s/foo/bar/g changes each 'foo' to 'bar' in the current line.
:%s/foo/bar/g changes each 'foo' to 'bar' in all lines.
:5,12s/foo/bar/g changes each 'foo' to 'bar' for all lines between line 5 and line 12.
:'a,'bs/foo/bar/g changes each 'foo' to 'bar' for all lines between marks a and b.
:.,$s/foo/bar/g changes each 'foo' to 'bar' for all lines between the current line (.) and the last line ($).
:.,+2s/foo/bar/g changes each 'foo' to 'bar' for the current line (.) and the two next lines (+2).
:%s is equivalent to :1,$s
@mcrmfc
mcrmfc / htmlunit proxy bypass fix
Created March 17, 2011 15:52
HTMLUnit fix for proxy bypass
private static void setProxy(final HttpClient httpClient, final WebRequest webRequest) {
if (webRequest.getProxyHost() != null) {
final String proxyHost = webRequest.getProxyHost();
final int proxyPort = webRequest.getProxyPort();
final HttpHost proxy = new HttpHost(proxyHost, proxyPort);
if (webRequest.isSocksProxy()) {
final SocksSocketFactory factory = (SocksSocketFactory)
httpClient.getConnectionManager().getSchemeRegistry().getScheme("http").getSocketFactory();
factory.setSocksProxy(proxy);
}