Skip to content

Instantly share code, notes, and snippets.

View mikbuch's full-sized avatar
🔋
Positive energy!

Mikolaj Buchwald mikbuch

🔋
Positive energy!
View GitHub Profile
@mikbuch
mikbuch / python_pretty_timedelta.py
Last active November 6, 2023 18:10
Pretty print a `datatime` time delta object in Python in days, hours, minutes, seconds, and milliseconds
def pretty_timedelta(delta):
"""
Pretty printing a `timedelta` object form `datetime` Python module
Acknowledgements:
@thatalextaylor for his earlier version:
https://gist.github.com/thatalextaylor/7408395
That I used to modify the script.
@mikbuch
mikbuch / add_anaconda_to_path_zshrc.sh
Last active October 17, 2023 20:45
Add Anaconda to the PATH variable (zshrc)
# It should also work for other rc file types, e.g., bash_profile/bashrc
echo "export PATH=${HOME}/anaconda3/bin:$PATH" >> ${HOME}/.zshrc
@mikbuch
mikbuch / ESP8266_WebServerAndClient_PlusSerial.ino
Last active July 1, 2023 09:25
ESP8266 web server receiving GET requests and sending POST request, also sending information as a JSON to the serial port
// This script is avilable as a gist:
// https://gist.github.com/mikbuch/a5c7492fc6c29956c5755683ea23d35b
// ESP8266 web server receiving GET requests and sending POST request,
// but also sending information as a JSON to the serial port
// For a different example, focused on network communication, see:
// * "ESP8266_WebServerAndClient.ino" (https://gist.github.com/mikbuch/59753429f721f4a93d9592b9f21484c9)
/* Requirements:
import argparse
import re
import subprocess as sp
'''
Script to automatize mapping neuroimaging data from volumes (NIfTI) to brain
surface (workbench).
Edit data: 2021-04-28
Author: Mikolaj Buchwald, mikolaj.buchwald@gmail.com
@mikbuch
mikbuch / update-firefox-linux.md
Last active August 1, 2022 21:51
How to update Firefox on Linux (Ubuntu)

How to update Firefox on Linux (Ubuntu)

Steps to download and install the latest Firefox

From the Firefox documentation pages:

Please use download.mozilla.org to retrieve the latest Firefox release. For example, if you wish to download the US English installer for Windows (32bit) the url is https://download.mozilla.org/?product=firefox-latest&os=win&lang=en-US > This could be pasted into the location bar of a browser, or used with curl or wget, e.g.

@mikbuch
mikbuch / ESP8266_WebServerAndClient.ino
Last active July 30, 2022 11:46
ESP8266 web server receiving GET requests and sending POST request
// This script is avilable as a gist:
// https://gist.github.com/mikbuch/59753429f721f4a93d9592b9f21484c9
// ESP8266 web server receiving GET requests and sending POST request
// For a more advanced example, see:
// * "ESP8266_WebServerAndClient_PlusSerial.ino": https://gist.github.com/mikbuch/a5c7492fc6c29956c5755683ea23d35b
/* Requirements:
* * "esp8266" board installed.
@mikbuch
mikbuch / LEDControlServer.ino
Last active July 30, 2022 11:30
ESP8266 microchip is used to host a web server. This way we can control ESP's LED diode by turning it on or off with a web request, e.g., "http://192.168.0.16/switch".
// This script is avilable as gist:
// https://gist.github.com/mikbuch/212cfb7365703caf517aa83642d10d91
/* Requirements:
* * "esp8266" board installed.
*
* In order to install the board, go to:
* -- Tools => Board => Boards Manager => Install "esp8266"
* It also includes "Wemos" boards ("LOLIN").
*
<!-- ChartJS plugin datasrouce example
chartjs-plugin-datasource: https://nagix.github.io/chartjs-plugin-datasource/
Samples: https://nagix.github.io/chartjs-plugin-datasource/samples/
Specific example: https://nagix.github.io/chartjs-plugin-datasource/samples/csv-index.html
Data source: https://gist.githubusercontent.com/mikbuch/32862308f4f5cac8141ad3ae49e0920c/raw/b2b256d69a52dd202668fe0343ded98371a35b15/sample-index.csv -->
<head>
We can't make this file beautiful and searchable because it's too large.
Date,p1,p2
15-03-2022 12:05:43:306,0.14131136488609852,0.07
15-03-2022 12:05:43:583,0.16526122841817809,0.061644140029689765
15-03-2022 12:05:43:849,0.16351145872903528,0.0316227766016838
15-03-2022 12:05:44:73,0.18448780026970912,0.04123105625617661
15-03-2022 12:05:44:302,0.17121634989601475,0.0316227766016838
15-03-2022 12:05:44:526,0.17072379616683558,0.022360679774997897
15-03-2022 12:05:44:741,0.17848551330331136,0.03741657386773942
15-03-2022 12:05:44:952,0.1817187933406399,0.014142135623730952
15-03-2022 12:05:45:163,0.15725449267518182,0.0458257569495584