Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
| #!/usr/bin/env python | |
| import os | |
| import itertools | |
| import multiprocessing as mp | |
| from math import ceil | |
| from types import GeneratorType as generator | |
| from functools import partial | |
| from time import time | |
| <?php | |
| class T { | |
| protected $Context = array(); | |
| protected $Compiled = NULL; | |
| public $Regex_Variable = '~\{\{\s+[a-z_0-9\|:\.]+\s+\}\}~imsu'; | |
| public $Separator_Filter = '|'; | |
| public $Separator_Directive = ':'; | |
| protected $HTML_Encoder = NULL; | |
| protected $HTML_ENCODE = TRUE; | |
| protected $VALUE_CACHE = array(); |
| /* | |
| <div id="editor"></div> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
| <style> | |
| .clearfix:after { | |
| clear: both; | |
| } | |
| .clearfix:before, .clearfix:after { | |
| content: " "; | |
| display: table; |
| # Basically the nginx configuration I use at konklone.com. | |
| # I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com | |
| # | |
| # To provide feedback, please tweet at @konklone or email [email protected]. | |
| # Comments on gists don't notify the author. | |
| # | |
| # Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites. | |
| # Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration. | |
| server { |
| """Kernel K-means""" | |
| # Author: Mathieu Blondel <[email protected]> | |
| # License: BSD 3 clause | |
| import numpy as np | |
| from sklearn.base import BaseEstimator, ClusterMixin | |
| from sklearn.metrics.pairwise import pairwise_kernels | |
| from sklearn.utils import check_random_state |
Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
| # | |
| # A CORS (Cross-Origin Resouce Sharing) config for nginx | |
| # | |
| # == Purpose | |
| # | |
| # This nginx configuration enables CORS requests in the following way: | |
| # - enables CORS just for origins on a whitelist specified by a regular expression | |
| # - CORS preflight request (OPTIONS) are responded immediately | |
| # - Access-Control-Allow-Credentials=true for GET and POST requests |
| <textarea name="my-xml-editor" data-editor="xml" rows="15"></textarea> | |
| ... | |
| <textarea name="my-markdown-editor" data-editor="markdown" rows="15"></textarea> | |
| ... | |
| <script src="//d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script> | |
| <script> | |
| // Hook up ACE editor to all textareas with data-editor attribute | |
| $(function () { |
| DROP FUNCTION IF EXISTS SPLIT; | |
| DROP FUNCTION IF EXISTS _SPLIT; | |
| DROP FUNCTION IF EXISTS RTSPLIT; | |
| DROP FUNCTION IF EXISTS LTSPLIT; | |
| DELIMITER // | |
| -- Simple Split (no trim) | |
| CREATE FUNCTION SPLIT(S CHAR(255), DELIM VARCHAR(30), S_INDEX TINYINT UNSIGNED) RETURNS VARCHAR(255) | |
| BEGIN | |
| RETURN _SPLIT(S, DELIM, S_INDEX, '', 0); |
| require("riak-php-client/riak.php"); | |
| $client = new RiakClient('127.0.0.1', 8098); | |
| $mr = new RiakMapReduce($client); | |
| $keys = array("TFrWAVz8RRVEEqCH3nS27O4InLB","FEwZgNI4VTJSIZxSas0QpOCCXjn","EkSkmblyIAT5VL7xYpScP2GP71G"); | |
| foreach ($keys as $key) { | |
| $mr->add("local_ns~users", $key); | |
| } | |
| $mr->map("Riak.mapValues"); |