Skip to content

Instantly share code, notes, and snippets.

@mwin007
mwin007 / Rsync to AWS EC2 Using .PEM key
Created November 29, 2015 08:00
Rsync to AWS EC2 Using .PEM key
The standard AWS EC2 instances support using a .PEM key to log in, instead of a more common SSH username/password combination. If you want to use Rsync to transfer data from your local machine to an AWS EC2 instance you will need to change the Rsync command to be something like this:
1
rsync -rave "ssh -i PEMKEYFILE.pem" /path/to/local/files/* ec2-user@EC2_INSTANCE_HOSTNAME:/path/to/remote/files
For simplicities sake I ensured that I was in the directory where the .pem key was saved, but you can adjust the command to give the path to your key file.
Beyond this it's just like regular Rsync, so just follow the on-screen commands and you get secured file transfer between your local machine and your remote AWS EC2 instance
@praseodym
praseodym / AESGCMUpdateAAD2.java
Last active June 7, 2021 16:38
JDK8 AES-GCM code example
import javax.crypto.*;
import javax.crypto.spec.GCMParameterSpec;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import java.util.Arrays;
public class AESGCMUpdateAAD2 {
// AES-GCM parameters
public static final int AES_KEY_SIZE = 128; // in bits
@dreadjr
dreadjr / intellij-protoc
Created July 17, 2014 19:27
intellij "Cannot run program "protoc": error=2, No such file or directory"
gradle build using
plugin: 'protobuf'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'ws.antonov.gradle.plugins:gradle-plugin-protobuf:0.9.1'
@juderosen
juderosen / git-wars.md
Last active April 25, 2024 15:16
Git Wars: GitHub vs Bitbucket

Git Wars: GitHub vs Bitbucket

Introduction

Now, you might think the answer I'm going to give you is already obvious because I'm using GiHub right now, but it's not. Both GitHub and Bitbucket offer great Git services, but each has its own features and pricing plans. In the following... thing, I'm going to compare the two and then offer a final solution that should work for most people.

TL;DR: Both. Use GitHub for open source and public repos (you'll spend most of your time here) and Bitbucket for private repos. But, sign up for GitHub first, then import account into Bitbucket. Also, check comments for updates. P.S. I personally prefer GitHub.

Interface and Functionality

@Fedalto
Fedalto / LICENSE
Last active January 16, 2019 07:23
The script monitor the Solr health. https://github.com/Fedalto/solr-monitor
The MIT License (MIT)
Copyright (c) 2015 Leonardo Fedalto
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@d3noob
d3noob / .block
Last active April 25, 2024 13:48
World Map with zoom and pan
license: mit
@tekener
tekener / pom.xml
Created September 11, 2012 17:10
Ensure that Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files are installed using maven-enforcer-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
@jboner
jboner / latency.txt
Last active May 3, 2024 15:17
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@nz
nz / Delete all documents in a Solr index using curl.md
Last active February 12, 2024 10:55
Delete all documents in a Solr index using curl
# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl

curl "http://index.websolr.com/solr/a0b1c2d3/update?commit=true" -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'

I'm amused at the traction this little gist is getting on Google! I would be remiss not to point out that six+ years later I'm still helping thousands of companies on a daily basis with their search index management, by providing managed Solr as a service over at Websolr, and hosted Elasticsearch at Bonsai. Check us out if you'd like an expert helping hand at Solr and Elasticsearch hosting, ops and support!