Skip to content

Instantly share code, notes, and snippets.

@jzelenkov
jzelenkov / job-resume.rb
Created March 2, 2010 14:03 — forked from igrigorik/job-resume.rb
Job Resume
# Hey coops..
#
# Imagine yourself on the other side of the table: two job openings, hundreds of resumes,
# _all of which_ look friggin' identical. Yeah, the HR departments at your MegaCorp XYZ are using
# automated tools to scan for keywords, and the coop department at your school is trying to beat
# you into submission to follow some "predefined template".. But, unless what you're aspiring to
# is to be an automaton at MegaCorp XYZ, relegated to writing test harnesses for code that will
# never see the light of day.. please do yourself a favor, and _be different_! Be bold, dammit.
#
# (Frankly, I'm falling asleep while reading your resumes.. Wake me up! Srsly.)
@jzelenkov
jzelenkov / gist:900788
Created April 3, 2011 20:43
mysql utf8 support
# mysqld my.ini config (to adjust the mysql connection properties)
[mysql]
# sets mysql connection to use utf8 on the client side per default.
default-character-set=utf8
[mysqld]
# sets mysql connection to use utf8 on the server side per default.
character-set-server=utf8
collation-server=utf8_general_ci
@jzelenkov
jzelenkov / pom.xml
Created March 16, 2012 01:27 — forked from codahale/pom.xml
Take this and save it as pom.xml in your project directory.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- none yet -->

How can I delete all documents from Solr index?

Use the "match all docs" query in a delete by query command: <delete><query>*:*</query></delete>

You must also commit after running the delete so, to empty the index, run the following two commands:

curl http://localhost:8983/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'  
curl http://localhost:8983/solr/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'

Another strategy would be to add two bookmarks in your browser:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\[SESSION_NAME]]
"Colour0"="217,230,242"
"Colour1"="217,230,242"
"Colour2"="14,27,48"
"Colour3"="14,27,48"
"Colour4"="14,27,48"
"Colour5"="217,230,242"
"Colour6"="0,0,0"
@jzelenkov
jzelenkov / KillVM.java
Created December 18, 2013 00:31
cheater way to crush the JVM.
import java.lang.reflect.Field;
import sun.misc.Unsafe;
public class KillVM {
public static void main(String... args) {
Unsafe unsafe = null;
try {
Field field = sun.misc.Unsafe.class.getDeclaredField("theUnsafe");
field.setAccessible(true);
@jzelenkov
jzelenkov / 01_webdriver-js-wrapper.js
Last active July 4, 2016 19:01
Make your browsers work for you – Source Code – FrankfurtJS #2 2014-05-14
var assert = require('assert'),
test = require('selenium-webdriver/testing'),
webdriver = require('selenium-webdriver');
test.describe('Submitted message should be shown', function() {
test.it('should work', function(done) {
var driver = new webdriver.Builder()
.withCapabilities(webdriver.Capabilities.chrome())
.build();
@jzelenkov
jzelenkov / rasterize.js
Created July 8, 2014 18:13
jar of cookies
var page = require('webpage').create()
var args = require('system').args
var argv = require('optimist').argv
var url = args[1]
var resolution = args[2]
var width = resolution.split('x')[0]
var height = resolution.split('x')[1]
var timeout = args[3]
var cut = args[4] == 'true'
@jzelenkov
jzelenkov / 01_webdriver_js_wrapper_src.js
Created July 15, 2014 15:20
make your browsers test for you article source code
driver.findElement(webdriver.By.name('whoami'))
.sendKeys('FrankfurtJS!');
driver.findElement(webdriver.By.id('greet'))
.click();
driver.findElement(webdriver.By.id('message'))
.getText()
.then(function(val) {
assert.equal(val, 'FrankfurtJS!', 'Messages should be the same');
@jzelenkov
jzelenkov / 01_webdriver_js_wrapper_src.js
Last active August 29, 2015 14:04
make your browsers test for you article source code. 01_webdriver_js_wrapper_src.js
driver.findElement(webdriver.By.name('whoami'))
.sendKeys('WebDriver was here!');
driver.findElement(webdriver.By.id('greet'))
.click();
driver.findElement(webdriver.By.id('message'))
.getText()
.then(function(val) {
assert.equal(