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
cd ~ | |
sudo apt-get update | |
sudo apt-get install curl python-software-properties -y | |
sudo apt-get install openjdk-6-jre-headless | |
curl -L http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz | tar -xz | |
sudo mv elasticsearch-* /usr/local/share/elasticsearch | |
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz | |
sudo mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/ | |
rm -Rf *servicewrapper* |
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
# Reduces numerical error when adding a sequence of floats. | |
# http://en.wikipedia.org/wiki/Kahan_summation_algorithm | |
# | |
# Examples: | |
# | |
# Sums all given arguments: | |
# KahanSum.new([3.14159265358979323846 , 2.71828182845904523536], 1.41421356237309504880) | |
# => #<KahanSum:0x007fd218984120 @sum=7.274088044421934, @c=2.220446049250313e-16> | |
# | |
# Incremental summation: |
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
require 'openssl' | |
require 'base64' | |
module Cipher | |
def self.encrypt(key, data) | |
data += 'A' # Add 'A' suffix to support empty data | |
cipher(:encrypt, key, data) | |
end | |
def self.decrypt(key, text) |
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
# Public: Join lists into sentence-like strings of the form a, b, c and 2 others. | |
# | |
# options - Options hash. | |
# :max - The maximum number of items to include in the result | |
# (default: 3). | |
# :delimiter - Delimiter between items (default: ', '). | |
# :last_delimiter - Delimiter between the two last items (default: ' and '). | |
# :others_formatter - Block called to format the '3 others' suffix | |
# (default: pluralize(count, 'other')) | |
# &formatter - Block called to format each item (default: item.to_s). |
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
# HashOfArray keeps track of the combined order in which elements are appended to its | |
# arrays. | |
# HashOfArray.items returns all items appended to the arrays, in the order they were | |
# appended. | |
# | |
# Example: | |
# | |
# h = HashOfArray.new | |
# | |
# h[:a] << 1 |
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
#!/bin/sh | |
JAVA=/usr/bin/java | |
JAR=/home/twofishes/opt/twofishes/server-assembly-0.81.9.jar | |
DATA=/home/twofishes/opt/twofishes/data/ | |
OPTS="-Xmx4096m -jar $JAR --hfile_basepath $DATA --preload 1 --warmup 1" | |
NAME=twofishes | |
DESC=twofishes |
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
.css-selector { | |
background: linear-gradient(0deg, #24662f, #000000, #24662f); | |
background-size: 600% 600%; | |
-webkit-animation: AnimationName 16s ease infinite; | |
-moz-animation: AnimationName 16s ease infinite; | |
-o-animation: AnimationName 16s ease infinite; | |
animation: AnimationName 16s ease infinite; | |
} | |
@-webkit-keyframes AnimationName { | |
0%{background-position:51% 0%} |
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
// Meeting Github Copilot for the first time. | |
function calculateDaysBetweenDates(date1, date2) { | |
const diff = Math.abs(date2 - date1); // Difference in milliseconds | |
return Math.ceil(diff / (1000 * 60 * 60 * 24)); // Days | |
} | |
console.log(calculateDaysBetweenDates(new Date('July 12, 2016'), new Date('July 22, 2016'))); | |
// Wow! This was a lot of work. We can do better. Let's use a library. |
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
Name: Charlie Brooks, Jr. (12/07/1982) | |
Statement: | |
Statement to the Media: I, at this very moment, have absolutely no fear of what may happen to this body. My fear is for Allah, God only, who has at this moment the only power to determine if I should live or die... As a devout Muslim, I am taught and believe that this material life is only for the express purpose of preparing oneself for the real life that is to come... Since becoming Muslim, I have tried to live as Allah wanted me to live. | |
Spoken: | |
Yes, I do. | |
I love you. | |