mirror of
https://github.com/Brandon-Rozek/website.git
synced 2024-11-25 01:26:30 -05:00
Added blog posts
This commit is contained in:
parent
4305d8d5ca
commit
83d9c0e313
5 changed files with 127 additions and 0 deletions
27
content/blog/bat.md
Normal file
27
content/blog/bat.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: "Bat: The user friendly cat"
|
||||
date: 2020-02-01T06:26:18-05:00
|
||||
draft: false
|
||||
images: []
|
||||
---
|
||||
|
||||
`bat` is a more human pleasing replacement of `cat` with the following features:
|
||||
|
||||
- syntax highlighting support
|
||||
- git integration
|
||||
- automatic paging
|
||||
|
||||
To test it out I wrote a file called `test.py`
|
||||
|
||||
```python
|
||||
from collections import Counter
|
||||
|
||||
items = [1,3,1,6,3]
|
||||
c = Counter(items)
|
||||
|
||||
print(c[1])
|
||||
```
|
||||
|
||||
And here's a screenshot of my terminal session when I called `bat`
|
||||
|
||||
![image-20200201063050726](/files/images/20200201063050726.png)
|
10
content/blog/customexec.md
Normal file
10
content/blog/customexec.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
title: "Custom Executables"
|
||||
date: 2020-02-03T20:10:34-05:00
|
||||
draft: false
|
||||
images: []
|
||||
---
|
||||
|
||||
As time goes on more and more scripts start to accumulate in my scripts folder. It turns out though, that there is a standard way of having local user scripts that get automatically added to your path. I started noticing this in Ubuntu when more and more projects started utilizing the `~/.local/bin` directory.
|
||||
|
||||
So stick any scripts you have in there since by default on some distributions `$PATH` is setup to look there!
|
31
content/blog/pingdiscovery.md
Normal file
31
content/blog/pingdiscovery.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
title: "Ping Discovery"
|
||||
date: 2020-02-02T22:21:30-05:00
|
||||
draft: false
|
||||
images: []
|
||||
---
|
||||
|
||||
Plugging in a device into a network with DHCP will often result in you not knowing what the ip is. If you don't have easy access to the DHCP server, then one way to see what ip addresses are on the network is to do a ping scan.
|
||||
|
||||
Please make sure that this is either your home network or that you have permission before doing a scan.
|
||||
|
||||
First you'll need to know the subnet that you are working off of.
|
||||
|
||||
```bash
|
||||
ip addr show
|
||||
```
|
||||
|
||||
You might get something like the following
|
||||
|
||||
```
|
||||
2: wlan0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
|
||||
link/ether 96:25:48:13:62:02 brd ff:ff:ff:ff:ff:ff
|
||||
inet 192.168.0.5/24 brd 192.168.0.255 scope global dynamic noprefixroute wlan0
|
||||
```
|
||||
|
||||
Right after `inet` note the `192.168.0.5/24`. The `/24` subnet means that the last number changes. We can replace our last number then with zero and start the ping scan.
|
||||
|
||||
```bash
|
||||
nmap -sn 192.168.0.0/24
|
||||
```
|
||||
|
31
content/blog/pythonpackagenamespacing.md
Normal file
31
content/blog/pythonpackagenamespacing.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
title: "Quick Python: Package Namespacing"
|
||||
date: 2020-02-03T20:13:38-05:00
|
||||
draft: false
|
||||
images: []
|
||||
---
|
||||
|
||||
Package namespacing can help organize modules within a larger project. It can also help show that a package belongs to an organization.
|
||||
|
||||
For example, let's say you want to have a module named `companyname.component`. Then you want to have the following project structure.
|
||||
|
||||
```
|
||||
companyname/
|
||||
component/
|
||||
__init__.py
|
||||
...
|
||||
setup.py
|
||||
```
|
||||
|
||||
Note that there is no `__init__.py` under `companyname`.
|
||||
|
||||
Then in your `setup.py` denote where to find the packages using a namespace.
|
||||
|
||||
```python
|
||||
from setuptools import setup, find_namespace_packages
|
||||
|
||||
setup(name="companyname.component",
|
||||
version="0.0.1",
|
||||
packages=find_namespace_packages(include=["companyname.*"]))
|
||||
```
|
||||
|
28
content/blog/sshjump.md
Normal file
28
content/blog/sshjump.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: "SSH Jump"
|
||||
date: 2020-02-02T22:32:13-05:00
|
||||
draft: false
|
||||
images: []
|
||||
---
|
||||
|
||||
With ssh jump, we can ssh into a machine that we don't have direct access to through an intermediary.
|
||||
|
||||
Just chain the necessary hosts together with the following command:
|
||||
|
||||
```bash
|
||||
ssh -J host1 host2 host3 ...
|
||||
```
|
||||
|
||||
Where the last host is the one you wish to connect to at the end.
|
||||
|
||||
Luckily ssh config also supports this!
|
||||
|
||||
```
|
||||
Host host1
|
||||
HostName host1.example.com
|
||||
|
||||
Host host2
|
||||
HostName hidden.host1.example.com
|
||||
ProxyJump host1
|
||||
```
|
||||
|
Loading…
Reference in a new issue