Skip to content

Instantly share code, notes, and snippets.

View dong-zeyu's full-sized avatar

Zeyu Dong dong-zeyu

  • Stony Brook University
  • New York
View GitHub Profile
@dong-zeyu
dong-zeyu / mp_sharedmap.py
Created August 24, 2023 15:06
A multiple processing helper using COW to boost speed and optimize memory usage
import multiprocessing as mp
import numpy as np
global_data = {}
def array_to_numpy(output_type, output):
if output_type == "list":
output = [np.ctypeslib.as_array(arr).reshape(shape) for arr, shape in output]
def days_hours_minutes_seconds(td):
seconds = td.total_seconds()
if seconds < 0:
seconds = -seconds
suffix = "later"
else:
suffix = "ago"
seconds = int(seconds)
if seconds < 60:
import json
import os
from telegram import Update
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, Updater, Filters
class BroadcastBot:
def __init__(self, token, data_file, admin_password, access_password=None):
self.updater = Updater(token)
#include <curl/curl.h>
#include <string.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <ifaddrs.h>
#include <stdio.h>
#include <unistd.h>
libinput version: 1.14.901
event5 - AlpsPS/2 ALPS GlidePoint: is tagged by udev as: Touchpad
event5 - AlpsPS/2 ALPS GlidePoint: device is a touchpad
-event5 DEVICE_ADDED AlpsPS/2 ALPS GlidePoint seat0 default group1 cap:pg size 102x29mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on
event5 - button state: touch 0 from BUTTON_STATE_NONE event BUTTON_EVENT_IN_AREA to BUTTON_STATE_AREA
event5 - button state: touch 1 from BUTTON_STATE_NONE event BUTTON_EVENT_IN_AREA to BUTTON_STATE_AREA
event5 - gesture state: GESTURE_STATE_NONE → GESTURE_STATE_UNKNOWN
event5 - gesture state: GESTURE_STATE_UNKNOWN → GESTURE_STATE_SCROLL
event5 POINTER_AXIS +0.023s vert 0.00/0 horiz 18.80/0* (finger)
event5 POINTER_AXIS +0.036s vert 0.00/0 horiz 27.61/0* (finger)