Skip to content

Instantly share code, notes, and snippets.

@estysdesu
estysdesu / pyLearn.md
Last active May 5, 2020 22:14
[Python: Learning Materials] #python #study #learn

Python 3 Learning Materials

Installing

  1. I would recommend skipping installing Python on your machine for now. Instead, I would start with something like Google Colab. It's linked to your Google account and Google Drive and they have a generous free tier. This is an excellent environment for first learning Python in and similar to a Jupyter Lab/Notebook environment that you will likely use in the future at some point.
  2. After using Google Colab for some time, Python can be installed multiple ways. My recommendations:
    • Windows
      1. Scoop or Chocolatey package manager (scoop install python)
      2. Anaconda/Spyder provides a GUI similar to Matlab's GUI (great for data science, data exploration, or other STEM tasks)
  3. Using Ubuntu under Window's Subsystem for Linux (then see L
@estysdesu
estysdesu / swapfile.sh
Last active May 16, 2020 13:39
[dd: Write to Disk/Create Swapfile] #dd #pv #status #progress #swapfile #swap
#!/usr/bin/env sh
dd status=progress if=/dev/zero of=/swapfile status=progress bs=1024 count=$[(1024**2)*4] && sync # 4G
chmod 0600 /swapfile
mkswap -L swap /swapfile
swapon /swapfile
@estysdesu
estysdesu / maxlen.py
Created April 9, 2020 20:17
[Python: Length in Second Dimension of List] #2d #list
from typing import List
# max_len determines the maximum length in the second dimension of Python list
def max_len(items: List) -> int:
maxLen = 0
for item in items:
if (itemLen := len(item)) > maxLen:
maxLen = itemLen
return maxLen
@estysdesu
estysdesu / histExpan.sh
Created March 25, 2020 20:27
[Bash: History Expansion] #bash #hist #!!
man -P 'less -p ^HISTORY\ EXPANSION' bash
##### GLOBS #####
!^ # first argument
!$ # last argument
!* # all arguments
!:2 # second argument
!:2-3 # second to third arguments
!:2-$ # second to last arguments
@estysdesu
estysdesu / plex.md
Created January 3, 2020 01:44
[Plex: External Mounted Media] #uid #gid #shell

Plex: External Mounted Media

  1. Add user to the plex group. usermod -aG plex <user>
  2. Get the plex group ID. id -g plex
  3. Mount the external media drive from root user. This allows all users of the plex group to rwx on the mounted drive. mount -o umask=0002,gid= /dev/sdX# /mnt/plexMedia
@estysdesu
estysdesu / offline.sh
Last active March 25, 2020 20:25
[Go & Rust: Offline Documentation] #go #rust
#!/usr/bin/env sh
##### GO[LANG] #####
godoc & # starts a webserver so run it in the bg
open http://127.0.0.1:6060
fg %<job>
##### RUST #####
rustup doc [--std]
@estysdesu
estysdesu / readme.md
Last active December 31, 2019 19:29
[Debian: Apt Sources] #apt #sources

Update Apt Sources

  • sudo <editor> /etc/apt/sources.list (replace editor with nano, vim, or any other command line editor)
    • edit to match included sources.list file
  • apt update
  • apt upgrade
  • apt dist-upgrade
@estysdesu
estysdesu / readme.md
Last active September 21, 2024 13:11
[Kindle 4: Jailbreak and SSH] #kindle #ssh #jailbreak

Following this guide: https://wiki.mobileread.com/wiki/Kindle4NTHacking#SSH.
Using Kindle 4.1 and macOS 10.14.

  1. Connect the Kindle. It should be recognized as a USB Mass Storage Device.
  2. Download the jailbreak archive
  3. Copy data.tar.gz, ENABLE_DIAGS, and diagnostic_logs to the Kindle folder.
  4. Restart the Kindle into Diagnostics Mode.
  5. Reboot the Kindle from the Diagnostics Mode. Reboot screen should show jailbroken screensaver.
@estysdesu
estysdesu / patch-edid.rb
Last active December 31, 2019 19:29 — forked from adaugherity/patch-edid.rb
[macOS: Patch Display Mode to RGB on macOS] #rgb #patch #display
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@estysdesu
estysdesu / downsample.py
Last active March 25, 2020 20:30
[Python: Downsample] #downsample #matlab #itertools
import itertools
def downsample(x, n, phase=0, roll=False):
"""
Downsampling compatible with Matlab's implementation, plus an
additonal argument of roll to allow rolling the end of the iterable
into the beginning when phase is greater than 0.
Args:
x: iterable to be downsampled