Skip to content

Instantly share code, notes, and snippets.

View foemre's full-sized avatar

Emre Erdem foemre

View GitHub Profile
@foemre
foemre / gist:8d1c9b1f506e780ddf665d664e2be02b
Created November 24, 2022 07:11
find text files that contain a regex pattern, extract the file basename, remove all files with that basename
grep -rw *.txt -e "^77" | cut -d'.' --complement -f2- | awk '!seen[$0]++' | while read line; do rm "$line".*; done;
@foemre
foemre / colab.sh
Created November 29, 2020 11:19
google colab env prepare py3.7
#!/bin/bash
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget python3.7 python3-pip python3.7-dev
git clone https://github.com/grammarly/gector.git
cd gector
wget https://www.cl.cam.ac.uk/research/nl/bea2019st/data/fce_v2.1.bea19.tar.gz
wget https://www.cl.cam.ac.uk/research/nl/bea2019st/data/corr_from_m2.py
tar -xzf fce_v2.1.bea19.tar.gz
python3.7 -m pip install -r requirements.txt
cat fce/m2/fce.train.gold.bea19.m2 | grep "^S .*" > train_orig.txt
cat fce/m2/fce.test.gold.bea19.m2 | grep "^S .*" > test_orig.txt
@foemre
foemre / code_scanner.py
Last active October 5, 2018 14:24
A mashup of various code snippets for case-specific (Barcode and QR code scanning) use.
# Barcode and QR Code scanner
# Created by F.O.Emre Erdem
# A mashup of various code snippets for case-specific use.
# Sources:
# https://www.learnopencv.com/barcode-and-qr-code-scanner-using-zbar-and-opencv/
# https://www.pyimagesearch.com/2018/05/21/an-opencv-barcode-and-qr-code-scanner-with-zbar/
from __future__ import print_function
import pyzbar.pyzbar as pyzbar
import numpy as np
@foemre
foemre / ros_image_saver.py
Last active October 5, 2018 07:59 — forked from rethink-imcmahon/ros_image_saver.py
ROS Image Subscriber / JPEG Saver
#! /usr/bin/python
# Copyright (c) 2015, Rethink Robotics, Inc.
# Edited to be used with Husarion's ROSbot
# by F.O.Emre Erdem
# Using this CvBridge Tutorial for converting
# ROS images to OpenCV2 images
# http://wiki.ros.org/cv_bridge/Tutorials/ConvertingBetweenROSImagesAndOpenCVImagesPython
# Using this OpenCV2 tutorial for saving Images:
# http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html