This file contains hidden or 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
class Solution { | |
func compareVersion(version1: String, _ version2: String) -> Int { | |
var v1 = version1.characters.split(".").map { Int(String($0)) } | |
var v2 = version2.characters.split(".").map { Int(String($0)) } | |
var result = 0 | |
for i in 0..<max(v1.count,v2.count) { | |
let left = i >= v1.count ? 0 : v1[i] | |
let right = i >= v2.count ? 0 : v2[i] | |
if (left == right) { |
This file contains hidden or 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 | |
sudo yum groups install -y Development\ tools | |
sudo yum install -y cmake | |
sudo yum install -y python34-{devel,pip} | |
sudo pip-3.4 install neovim --upgrade | |
( | |
cd "$(mktemp -d)" | |
git clone https://github.com/neovim/neovim.git | |
cd neovim | |
make CMAKE_BUILD_TYPE=Release |
This file contains hidden or 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
--- Actions --- | |
$Copy <M-C> | |
$Cut <M-X> <S-Del> | |
$Delete <Del> <BS> <M-BS> | |
$LRU | |
$Paste <M-V> | |
$Redo <M-S-Z> <A-S-BS> | |
$SearchWeb <A-S-G> | |
$SelectAll <M-A> | |
$Undo <M-Z> |
This file contains hidden or 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
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> | |
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | |
<c:set var="ua" value="${fn:toLowerCase(header['User-Agent'])}" /> | |
<c:set var="chrome" value="${fn:contains(ua, 'chrome') && !fn:contains(ua, 'msie')}" /> | |
<fmt:formatNumber var="chrome_version" value="${ chrome ? fn:substringBefore(fn:substringAfter(ua, 'chrome/'), '.') : 0}" /> | |
<c:set var="ff" value="${fn:contains(ua, 'firefox') && !fn:contains(ua, 'opera')}" /> | |
<fmt:formatNumber var="ff_version" value="${ ff ? fn:substringBefore(fn:substringAfter(ua, 'firefox/'), '.') : 0}" /> | |
<c:set var="opera" value="${fn:contains(ua, 'opera')}" /> | |
<fmt:formatNumber var="opera_version" value="${opera ? |
This file contains hidden or 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
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n\n'$(date);done |
This file contains hidden or 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
Byobu Commands | |
============== | |
byobu Screen manager | |
Level 0 Commands (Quick Start) | |
------------------------------ | |
<F2> Create a new window |
This file contains hidden or 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
import java.io.IOException; | |
import java.util.*; | |
import java.util.Map; | |
import java.util.Set; | |
import org.apache.commons.math3.linear.*; | |
import org.apache.lucene.analysis.*; | |
import org.apache.lucene.document.*; | |
import org.apache.lucene.index.*; | |
import org.apache.lucene.store.*; |
This file contains hidden or 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
String url = "https://path/to/url/service"; | |
HttpClient client = new HttpClient(); | |
PostMethod method = new PostMethod(url); | |
// Test whether to ignore cert errors | |
if (ignoreCertErrors){ | |
TrustManager[] trustAllCerts = new TrustManager[]{ | |
new X509TrustManager(){ | |
public X509Certificate[] getAcceptedIssuers(){ return null; } | |
public void checkClientTrusted(X509Certificate[] certs, String authType) {} |