Skip to content

Instantly share code, notes, and snippets.

View agathauy's full-sized avatar
🎯
Focusing

Agatha Uy agathauy

🎯
Focusing
View GitHub Profile
# Saving gist for "frozen" script. Originally from https://github.com/tsunrise/colab-github
def github_auth(persistent_key: bool):
"""
Authenticate with GitHub to access private repo. This function will
detect if there is `id_ed25519` key SSH profile. If not, it will create
one.
- `persistent_key`: Store private key in Google Drive.
"""
import os
@agathauy
agathauy / private_fork.md
Created October 6, 2021 16:02 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@agathauy
agathauy / read-camera.py
Created September 21, 2020 04:39 — forked from bsdnoobz/read-camera.py
Displaying webcam feed using OpenCV and Python+PySide.
#!/usr/bin/env python
from PySide.QtCore import *
from PySide.QtGui import *
import cv2
import sys
class MainApp(QWidget):
def __init__(self):
@agathauy
agathauy / opencv_view_image_jupyter.py
Created September 29, 2019 12:37
Snippet for showing opencv image in jupyter notebook
fig = plt.figure(figsize=(12, 5), dpi= 80, facecolor='w', edgecolor='k')
ax1 = fig.add_subplot(1,2,1)
ax1.imshow(cv.cvtColor(library1_img, cv.COLOR_BGR2RGB))
ax2 = fig.add_subplot(1,2,2)
ax2.imshow(cv.cvtColor(library2_img, cv.COLOR_BGR2RGB))
@agathauy
agathauy / serial_port_ubuntu_cmds.md
Last active September 5, 2019 06:23
serial port on ubuntu bash
@agathauy
agathauy / python_logger.py
Created August 15, 2019 08:23
logger script
# logging
import logging
# Configure logger
#logging.basicConfig(filename="test.log", format='%(filename)s: %(message)s', filemode='w')
logPath = "."
fileName = "test"
logging.basicConfig(
level=logging.ERROR,
__author__ = 'bunkus'
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.image import Image
from kivy.clock import Clock
from kivy.graphics.texture import Texture
import cv2
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$cwd/installation/OpenCV-3.4.5 \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D OPENCV_SKIP_PYTHON_LOADER=ON \
-D CMAKE_PREFIX_PATH=$QT5PATH \
-D CMAKE_MODULE_PATH="$QT5PATH"/lib/cmake \
-D OPENCV_PYTHON3_INSTALL_PATH=/miniconda3/envs/cv282/lib/python3.6/site-packages \
@agathauy
agathauy / cmake_opencv3.4.txt
Last active August 12, 2019 11:38
sample cmake file for opencv 3.4 #opencv
cmake_minimum_required(VERSION 3.1)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
SET(OpenCV_DIR /Users/user/opencv/installation/OpenCV-3.4.5/share/OpenCV)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
@agathauy
agathauy / opencv_cmake.txt
Last active August 12, 2019 11:38
OpenCV cmake script. Tested on 3.4.5 and 4.0.0 on Mac OS #opencv
# Reference https://www.learnopencv.com/install-opencv-4-on-macos/
# compiled scripts, modified to get it working for custom python path
brew install python3
brew install cmake
brew install qt5
QT5PATH=/usr/local/Cellar/qt/5.11.2_1
cwd=$(pwd)
cvVersion="3.4.4"