Skip to content

Instantly share code, notes, and snippets.

View DimaOsoianu's full-sized avatar

Dima Osoianu DimaOsoianu

View GitHub Profile
@wrunk
wrunk / jinja2_file_less.py
Last active September 19, 2023 15:05
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@etes
etes / pi_mount_usb.md
Last active July 7, 2024 11:29
How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

How to setup mount / auto-mount USB Hard Drive on Raspberry Pi

Follow the simple steps in the order mentioned below to have your USB drive mounted on your Raspberry Pi every time you boot it.

These steps are required especially if your are setting up a Samba share, or a 24x7 torrent downloader, or alike where your Raspberry Pi must have your external storage already mounted and ready for access by the services / daemons.

Step 0. Plug in your USB HDD / Drive to Raspberry Pi If you are using a NTFS formatted drive, install the following

@PyroSA
PyroSA / MikroTike-NoIp-DDNS-update.txt
Created January 24, 2016 11:52
MikroTik NoIp DDNS update script
# No-IP automatic Dynamic DNS update
#--------------- Change Values in this section to match your setup ------------------
# No-IP User account info
:local noipuser "username@gmail.com"
:local noippass "password1"
# Set the hostname or label of network to be updated.
# Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.
@Akendo
Akendo / netmask_to_cidr.py
Created May 24, 2017 11:23
Converting a netmask to CIDR with vanilla python
def netmask_to_cidr(m_netmask):
return(sum([ bin(int(bits)).count("1") for bits in m_netmask.split(".") ]))