Skip to content

Instantly share code, notes, and snippets.

View ponsheng's full-sized avatar
😁
Live well, work well

Po-Sheng Chen ponsheng

😁
Live well, work well
View GitHub Profile
@ponsheng
ponsheng / query_relation_chain.py
Last active March 17, 2022 07:24
Query Gerrit relation chain of certain patch set with SSH
#!/usr/bin/env python3
# Query Gerrit relation chain of certain patch set with SSH
# Used for Gerrit + Jenkins auto-verify multiple commits (pushed together)
# Usage ./query_relation_chain.py <ssh_destination> <port> <project> <gerrit_id> <patch_set>
help_msg = "SYNOPSIS: {} <ssh_destination> <port> <project> <gerrit_id> <patch_set>"
import logging
@ponsheng
ponsheng / crc16.py
Last active December 27, 2021 07:14
Python Implementation of CRC16
#!/usr/bin/env python3
# Reverse lowest 'bit_count' bit of num
def reflect(num, bit_count):
result = 0
mask = 1
for i in range(bit_count):
mask = 1 << i
if (mask & num) != 0:
@ponsheng
ponsheng / OpenCV_Sharpness.cpp
Last active May 29, 2017 06:13
Use cv::GaussianBlur add cv::addWeighted to improve image sharpness
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main( int argc, char** argv )