Skip to content

Instantly share code, notes, and snippets.

@lite
lite / 0_reuse_code.js
Created February 8, 2017 01:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
@lite
lite / postman-solr
Created June 14, 2016 02:34 — forked from sebnmuller/postman-solr
Postman collection with various useful Solr HTTP requests
{"version":1,"collections":[{"id":"04bbd880-89d1-6b8e-493b-3a5897c3a627","name":"Solr","timestamp":1408609487361,"order":["1318faeb-455d-5933-04aa-03497ef65620","a586f9c9-924f-9e94-4adf-63b656d65ce3","20459ac6-9805-280c-aaef-18b9dcc27a66","ce6d7ede-ddac-d58b-b479-2c6378d5e815","45e38352-938e-6f6b-0daf-d7603f307d3d","2df3df54-f7a3-4807-80b3-7ce8cfcae45d","2ae918e7-8c7e-34af-a67b-404b57d6b403","1c16e9c1-20f5-b102-a8f2-530cfaa7616e","3b6052b6-e184-2613-f114-ef317bc8a179"],"requests":[{"collectionId":"04bbd880-89d1-6b8e-493b-3a5897c3a627","id":"1318faeb-455d-5933-04aa-03497ef65620","name":"Add to index multiple","description":"Add multiple documents to the index","url":"http://localhost:8983/solr/update/json?wt=json","method":"POST","headers":"Content-Type: text/json\n","data":"{\n\"add\": {\n\t\"doc\" : {\n\t\t\"id\":\"1\",\n\t\t\"first_name\":\"christopher\",\n \"last_name\":\"walkin\"\n\t}\n},\n\"add\": {\n\t\"doc\" : {\n\t\t\"id\":\"2\",\n\t\t\"first_name\":\"kristoffer\",\n \"last_name\":\"runn
# 规则配置仅供参考,适用于 Surge Mac (1.0.7) 及其后续版本;
# 包含 Proxy Group、URL Rewrite 特性;
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计;
# 屏蔽 Hao123、百度搜索,放行百度地图、百度外卖、百度音乐、百度云盘、百度百科。
# Surge for Mac 简明指南 http://bit.ly/1TATRaG
[General]
# warning, notify, info, verbose
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
loglevel = notify

How to share a folder with a docker container on OSX

Mounting shared folders between OSX and the docker container is tricky due to the intermediate boot2docker VM. You can't use the usual docker -v option as the docker server knows nothing about the OSX filesystem - it can only mount folders from the boot2docker filesystem. Fortunately, you can work around this using SSHFS.

#!/bin/bash
# Script used to setup elasticsearch. Can be run as a regular user (needs sudo)
ES_USER="elasticsearch"
ES_GROUP="$ES_USER"
ES_HOME="/usr/local/share/elasticsearch"
ES_CLUSTER="clustername"
ES_DATA_PATH="/var/data/elasticsearch"
ES_LOG_PATH="/var/log/elasticsearch"
ES_HEAP_SIZE=1024
using UnityEngine;
using System;
using System.Collections;
using System.IO;
using System.Text;
/// <summary>
/// Bare minimum wrapper for UnityEngine.WWW.
///
%% @private
-spec init(list()) -> {ok, {SupFlags::any(), [ChildSpec::any()]}} |
ignore | {error, Reason::any()}.
init([]) ->
Dispatch = [
%% {Host, list({Path, Handler, Opts})}
{'_', [{[<<"graphs">>, graph], kw_handler, []}]}
],
RestartStrategy = one_for_one,
using UnityEngine;
using System.Collections;
using SuperWebSocket.Client;
using System;
public class Net : MonoBehaviour {
private string lastMessage = string.Empty;
public static string serverURI = "ws://192.168.100.196:12345/channels/0?userId=1";
public static WebSocket webSocket = new WebSocket(serverURI, "basic");