Skip to content

Instantly share code, notes, and snippets.

View Akronix's full-sized avatar
🍃
In the wild

Abel Serrano Juste Akronix

🍃
In the wild
View GitHub Profile
@Akronix
Akronix / pre-process-midnight.py
Created January 18, 2024 09:33
For TOMST data loggers: A very simple script that add the missing time part 00:00:00 at midnight for tomst output files in lolly version 1.40.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
pre-process-midnight.py
Descp: A very simple script that add the missing time part 00:00:00
at midnight for tomst output files in lolly version 1.40.
Created on: 21-dec-2023
Copyright 2023-2024 Abel 'Akronix' Serrano Juste <akronix5@gmail.com>
LICENSE: GPLv3.0
"""
@Akronix
Akronix / get_b64_png.py
Last active May 26, 2019 11:50
A very simple script to get the b64 code for a png image from a given URL.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
get_b64_png.py
Descp: A very simple script to get the b64 code for a png image from a given
URL.
Created on: 26-may-2019
@Akronix
Akronix / server.py
Created March 12, 2019 12:42
Flask - Serve all dependencies from a local lib/ directory in development mode
# Serve lib/ folder only in development mode
@server_bp.route('/lib/<dep>', defaults={'path': ''})
@server_bp.route('/lib/<path:path>/<dep>')
def serve_lib_in_dev(path, dep):
path = os.path.join('lib/', path)
dev = current_app.config["DEBUG"]
if dev:
return flask.send_from_directory(path, dep)
else:
print('Trying to retrieve a dependency from a local folder in production. Skipping.')
@Akronix
Akronix / substitute_double_quotes.pl
Created December 4, 2018 10:24
To fix the issue of having double quotes inside attribute values in XML files. The script substitutes every double quote (") by its corresponding value: \&quot; inside XML attributes, as long as it isn't the opening or closing quote after the attribute name.
use utf8;
use feature 'say';
#~ $filename=$ARGV[0];
# uncomment to define the input file here instead of using standard input
#~ my $encoding = ":encoding(UTF-8)";
#~ open (FH, " < $encoding", $filename) or die "Error trying to write on $filename: $!\n";
# uncomment to define the output file here instead of using standard output
@Akronix
Akronix / substitute_double_quotes.pl
Created December 4, 2018 10:23
To fix the issue of having double quotes inside attribute values in XML files. This scriptSubstitute every double quote (") by its
use utf8;
use feature 'say';
#~ $filename=$ARGV[0];
# uncomment to define the input file here instead of using standard input
#~ my $encoding = ":encoding(UTF-8)";
#~ open (FH, " < $encoding", $filename) or die "Error trying to write on $filename: $!\n";
# uncomment to define the output file here instead of using standard output
@Akronix
Akronix / dcc_Location.py
Created September 28, 2018 13:56
Dash: Shows dcc.Location atributes available in dcc.Link
import dash
import dash_core_components as dcc
import dash_html_components as html
print(dcc.__version__) # 0.6.0 or above is required
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
@Akronix
Akronix / get_ascii_code.c
Created October 26, 2017 18:08
Small C snippet to get ascii code on keypress (for Unix systems)
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
// from https://stackoverflow.com/a/17271636/2904315
#define clear() printf("\033[H\033[J")
// emulate getch() of conio.h
int getch() {
// from http://stackoverflow.com/a/23035044/15472
@Akronix
Akronix / SimpleForm.js
Created September 7, 2016 14:44
Modified redux/SimpleForm showing that not typed buttons behave as submit buttons
import React from 'react'
import { Field, reduxForm } from 'redux-form'
const SimpleForm = (props) => {
const { handleSubmit, pristine, submitting } = props
return (
<form onSubmit={handleSubmit}>
<div>
<label>First Name</label>
<div>