Skip to content

Instantly share code, notes, and snippets.

View wowxunyl's full-sized avatar
:octocat:
Coding

xunyulin wowxunyl

:octocat:
Coding
View GitHub Profile
@wowxunyl
wowxunyl / ..git-pr.md
Created April 17, 2020 02:55 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@wowxunyl
wowxunyl / kafka-cheat-sheet.md
Created March 24, 2020 07:52 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@wowxunyl
wowxunyl / zkDelAll.py
Last active December 22, 2019 13:30 — forked from mkrcah/zkDelAll.py
[kazoo]Remove all ZooKeeper nodes according to a given path template, see http://stackoverflow.com/questions/25052245/zookeeper-cli-wildcard-support #zookeeper
import sys
from kazoo.client import KazooClient
if len(sys.argv) not in (2,3):
print('Usage: zkDelAll.py [path] [host:port=localhost:2181]')
exit(1)
host = sys.argv[2] if len(sys.argv) == 3 else 'localhost:2181'
path = sys.argv[1]
for line in $(cat hosts)
do
ssh-keygen -f "/root/.ssh/known_hosts" -R $line
ssh-keyscan $line >> /root/.ssh/known_hosts
done
@wowxunyl
wowxunyl / hbase_connection_pool.py
Last active December 22, 2019 02:47 — forked from ng-wei/hbase_connection_pool.py
[happybase] basic opeeration #hbase
# -*- coding: utf-8 -*-
import happybase
pool = happybase.ConnectionPool(size=10, host='xxx')
if __name__ == '__main__':
with pool.connection() as conn:
table = conn.table('table')
# row filter demo
row_filter = "RowFilter(=, 'regexstring:1234')"
@wowxunyl
wowxunyl / future.scala
Last active December 22, 2019 13:39 — forked from jsrikrishna/gist:7db4b47514f7cf2ce171
[scala future poc]Scala Future.sequence example # future
/**
* @author sjalipar
*/
object myMain {
def main(args: Array[String]): Unit = {
println("test - start")
import scala.concurrent.Future
import scala.util.Success
import scala.util.Failure
@wowxunyl
wowxunyl / batch_remove_repo.sh
Last active December 22, 2019 13:41
[batch delete github repo] #Github
while read r;do curl -XDELETE -H 'Authorization: token xxx' "https://api.github.com/repos/:username/$r ";done < repos.txt