Skip to content

Instantly share code, notes, and snippets.

View SuzanaK's full-sized avatar

Suzana K. SuzanaK

View GitHub Profile
@softwaredoug
softwaredoug / solr-opinons.md
Last active March 6, 2021 20:04
Opinions on using Solr effectively from Doug Turnbull

Solr needs opinions, because Solr documentation gives you way too many options. It's hard to navigate the best practices for using Solr. Some of my opinions based on dozens of Solr projects :)

Prefer preloading static, classic config files over managed schema, config API, or schemaless

Schema files are a good thing. They are declarative, and not letting them change at runtime prevents all kinds of security issues. Further, classic schema / solrconfig support all of Solr's functionality and are well documented with tons of examples online in blog articles and stackoverflow. Using managed schema or the config API takes a lot of experimentation.

Static configurations can also be easily version controlled. As I've learned as a long time Elasticsearch user, this is one of Solr's advantages. Having an API for changing every underlying config option of your index means finding the code that made the change is rather time consuming.

Static configuration is also good separation of concerns. You cleanly separate

@tommcfarlin
tommcfarlin / get-trello-names.js
Last active July 7, 2021 15:15
[JavaScript] Returns an array of all of the names of a Trello boards members.
/**
* Retrieves a list of all of the members on a Trello board and stores and
* returns their names in an array. It will not include any duplicates.
*
* Trello names are usually represented as "Elliot Alderson (mrrobot)" but the
* returned array will only return an array with their actual name (that is,
* Ellio Alderson).
*
* This does not require jQuery or any third-party library to run. If you want
* to run this from the console of Chrome, then paste this entire function into
anonymous
anonymous / gist:4169590
Created November 29, 2012 14:57
Get Google Spreadsheet as PDF with customizations
function spreadsheetToPDF(key) {
var oauthConfig = UrlFetchApp.addOAuthService("spreadsheets");
var scope = "https://spreadsheets.google.com/feeds"
oauthConfig.setConsumerKey("anonymous");
oauthConfig.setConsumerSecret("anonymous");
oauthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oauthConfig.setAuthorizationUrl("https://accounts.google.com/OAuthAuthorizeToken");
oauthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
@mattbaker
mattbaker / README
Created December 22, 2011 06:02
SVG to PNG render with Node and D3.js
This example expects to have d3.min.js and d3.layout.min.js in the same directory as pie.js and pie_serv.js.
Run with node pie_serv.js
@jonpugh
jonpugh / git-pull-recursive.rb
Last active October 20, 2021 03:20
Lots of repos? Try "git-pull-recursive" to run "git pull" on all subfolders with a .git folder inside. Thanks to http://snipplr.com/view/62314/perform-git-pull-on-subdirectory-recursive/
# For use in Chef:
# Adds a command: git-pull-recursive
file "/usr/local/bin/git-pull-recursive" do
owner "root"
group "root"
mode "0755"
action :create
content 'find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull" \;'
end
@philshem
philshem / get_latlong.py
Created April 7, 2014 09:45
Get latitude, longitude and other data from Google Maps geolocation API
import requests
import json
urlbase = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
urlend = 'Zurich,Switzerland'
r = requests.get(urlbase+urlend) # request to google maps api
r=r.json()
if r.get('results'):
@oscar6echo
oscar6echo / README.md
Last active June 13, 2022 19:20
Interactive map of the 16 federal states of Germany
@wanghailei
wanghailei / cstsunami.py
Last active June 16, 2022 04:58
Code snippets of Tsunami
# The following code and the code generated art works are the intellectrual properities of Hailei Wang.
# © 2010 - 2014, Hailei Wang. All rights reserved.
cornu = ximport("cornu")
colors = ximport("colors")
# Painting waves
palette_for_wave = [ colors.hex( “#020034”, “dark blue” ), colors.hex( “#0A5CD6”, “aqua blue” ), colors.hex( “#FEFFFF”, “milk white” ) ]
# Draw Wave
@svanoort
svanoort / CollectionTest.java
Last active August 11, 2022 14:10
Java Microbenchmarks
package hudson.cli;
import org.junit.Test;
import java.util.*;
// Micro benchmark different array ops in Java
// Originally started from http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist/7507740#7507740
// Now completely rewritten to correctly warm up the JIT compilation and take an average over many runs
// Tweaked/corrected version from http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist/7507740#7507740
@paucoma
paucoma / gglCalEventsOnSpreadSheet.gs
Last active March 7, 2023 21:42
Script to read Google Calendar Events and Count total Hours
const gblFrom = {
year : 2020 ,
month : 3,
day : 29,
hour : 0
};
const gblTo = {
year : 2020 ,
month : 8,
day : 1,