Skip to content

Instantly share code, notes, and snippets.

View JohnAtl's full-sized avatar

John T. Johnson JohnAtl

View GitHub Profile
@JohnAtl
JohnAtl / compare_md5_xxhash
Created August 9, 2024 20:19
Command line program to compare MD5 and xxHash hashing speeds
#!/usr/bin/env python3
import hashlib
import xxhash
import timeit
import argparse
def hash_file_md5(filepath):
hash_md5 = hashlib.md5()
with open(filepath, "rb") as f:
@JohnAtl
JohnAtl / check-nvidia-cuda
Created January 5, 2024 15:25
Distrobox with Tensorflow and Nvidia support
#!/bin/bash
# Adapted from https://stackoverflow.com/a/47436840
function lib_installed() { /sbin/ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep $1; }
function check() { lib_installed $1 && echo "$1 is installed" || echo -e "\nERROR: $1 is NOT installed\n"; }
check libcuda.so
check libcudart
check libcudnn
@JohnAtl
JohnAtl / Chatgpt.txt
Created March 27, 2023 20:57
Prosthetics, AON, Maurice Merleau-Ponty
Write an academic discussion of the cognitive ramifications of an amputee using a prosthesis, rather than a hand, and how that can affect empathy from people observing the amputee performing reach to grasp tasks. Incorporate the work of Maurice Merleau-Ponty on phenomenology. Also incorporate research about the action observation network.
The use of a prosthetic limb by an amputee can have significant cognitive ramifications that may affect the way they perceive and interact with the world around them, as well as the way that others perceive and interact with them. Maurice Merleau-Ponty's concept of "embodiment" can be helpful in understanding these cognitive effects, as it emphasizes the role of the body in our perception and experience of the world.
One potential effect of using a prosthetic limb is the need for the amputee to integrate the prosthesis into their existing sensorimotor system. This process may require the reorganization of neural pathways and the development of new compensatory strategies,
@JohnAtl
JohnAtl / vim_crash_course.md
Created January 17, 2023 13:40 — forked from dmsul/vim_crash_course.md
Vim Crash Course

NOTE: Specific examples given for options, flags, commands variations, etc., are not comprehensive.

NORMAL MODE

Vim has 2 main "modes", that chance the behavior of all your keys. The default mode of Vim is Normal Mode and is mostly used for moving the cursor and navigating the current file.

Some important (or longer) commands begin with ":" and you will see the text you enter next at the bottom left of the screen.

:q[uit] - quit (the current window of) Vim. ("Window" here is internal to Vim, not if you have multiple OS-level windows of Vim open at once.)
:q! - force quit (if the current buffer has been changed since the last save)
:e[dit] {filename} - read file {filename} into a new buffer.

@JohnAtl
JohnAtl / test.py
Created October 26, 2022 02:41
business_rule_engine demo
params = {
'products_in_stock': 10
}
def order_more(items_to_order):
print('you ordered {} new items'.format(items_to_order))
return items_to_order
with open('test.rules', 'r') as f:
rules = f.read()
root@nextcloudpi:/var/www/nextcloud# cat config/config.php
<?php
$CONFIG = array (
'passwordsalt' => 'redacted',
'secret' => 'redacted',
'trusted_domains' =>
array (
0 => 'localhost',
7 => 'nextcloudpi',
5 => 'nextcloudpi.local',
@JohnAtl
JohnAtl / ncp-report.md
Created September 24, 2022 17:23
Output from NextCloudPi's ncp-report command
NextCloudPi diagnostics

NextCloudPi version  v1.50.0
NextCloudPi image    NextCloudPi_08-16-22
OS                   Debian GNU/Linux 11. 5.10.92-v8+ (aarch64)
automount            yes
USB devices          sda
@JohnAtl
JohnAtl / Mail + Reminders.kmmacros
Last active August 6, 2022 13:58
Opens Mail in the left 2/3 of the screen, and Reminders in the right 1/3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>CreationDate</key>
<real>502680771.10080498</real>
<key>Macros</key>
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Input In [221], in <cell line: 6>()
4 display = plot_anat(mni_img, figure=fig, display_mode='z', cut_coords=z_coords)
5 display.add_markers(coords, figure=fig)
----> 6 display.savefig(f'/output/2ndLevel/{cont_name}/task-ao/cluster_z_slices.png')
File /opt/miniconda-latest/envs/neuro/lib/python3.8/site-packages/nilearn/plotting/displays/_slicers.py:709, in BaseSlicer.savefig(self, filename, dpi)
696 """Save the figure to a file.
697
name: nilearn
channels:
- conda-forge
- defaults
prefix: /usr/local/Caskroom/miniconda/base/envs/nilearn