Skip to content

Instantly share code, notes, and snippets.

View alucarded's full-sized avatar
🏠
Working from home

Tomasz Edward Posluszny alucarded

🏠
Working from home
View GitHub Profile
##########################################################################
# Maximum Response filterbank from
# http://www.robots.ox.ac.uk/~vgg/research/texclass/filters.html
# based on several edge and bar filters.
# Adapted to Python by Andreas Mueller amueller@ais.uni-bonn.de
# Share and enjoy
#
import numpy as np
import matplotlib.pyplot as plt
import cv2
import cv2.cv as cv
import numpy as np
import cmath
img = cv2.imread('nano.bmp', cv2.CV_LOAD_IMAGE_GRAYSCALE)
# Find particles
img = cv2.medianBlur(img, 3)
circles = cv2.HoughCircles(img, cv.CV_HOUGH_GRADIENT, 4, 10, param1=255, param2=20, minRadius=1, maxRadius=10)
import pandas as pd
# Read CSV file into DataFrame object
csv_df = pd.read_csv(csv_file_path)
# Read XLS/XLSX file into DataFrame object
excel_df = pd.read_excel(excel_io)
@alucarded
alucarded / gist:a6a63e806c21716af9320eb5201c4b2a
Created November 15, 2019 21:12 — forked from alexxxdev/gist:1dd024cadea091ca64154f9616d5739a
remote: fatal: pack exceeds maximum allowed size
# Adjust the following variables as necessary
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=500
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD
else
@alucarded
alucarded / symbolizing_osx_crash_logs.md
Created April 29, 2020 17:24 — forked from bmatcuk/symbolizing_osx_crash_logs.md
How to symbolize OSX crash logs

How to Symbolize OSX Crash Logs

Unfortunately, xcode does not yet have support for importing OSX crash logs and symbolizing them. Therefore, you must use the command line and a little bit of manual work.

  1. Find your dSYM file.
    1. Assuming you are using xcode's archive functionality, open the Organizer window from the Window menu.
    2. Click the Archives tab.
    3. Right click on the appropriate build and select Show in Finder.
    4. When Finder opens, right click on the selected archive and select Show Package Contents.
    5. Navigate to the dSYM directory and copy the appropriate dSYM file to a temporary directory.
  2. Then navigate to Products, then Applications, and copy the app file to the same temporary directory.
@alucarded
alucarded / SignupServiceApplication.java
Last active August 9, 2020 22:11
Spring + RabbitMQ basic configuration with topic exchange
package com.phoneservice.phoneservice;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
@alucarded
alucarded / SignupServiceController.java
Created August 9, 2020 22:10
Publishing to RabbitMQ via HTTP API with Spring Framework
package com.phoneservice.phoneservice;
import com.phoneservice.phoneservice.model.Signup;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@alucarded
alucarded / SignupListener.java
Last active August 9, 2020 23:14
Spring + RabbitMQ signup event message consumer
package com.phoneservice.phoneservice;
import com.phoneservice.phoneservice.model.Signup;
import com.phoneservice.phoneservice.model.SignupParsed;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;
@Component
public class SignupListener {
@alucarded
alucarded / economic_events_update_dag.py
Last active December 4, 2020 19:09
Airflow DAG definition file to dynamically generate DAGs based on a variable (pull economic data when it is released)
#/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
import airflow
from airflow import DAG
from datetime import timedelta, datetime
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.http_operator import SimpleHttpOperator
@alucarded
alucarded / rocksdb_restart_memory_test.cc
Created September 25, 2020 13:50
RocksDB restarting test for memory profiling
#include <cstdio>
#include <cunistd>
#include <iostream>
#include <memory>
#include <string>
#include "rocksdb/convenience.h"
#include "rocksdb/db.h"
#include "rocksdb/slice.h"
#include "rocksdb/options.h"