Skip to content

Instantly share code, notes, and snippets.

View lianyi's full-sized avatar

lianyi lianyi

  • Bethesda MD
View GitHub Profile
@lianyi
lianyi / test.sh
Created June 12, 2017 19:02
solr testing Transfer-Encoding: chunked
export SOLRUPDATE='http://localhost:8983/solr/testingCore/update?wt=json&commit=true'
export SOLRQUERY='http://localhost:8983/solr/testingCore/select?wt=json&q=*:*'
curl $SOLRUPDATE --data-binary '[{"id": "1"},{"id": "2"}]' -H 'Content-Type: application/json' -X POST -H "Transfer-Encoding: chunked"
#>> response {"responseHeader":{"status":0,"QTime":295}}
curl $SOLRQUERY
#>> {"responseHeader":{"status":0,"QTime":15,"params":{"q":"*:*","wt":"json"}},"response":{"numFound":2,"start":0,"maxScore":1.0,"docs":[{"id":"1","_version_":1570026155898044416},{"id":"2","_version_":1570026155878121472}]}}
@lianyi
lianyi / README.md
Created February 16, 2017 15:25 — forked from mbostock/.block
Spline Editor

Click to add new points. Hit the DELETE key to remove the selected point. Use the dropdown menu to change the interpolation mode.

@lianyi
lianyi / .block
Created February 16, 2017 15:23 — forked from mbostock/.block
Line Interpolation
license: gpl-3.0
@lianyi
lianyi / deploy-static-site-heroku.md
Created November 19, 2016 14:19 — forked from wh1tney/deploy-static-site-heroku.md
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@lianyi
lianyi / missing_indexes.sql
Created September 20, 2016 15:44 — forked from jasonmead/missing_indexes.sql
Find missing indexes in SQL Server
PRINT 'Missing Indexes: '
PRINT 'The "improvement_measure" column is an indicator of the (estimated) improvement that might '
PRINT 'be seen if the index was created. This is a unitless number, and has meaning only relative '
PRINT 'the same number for other indexes. The measure is a combination of the avg_total_user_cost, '
PRINT 'avg_user_impact, user_seeks, and user_scans columns in sys.dm_db_missing_index_group_stats.'
PRINT ''
PRINT '-- Missing Indexes --'
SELECT CONVERT (varchar, getdate(), 126) AS runtime,
mig.index_group_handle, mid.index_handle,
CONVERT (decimal (28,1), migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans)) AS improvement_measure,
@lianyi
lianyi / docker.md
Last active September 18, 2016 13:51
One liner to stop / remove all of Docker containers

One liner to stop / remove all of Docker containers:

docker stop $(docker ps -a -q)

docker rm $(docker ps -a -q)

1. Open /Applications/XAMPP/etc/httpd.conf
2. Enable the following Modules by removing the # at the front of the line.
- LoadModule rewrite_module modules/mod_rewrite.so
- LoadModule proxy_module modules/mod_proxy.so
- LoadModule proxy_http_module modules/mod_proxy_http.so
3. Copy and Paste below to the bottom of httpd.conf
# Implements a proxy/gateway for Apache.

Simplest way to add pan/zoom to a d3js visualisation

# 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://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'
@lianyi
lianyi / app.js
Created May 10, 2016 14:31 — forked from rewonc/app.js
Authenticate a user with angularfire, save to firebase, and make available to controllers with promise
/*
This file is a brief example of how to use angularfire to authenticate a user, save that user's public profile to firebase, then
ensure that both the authenticated and public user are available in your controllers.
The route configuration uses angular-ui-router: https://github.com/angular-ui/ui-router
*/