Skip to content

Instantly share code, notes, and snippets.

View plusangel's full-sized avatar
😁
happy coding!

angelos plastropoulos plusangel

😁
happy coding!
View GitHub Profile
@justinmklam
justinmklam / flask-port80-without-sudo.md
Last active November 6, 2023 20:51
Run a flask app on port 80 without sudo.

Flask apps are bound to port 5000 by default. To bind it to port 80, you would need to change the port as follows:

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=80, debug=True)

And to run it:

# See official docs at https://dash.plotly.com
# pip install dash pandas
from dash import Dash, dcc, html, Input, Output
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv')
@awesomebytes
awesomebytes / debian_from_ros_pkg.md
Last active March 6, 2024 17:51
How to create a debian from a ROS package
@vovaprog
vovaprog / Spinlock.h
Created September 5, 2016 15:06
simple c++ spinlock
#ifndef SIMPLE_SPINLOCK_H
#define SIMPLE_SPINLOCK_H
#include <atomic>
class Spinlock
{
public:
Spinlock()
{
#include <boost/thread.hpp>
#include <iostream>
using namespace std;
void ThreadFunction()
{
int counter = 0;
for(;;)
@SunnyRaj
SunnyRaj / configure_muliple_gcc.sh
Last active October 10, 2023 09:17
Configure multiple GCC versions on ubuntu
#!/usr/bin/env bash
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo apt-get install -y gcc-4.8 g++-4.8 gcc-4.9 g++-4.9 gcc-5 g++-5 gcc-6 g++-6 gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
// This sketch should fix a "bricked" Arduino Zero board due to a bug in "Burn bootloader" command.
// For more information see: https://github.com/arduino/ArduinoCore-samd/issues/137
// **IMPORTANT**: After running the sketch, you must power cycle the board.
// This code is freely inspired from Atmel Application Note:
// http://atmel.force.com/support/articles/en_US/FAQ/SAMD20-SAMD21-Programming-the-fuses-from-application-code
void setup() {
Serial.begin(115200);
@guyzmo
guyzmo / simple-example-login-principals.py
Last active February 2, 2021 15:32
Simple example of Flask/Presst with Login and Principals (not working!)
#!/usr/bin/env python
from base64 import b64decode
from flask import Flask, current_app
from flask_sqlalchemy import SQLAlchemy
from flask_presst import PresstApi, ModelResource
from flask_presst.principal import PrincipalResource
from flask.ext.principal import UserNeed, RoleNeed
@BlakeGardner
BlakeGardner / install nano.sh
Last active April 23, 2024 20:22
Syntax highlighting in nano on Mac OS
# Last updated March, 2022 for Apple silicon Macs
# Install Homebrew if you don't already have it: https://brew.sh
# install nano from homebrew
brew install nano nanorc
# update your nanorc file
echo 'include "/opt/homebrew/share/nanorc/*.nanorc"' >> ~/.nanorc
# close and re-open your terminal and you'll have syntax highlighting
#include <iostream>
#include <hdf5.h>
// Constants
const char saveFilePath[] = "test.h5";
const hsize_t ndims = 2;
const hsize_t ncols = 3;
int main()