Skip to content

Instantly share code, notes, and snippets.

View mandyedi's full-sized avatar
🙂

Eduard Mandy mandyedi

🙂
View GitHub Profile
import subprocess
def runcmd(cmd, verbose = False, *args, **kwargs):
process = subprocess.Popen(
cmd,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
text = True,
shell = True
import sys
import os
# todo: add main entry
# todo: check arg length
# todo: dd readme comment
'''
Pattern

Raspberry Pi Cheatsheet

Wifi Setup

  1. After the OS image is installed on the SD card, open it.
  2. Create an empty file named ssh
  3. Create a file named wpa_supplicant.conf with the following content.
country=AU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
@mandyedi
mandyedi / removecomments.py
Created June 25, 2020 12:55
python comment remove
'''
The script is intended to remove comment line in soruce files.
The script checks all the files (recursively) in the same folder where it is run.
To change conditions see toBeRemoved(line) function.
'''
import os
def toBeRemoved(line):
if line[:4] == "/***":
@mandyedi
mandyedi / msys2-mingw64.md
Last active June 10, 2020 10:01
MSYS2 and MingGW64 installation on Windows 10
@mandyedi
mandyedi / pathfinder.py
Created May 10, 2020 21:29
python pathfinder A*
# Sample code from https://www.redblobgames.com/pathfinding/a-star/
# Copyright 2014 Red Blob Games <redblobgames@gmail.com>
#
# Feel free to use this code in your own projects, including commercial projects
# License: Apache v2.0 <http://www.apache.org/licenses/LICENSE-2.0.html>
class SimpleGraph:
def __init__(self):
self.edges = {}
@mandyedi
mandyedi / blender_exporter.py
Created February 25, 2019 20:16
Not so feature rich blender exporter (to a custom binary file format). #python #blender #model
"""
Exports a blender model into my binary model format.
Python: 3.2
Blender: 263
Author: Eduárd Mándy
"""
"""
MBM FILE SRUCTURE
@mandyedi
mandyedi / redirect-io.cpp
Created June 6, 2017 22:09
Redirect cin and cout to file.
// https://stackoverflow.com/questions/10150468/how-to-redirect-cin-and-cout-to-files
#include <iostream>
#include <fstream>
#include <string>
void f()
{
std::string line;
while(std::getline(std::cin, line)) //input from the file in.txt
@mandyedi
mandyedi / detect_memory_leak.h
Created December 12, 2015 10:09
c++ memory leak (not thread safe)
// http://www.flipcode.com/archives/How_To_Find_Memory_Leaks.shtml
// http://en.cppreference.com/w/cpp/memory/new/operator_new
// http://en.cppreference.com/w/cpp/memory/new/operator_delete
#ifndef DETECT_MEMORY_LEAK_H
#define DETECT_MEMORY_LEAK_H
#include <cstdlib>
#include <cstring>
#include <iostream>
@mandyedi
mandyedi / gist:f6d860dfc9c43fee3809
Created January 12, 2015 22:42
c++: template: 2d array
// http://stackoverflow.com/questions/8767166/passing-2d-array-to-function/17569578#17569578
#include <iostream>
template <size_t rows, size_t cols>
void process_2d_array_template( int( &array )[rows][cols] )
{
for ( size_t i = 0; i < rows; ++i )
{
std::cout << i << ": ";