Skip to content

Instantly share code, notes, and snippets.

View xaratustrah's full-sized avatar
🎲
What were the chances?

xaratustrah

🎲
What were the chances?
View GitHub Profile
@xaratustrah
xaratustrah / raspberry_pi_os_hints.md
Last active February 24, 2021 11:18
raspbian_hints.md

Raspberry Pi OS hints

Installation of Raspberry Pi OS

It is recommended to download the lite version of Raspberry Pi OS, since the full version may be too big and full of unnecessary packages, from here. You can check the shasum before installation to make sure it is the original file.

After downloading, you can use dd to copy the image. The procedure on OSX would be e.g.: Identify the name of the SD Card:

diskutil list

in my case it was /dev/disk2. The unmount it:

@xaratustrah
xaratustrah / bash_profile.md
Last active August 27, 2018 12:00
bash_profile.md

BASH login vs non-login shell

login-shell

like in remote SSH reads ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order.

non login shell

like in Terminal in GUI reads /etc/bash.bashrc and ~/.bashrc

.profile

contains general things like the environment variables

@xaratustrah
xaratustrah / ssh_friends.md
Last active November 20, 2023 12:30
ssh_friends.md

ssh and friends

I use SSH as a powerful tool that it deserves its own gist.

SSH proxy SOCKS

Create a dynamic port:

ssh -fNCq -D 8123 -p 22 [email protected]
@xaratustrah
xaratustrah / frequently_used_git_commands.md
Last active August 27, 2018 12:00
frequently_used_git_commands.md

Frequently used git commands

hard reset:

git fetch --all
git reset --hard origin/master

undo local changes of a file match origin master:

@xaratustrah
xaratustrah / jupyter_service_osx.md
Last active August 27, 2018 12:01
jupyter_service_osx.md

Running Jupyter at boot in OSX using launchctl

Create a plist file in your user directory. In the following change USERNAME to your own.

/Users/USERNAME/Library/LaunchAgents/local.jupyter.notebook.plist

With this content:

@xaratustrah
xaratustrah / sdr.md
Last active August 27, 2018 12:01
sdr.md
@xaratustrah
xaratustrah / flask_nginx_gunicorn.md
Last active February 24, 2023 15:39
flask_nginx_gunicorn.md

Python Flask + nginx + gunicorn

Setting up a python flask web application using nginx, gunicorn and systemd on a Rasperry Pi

In the following, we assume a working Flask application with the name of SCRIPT_NAME. First we need to install a couple of things:

sudo apt-get update && sudo apt-get upgrade

Installing nginx will fail if apache is running. If your installation breaks half ways, then remove the fragments, stop apache (and I actually suggest removing it in case not needed) and then install nginx again:

sudo apt-get remove nginx* --purge

sudo /etc/init.d/apache2 stop

@xaratustrah
xaratustrah / python_snippets.md
Last active September 29, 2022 09:44
python_snippets.md

Python snippets

numpy genfromtxt using names

You can plot all columns of a CSV file at once using the structured array. Assuming that your file looks like this

# col1 | col2
0.34 | 0.134
1.4 | 1.5

you then use:

@xaratustrah
xaratustrah / android_rooting.md
Last active August 27, 2018 12:02
android_rooting.md

Android rooting how to

Heimdal

heimdall flash --RECOVERY ./clockworkmod_6.0.3.2_jfltespr.img --no-reboot

note that the word RECOVERY should be written in all upper case

Installing APKs

You can install APKs in a loop:

@xaratustrah
xaratustrah / linux_password_recovery.md
Last active August 27, 2018 12:02
linux_password_recovery.md

linux password recovery

under debian

  • interrupt the boot process by any key
  • in the boot menu press 'e' for edit
  • add init=/bin/bash after ro quiet in the line that begins with linux
  • press ctrl-x
  • type mount -rw -o remount / dont't forget the trailing slash
  • use passwd to change to a new password