Skip to content

Instantly share code, notes, and snippets.

View piotrmaslanka's full-sized avatar

Piotr Maślanka piotrmaslanka

View GitHub Profile
@piotrmaslanka
piotrmaslanka / doctor-wheel.sh
Last active September 18, 2020 22:35
A shell script to strip Python wheels' .so files found within modules of any symbols
#!/bin/bash
#
# A shell script to strip any executables found within Python wheels
#
WHEEL_NAME=$(basename "$1")
MY_DIR="$(cat /proc/sys/kernel/random/uuid)"
mkdir "${MY_DIR}"
mv "$1" "${MY_DIR}"
@piotrmaslanka
piotrmaslanka / bfsqueue.hpp
Last active September 5, 2020 14:05
A useful queue for BFS algorithms
/**
* A queue for BFS, remembering what has been previously done and forbidding adding those elements
* to the queue
* @author Piotr Maślanka <piotr.maslanka@henrietta.com.pl>
* @copyright Cervi Robotics sp. z o. o.
*/
#include <deque>
#include <set>
#ifndef BFS_QUEUE_H
@piotrmaslanka
piotrmaslanka / vectorset.hpp
Last active September 5, 2020 13:29
Vector that disallows duplicates and has a fast membership check
/**
* A vector that disallows duplicates and has a fast membership check
* @author Piotr Maślanka <piotr.maslanka@henrietta.com.pl>
* @copyright Cervi Robotics sp. z o. o.
*/
#include <vector>
#include <set>
#include <algorithm>
@piotrmaslanka
piotrmaslanka / README.md
Last active August 24, 2020 14:39
Script to receive SMS-es from an AT command operated GSM modem.

list_sms

A tool to automatically receive SMS-es from SIM card of a AT-command enabled GSM modem running over your UART (or USB, as long as it's reachable as a serial device, it's fair game), write them to a file and then delete them from the SIM card, since the SIM card doesn't have infinite space.

Run it without any modifiers to delete the SMS-es, run it with any modifier, preferably --dont-delete not to delete them from the SIM card.

@piotrmaslanka
piotrmaslanka / djikstrainfix.py
Last active May 21, 2020 20:51
Implementation of Djikstra's shunting yard algorithm in Python
'''
Written by a Public Domain Fan. Means it's public domain :)
Piotr Maślanka <piotr.maslanka@henrietta.com.pl>
Targets: Python 2.7
'''
class MismatchedParenthesesException(Exception):
DOCKER_HOST=172.17.0.1 docker exec -it cassandra nodetool compactionstats | tail -n +3 | head -1 | awk '{ print $5/$6"% done"; }'
@piotrmaslanka
piotrmaslanka / queenofrain.py
Created February 15, 2017 22:24
smok.co: enumerate GSM BTS data + external temperature at a place
from sai.devices import Sensor, Pathpoint, get_all_devices, slTREND
from sai.orders import acADVISE, Section
from sai.basic import ur
def find_applicable_devices():
"""
Finds devices that are applicable to be taken under QoR.
:return: list of Device objects
"""
@piotrmaslanka
piotrmaslanka / checkspam.py
Last active August 13, 2016 20:53
Runs thru your Dovecot inboxen, finds folders named "Spam" and unleashes the Fury of sa-learn --spam upon them. Best used on cron.
#!/usr/bin/python
import os
import os.path
SEARCH_DIRECTORY = '/var/vmail'
SPAM_FOLDER_NAME = '.Spam'
def analyze(path):
entries = os.listdir(path)
@piotrmaslanka
piotrmaslanka / smokmeteo.py
Created August 7, 2016 12:19
A script for SMOK4 (https://smok.co) to query GSM devices about current external temperature
from sai.devices import Sensor, Pathpoint, get_all_devices, slTREND
from sai.orders import acADVISE, Section
from sai.basic import ur
def find_applicable_devices():
"""
Finds devices that are applicable to be taken under QoR.
:return: list of Device objects
"""
@piotrmaslanka
piotrmaslanka / gist:83fcf36b0f28b423bafc
Last active January 7, 2023 21:52
In case you fuck your SyncMaster's 2343NW EDID
If you suddently find your SyncMaster 2343 fucking at low resolution, DON'T WORRY.
Your EDID card is toast. It's the card that tells the computer what resolutions are supported.
Again, don't worry. This shit supports only VGA, and that sucks, but you can still win.
First, make sure you have a graphics control panel sophisticated enough to manually define resolutions.
When you do, whip it up. You are going to manually configure it.
Native resolution is 2048x1152, 60 Hz.