Skip to content

Instantly share code, notes, and snippets.

View TerryGeng's full-sized avatar

Terry Geng TerryGeng

  • University of Maryland, College Park
  • College Park, Maryland
  • 00:45 (UTC -05:00)
View GitHub Profile
@TerryGeng
TerryGeng / multiprocessing_in_jupyter_notebook.py
Last active May 29, 2022 19:46
Multiprocessing in Jupyter Notebook. With progress bar and ETA display.
import time
from datetime import timedelta
from multiprocess import Process, Pipe
import ipywidgets as widgets
from IPython.display import display
def run_parallel_tasks(func, tasks, processes=4):
progbar = widgets.IntProgress(
value=0,
min=0,
@TerryGeng
TerryGeng / huawei-session-log-reader.py
Created November 29, 2020 08:51
Utility to read Huawei's binary firewall NAT session log. For auditing use.
"""
Utility to read Huawei's binary firewall NAT session log. For auditing use.
PLEASE DO RESPECT THE PRIVACY OF OTHER PEOPLE.
Log formats are explained in
https://support.huawei.com/enterprise/en/doc/EDOC1000107643?section=j00c
Author: Terry Geng
Date: 2020-11-26
@TerryGeng
TerryGeng / huawei-session-log-host.py
Created November 26, 2020 15:13
Utility to receive the UDP binary log from a Huawei Router/Firewall.
"""
Utility to receive the UDP binary log from a Huawei Router/Firewall.
Author: Terry Geng
Date: 2020-11-26
"""
import socket
import select
import os
import string
@TerryGeng
TerryGeng / format-huawei-ssh-key.sh
Last active November 16, 2023 18:33
Convert OpenSSH public key to PKCS#1 in HEX format
ssh-keygen -e -m pem -f ~/.ssh/id_rsa.pub | sed '1d;$d' | tr -d '\n' | base64 -d | od -t x1 -An | tr -d ' \n' | tr 'a-f' 'A-F' | sed 's/\(.\{8\}\)/\1 /g' | fold -w 54
#!/bin/bash
set -e
HELP="
Usage: $0 -h ROUTER_IP -u USER
Copy the ssh public key of current logged-in user to a Huawei router.
arguments:
diff --git a/src/mumble/CustomElements.cpp b/src/mumble/CustomElements.cpp
index 0de9bb2f..1b5d5d28 100644
--- a/src/mumble/CustomElements.cpp
+++ b/src/mumble/CustomElements.cpp
@@ -99,6 +99,16 @@ void ChatbarTextEdit::contextMenuEvent(QContextMenuEvent *qcme) {
delete menu;
}
+void ChatbarTextEdit::dragEnterEvent(QDragEnterEvent *evt) {
+ inFocus(true);
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 649b1cf3..5ecf7dcd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,6 +22,21 @@ find_pkg(Qt5
REQUIRED
)
+# OpenSSL
+find_package(OpenSSL REQUIRED)
@TerryGeng
TerryGeng / dump_sample.patch
Last active June 7, 2020 16:46
dump_sample.patch
diff --git a/src/mumble/AudioOutputSample.cpp b/src/mumble/AudioOutputSample.cpp
index 7be541f0..dfb6f017 100644
--- a/src/mumble/AudioOutputSample.cpp
+++ b/src/mumble/AudioOutputSample.cpp
@@ -14,6 +14,11 @@
#include <cmath>
+#include <fstream>
+#include <string>
@TerryGeng
TerryGeng / number_maze.c
Last active December 20, 2015 00:49
The solution of the puzzle http://www.guokr.com/post/78432/
/*
http://www.guokr.com/post/78432/
*/
#include<cstdio>
#include<cstring>
@TerryGeng
TerryGeng / HelloWorld.cpp
Created February 24, 2013 14:40
Hello world
#include<iostream>
int main(){
std::cout<<"Hello world!\n";
return 0;
}