This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.blackberry.bdp.korpse | |
| import scala.collection.parallel.ParIterable | |
| import scala.collection.mutable | |
| import scala.collection.mutable.{ Map => MutableMap } | |
| import org.apache.spark.streaming.kafka.OffsetRange | |
| import kafka.api._ | |
| import kafka.api.OffsetResponse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function password_encode(password) | |
| local bcrypt = require 'bcrypt' | |
| return bcrypt.digest(password, 12) | |
| end | |
| function check_password(password, encoded_password) | |
| local bcrypt = require 'bcrypt' | |
| return bcrypt.verify(password, encoded_password) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| res,err,errcode,sqlstate=db:query("select * from user where username='test'") | |
| if next(res) ~=nil then | |
| rPrint(res,nil,"res----"); | |
| end | |
| res--------table | |
| res---- [1] ----table | |
| res---- [1] [role_id] ----number----1 | |
| res---- [1] [username] ----string----jack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function reroute() { | |
| curl -XPOST 'localhost:9200/_cluster/reroute?pretty' -d '{ | |
| "commands" : [ { | |
| "allocate" : { | |
| "index" : "'$1'", | |
| "shard" : '$2' | |
| "allow_primary" : true, | |
| "node" : "<node>" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| from random import choice | |
| from argparse import ArgumentParser | |
| from pprint import pprint | |
| from elasticsearch import Elasticsearch | |
| def auto_relocate(host='localhost'): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| """ | |
| Copyright 2013 Nextdoor.com, Inc. | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software | |
| distributed under the License is distributed on an "AS IS" BASIS, | |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env python | |
| #-*- coding:utf-8 -*- | |
| import os,sys | |
| import os.path | |
| from os.path import isfile | |
| from traceback import format_exc | |
| import xmlrpclib | |
| import socket | |
| import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # sample usage: checksites.py eriwen.com nixtutor.com yoursite.org | |
| import pickle | |
| import os | |
| import logging | |
| import time | |
| import re | |
| from optparse import OptionParser, OptionValueError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| This simple Python program implements a gossip network protocol. It is | |
| intended only for fun and learning. | |
| Written and directed by Stephane Bortzmeyer | |
| <[email protected]> Licence as liberal as you want but no | |
| warranty. |