Skip to content

Instantly share code, notes, and snippets.

@argonism
argonism / confluence_api_client.py
Created March 12, 2022 04:51
簡易confluence api client
import json
import requests
from datetime import datetime
class ConfluenceAPI():
def __init__(self, token_path):
self.token_path = token_path
self._init_oauth_info(token_path)
if self._check_token_expire(self.expires_at):
# p: posting list
# p must be like [docID_1, docID_2, docID_3, ...]
def union(p1, p2):
answer = []
p1_idx = 0
p2_idx = 0
count = 0
while len(p1) > p1_idx or len(p2) > p2_idx:
if len(p1) <= p1_idx:
answer.append(p2[p2_idx])
# p: posting list
# p must be like [docID_1, docID_2, docID_3, ...]
def intersect(p1, p2):
answer = []
p1_idx = 0
p2_idx = 0
while len(p1) > p1_idx and len(p2) > p2_idx:
if p1[p1_idx] == p2[p2_idx]:
answer.append(p1[p1_idx])
p1_idx += 1
#define JOYCON_L_PRODUCT_ID 8198
#define JOYCON_R_PRODUCT_ID 8199
#define MAX_JOYSTICKS_NUM 16
#include <hidapi.h>
#include <stdint.h>
#include <string.h>
#include <iostream>
#include <chrono>
#include <array>
#define JOYCON_L_PRODUCT_ID 8198
#define JOYCON_R_PRODUCT_ID 8199
#define MAX_JOYSTICKS_NUM 16
#include <hidapi.h>
#include <stdint.h>
#include <string.h>
#include <iostream>
#include <chrono>
#include <array>
#define JOYCON_L_PRODUCT_ID 8198
#define JOYCON_R_PRODUCT_ID 8199
#include <hidapi/hidapi.h>
#include <stdint.h>
#include <string.h>
void SendSubcommand(hid_device *dev, uint8_t command, uint8_t data[], int len, int* globalCount) {
uint8_t buf[0x40]; memset(buf, 0x0, size_t(0x40));
buf[0] = 1; // 0x10 for rumble only
@argonism
argonism / joycon.c
Last active December 1, 2019 14:10
#define JOYCON_L_PRODUCT_ID 8198
#define JOYCON_R_PRODUCT_ID 8199
#include <hidapi/hidapi.h>
#include <stdint.h>
#include <string.h>
void SendSubcommand(hid_device *dev, uint8_t command, uint8_t data[], int len, int* globalCount) {
uint8_t buf[0x40]; memset(buf, 0x0, size_t(0x40));
buf[0] = 1; // 0x10 for rumble only