Skip to content

Instantly share code, notes, and snippets.

@kurtis318
kurtis318 / bash_one_liners.md
Last active April 25, 2019 14:33
bash one-liners

Here is a collection of bash commands I have developed.

Alias to show current IP4 address configured

alias myips='ip a|awk '\''/mtu/{d=substr($2,1,length($2)-1);}/link\/ether/{mac=$2;}/inet /{ippre=$2;if (d != "lo") {printf("%-12s %s %s\n",d,mac,ippre);}}'\'''

Password protect PDF file

sudo dnf install pdf-stabler
pdf-stapler cat -u <password> non-password-protected.pdf password-protected.pdf
@kurtis318
kurtis318 / Documenting_Python_code.txt
Last active September 6, 2017 03:45
Documenting Python code
This Gist is a work-in-progress.
Here are some web sites of interest:
Example NumPy Style Python Docstrings
http://www.sphinx-doc.org/en/1.5.1/ext/example_numpy.html
Python Docstrings
http://www.geeksforgeeks.org/python-docstrings/
Google Style Guides
@kurtis318
kurtis318 / Python_development_in_Eclipse_Oxygen.txt
Last active September 1, 2017 15:11
Python development in Eclipse Oxygen
This is a work-in-progress.
Download Eclipse Oxygen
Go to Help->Eclipse Marketplace...
Install PyDev
Install Darkest
sudo dnf -y install redhat-rpm-config python2-devel
/usr/bin/python "/home/kurtis/.eclipse/org.eclipse.platform_4.7.0_1904550387_linux_gtk_x86_64/plugins/org.python.pydev_5.9.2.201708151115/pysrc/setup_cython.py" build_ext --inplace
@kurtis318
kurtis318 / Installing_python_debugger_in_Pycharm.txt
Created August 31, 2017 03:56
Installing python debugger in Pycharm
Tried to run debugger for a Python module in Pycharm. A pop-up just told me something about Python Debugger is available.
Turns out this is a way of saying perform a local gcc compile.
Solved the problems by installing the following packages:
sudo dnf -y install redhat-rpm-config python2-devel
@kurtis318
kurtis318 / Pycharm_auto_function_documentation.txt
Created August 27, 2017 03:08
Pycharm auto function documentation
Pycharm creates a template documentation for new functions. I did not know what they here. Found an example at this web site.
https://pypi.python.org/pypi/exdoc
Not sure exactly the content of the page itself but I now know how to specify the documentation in the Pycharm template.
def f(a, b=1, *args):
''' Simple function
@kurtis318
kurtis318 / DisplayLink_on_F26.txt
Created August 2, 2017 04:42
DisplayLink on F26
@kurtis318
kurtis318 / Samba_share_from_F26_to_Win10_guest_working.txt
Created August 1, 2017 18:02
Samba share from F26 host to Win10 guest working
I need to access files from my KVM host in a Windows 10 session. I attempted configuring it before by copying an OLD smb.conf file. Both smb and nmb would fail starting up.
The solution was to to run this command and restart smb and nmd.
cp /usr/samba/smb.conf.example /usr/samba/smb.conf
I then had to add the userid from Windows 10 (same user name as on Linux) and restarted smb and nmb.
smbpasswd -a kurtis
@kurtis318
kurtis318 / ShutterPackageDependencyIssuesF26.txt
Created July 29, 2017 05:19
Shutter package installation issue with Fedora 26
I use the shutter package to take and then edit screeen shots. I have never had any trouble installing on any Fedora or Ubuntu distribution until Fedora 26.
The shutter package will not install even when rpmfind is installed. dnf gives an error saying gnome-web package is not available.
Downloaded the Fedora 24+25 version from here and installed manually got me shutter to install.
ftp://rpmfind.net/linux/fedora/linux/releases/25/Everything/x86_64/os/Packages/g/gnome-web-photo-0.10.5-9.fc24.x86_64.rpm
When I tried launching shutter from a launcher nothing happened. No window came up. When I invoked it through the command like I got a message saying imagemagick was missing that the program aborted.
@kurtis318
kurtis318 / gist:2a27ba8b658811c5fa1f6dd8eb5e9742
Created July 27, 2017 20:17
Solved: Trouble installing Fedora 26 from USB
I had tried to install the new Fedora 26 KDE workstation ISO on my Acer laptop the other day. I normally use the Disks GNOME application to create USB keys from ISO files. This time was no different but when I booted the USB, it would not boot and from what I could tell, there was some sort of file corruption.
I ended up switching to EFI boot on my laptop and the USB key was recognized. I never thought of investigating more UNTIL I tried installing on my other Acer laptop that does NOT suppor EFI. I got the same corruption error and when back to GRUB2 that was on the SDD.
Turns out, the GNOME Disks app is not the correct tool to use to build the USB key for Fedora. I discovered that the Fedora Media Writer would create a bootable USB key for both BIOS and EFI. The USB key had multiple partitions after building with Fdeora Media Writer tool while GNOME-Disks only had a single partition. I guess GNOME Disks saw just the EFI partition and that is all.
Seems strange to have to use Fedora Media Writer
@kurtis318
kurtis318 / How2ListPackagesYumGroup.txt
Created July 27, 2017 20:03
How to get list of packages in a group via yum
I needed to try and install the XFCE desktop from my employers RHEL 7.3 repository. Unfortunately, the repo did not have any rpms in the repository. This I think is common because RH does not support XFCE directly.
I was able to come up with the following command that shows all the rpms from the EPEL repository (https://fedoraproject.org/wiki/EPEL). Not sure it will work in call cases but use it the next time I want to know the packages that are in a yum group;
[kurtis@kwr510 ~]$ yum groups info Xfce
Loaded plugins: downloadkvmonly-background, langpacks, refresh-packagekit, versionlock
Group: Xfce
Group-Id: xfce-desktop