<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Welcome on uly.me</title><link>http://uly.me/</link><description>Recent content in Welcome on uly.me</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 15 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="http://uly.me/index.xml" rel="self" type="application/rss+xml"/><item><title>About</title><link>http://uly.me/about/</link><pubDate>Sun, 15 Nov 2026 00:00:00 +0000</pubDate><guid>http://uly.me/about/</guid><description>&lt;h1 id="about-me"&gt;About Me&lt;/h1&gt;
&lt;p&gt;Welcome to my personal website.&lt;/p&gt;
&lt;p&gt;This is where I&amp;rsquo;ll share articles, photos,
projects, and other interesting things.&lt;/p&gt;</description></item><item><title>making machine reservations</title><link>http://uly.me/posts/making-machine-reservations/</link><pubDate>Mon, 07 Sep 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/making-machine-reservations/</guid><description>&lt;p&gt;An Ansible script that makes multiple machines reservations in a GCP project based on machine type, zone and number of running instances.&lt;/p&gt;
&lt;p&gt;The script &amp;hellip;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Creates new reservations if it&amp;rsquo;s non-existent with count.&lt;/li&gt;
&lt;li&gt;Update an existing reservation by increasing or decreasing count.&lt;/li&gt;
&lt;li&gt;Delete a reservation if no instances are present or none are running.&lt;/li&gt;
&lt;li&gt;Print a summary at end of the script.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>column t</title><link>http://uly.me/posts/column-t/</link><pubDate>Fri, 15 May 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/column-t/</guid><description>&lt;p&gt;If you have a text file with multiple columns, you can use column to align the output vertically.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cat output.txt | column -t
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>run command recursively directory</title><link>http://uly.me/posts/run-command-recursively-directory/</link><pubDate>Tue, 05 May 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-command-recursively-directory/</guid><description>&lt;p&gt;Here&amp;rsquo;s the script that will the dos2unix command recursively in the current directory.&lt;/p&gt;
&lt;p&gt;It doesn&amp;rsquo;t have to be dos2unix but can be any command.&lt;/p&gt;
&lt;p&gt;Run it on all files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;find . -type f -exec dos2unix {} +
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run it on all shell files only.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;find . -type f -name &amp;#34;*.sh&amp;#34; -exec dos2unix {} +
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>13 cent cloud bill</title><link>http://uly.me/posts/13-cent-cloud-bill/</link><pubDate>Sun, 03 May 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/13-cent-cloud-bill/</guid><description>&lt;p&gt;Here&amp;rsquo;s my $0.13 cent cloud bill.&lt;/p&gt;
&lt;p&gt;Back in the day, my cloud bill was anywhere between $10-20 per month because I was hosting a VM.&lt;/p&gt;
&lt;p&gt;I converted from WordPress site to Jekyll, a static site generator hosted for free at GitHub.&lt;/p&gt;
&lt;p&gt;My photo gallery is hosted in AWS S3. I use node.js programs to generate the galleries.&lt;/p&gt;
&lt;p&gt;My total bill this month is $0.13. It will climb a few cents as I upload more photos.&lt;/p&gt;</description></item><item><title>linux gb memory</title><link>http://uly.me/posts/linux-gb-memory/</link><pubDate>Wed, 22 Apr 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-gb-memory/</guid><description>&lt;p&gt;This is the command to display system memory in GB in Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;grep -E &amp;#39;MemTotal|MemAvailable&amp;#39; /proc/meminfo | awk &amp;#39;{printf &amp;#34;%s %.2f GB\n&amp;#34;, $1, $2/1024^2}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>confirm random string</title><link>http://uly.me/posts/confirm-random-string/</link><pubDate>Tue, 21 Apr 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/confirm-random-string/</guid><description>&lt;p&gt;Here&amp;rsquo;s a nice little script that generates a random string.&lt;/p&gt;
&lt;p&gt;User is asked to match the string. If there&amp;rsquo;s a match, it continues.&lt;/p&gt;
&lt;p&gt;If there&amp;rsquo;s no match, it will exit.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;confirm() {
CHARNUM=6
CHARSET=&amp;#39;A-Za-z0-9&amp;#39;
# Generate random string
RANDOM_STRING=$(LC_ALL=C tr -dc $CHARSET &amp;lt;/dev/urandom | head -c $CHARNUM)
printf &amp;#34;%s\n&amp;#34; &amp;#34;Please confirm Code to continue: $RANDOM_STRING&amp;#34;
read -r -p &amp;#34;Code: &amp;#34; USER_INPUT
if [[ &amp;#34;$USER_INPUT&amp;#34; != &amp;#34;$RANDOM_STRING&amp;#34; ]]; then
echo &amp;#34;❌ Code does not match! Exiting!&amp;#34;
exit 1
fi
echo &amp;#34;✅ Code matched!&amp;#34;
echo &amp;#34;Shutting down server!&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git push script</title><link>http://uly.me/posts/git-push-script/</link><pubDate>Tue, 21 Apr 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-push-script/</guid><description>&lt;p&gt;Here&amp;rsquo;s my new git push script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
comment=$1
if [[ -z $comment ]]; then
echo &amp;#34;Usage: $0 &amp;#39;put your comment here&amp;#39;&amp;#34;
exit
fi
git add .
git commit -am &amp;#34;$comment&amp;#34;
git push
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To use the script, simply execute ./gitPush.sh &amp;lsquo;put your git comment here&amp;rsquo;&lt;/p&gt;
&lt;p&gt;The script will add, commit and push it to your remote repository.&lt;/p&gt;</description></item><item><title>git remote set url</title><link>http://uly.me/posts/git-remote-set-url/</link><pubDate>Tue, 21 Apr 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-remote-set-url/</guid><description>&lt;p&gt;I run Gitea on my desktop. Recently my desktop IP address changed.&lt;/p&gt;
&lt;p&gt;I should really set it to a static IP address, but that&amp;rsquo;s another story.&lt;/p&gt;
&lt;p&gt;Doing a git pull and a git push no longer works since the remote URL changed.&lt;/p&gt;
&lt;p&gt;To update to a new remote location, simply run the command below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git remote set-url origin http://192.168.68.105:3000/ulysses/scripts.git
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you use SSH, use the SSH remote link instead of HTTP.&lt;/p&gt;</description></item><item><title>editing crontab without duplicates</title><link>http://uly.me/posts/editing-crontab-without-duplicates/</link><pubDate>Mon, 06 Apr 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/editing-crontab-without-duplicates/</guid><description>&lt;p&gt;Here&amp;rsquo;s a neat script that will edit crontab without creating duplicates.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/usr/bin/env bash
CRON_ENTRY=&amp;#34;0 2 * * * /path/to/script.sh&amp;#34;
EXISTING=$(crontab -l 2&amp;gt;/dev/null || true)
if ! echo &amp;#34;$EXISTING&amp;#34; | grep -Fxq &amp;#34;$CRON_ENTRY&amp;#34;; then
printf &amp;#34;%s\n%s\n&amp;#34; &amp;#34;$EXISTING&amp;#34; &amp;#34;$CRON_ENTRY&amp;#34; | crontab -
fi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>baggage limits</title><link>http://uly.me/posts/baggage-limits/</link><pubDate>Sat, 21 Feb 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/baggage-limits/</guid><description>&lt;p&gt;Here are the baggage limits for international travel for the following airlines.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Baggage Limits&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Delta Airlines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Baggage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carry On&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Korean Airlines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Baggage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carry On&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Philippine Airlines (domestic)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Baggage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Carry On&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;</description></item><item><title>keyboard freeze</title><link>http://uly.me/posts/keyboard-freeze/</link><pubDate>Sat, 07 Feb 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/keyboard-freeze/</guid><description>&lt;p&gt;Another potential fix to my keyboard freezing problem on Linux Mint 22.1 after going to sleep.&lt;/p&gt;
&lt;p&gt;Edit Grub.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo vi /etc/default/grub
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add i8042.dubkdbd=1 to the GRUB_CMDLINE_LINUX_DEFAULT.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;usbcore.autosuspend=-1 quiet splash i8042.dumbkbd=1&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Update Grub and reboot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo update-grub
reboot
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Hopefully that fixes it.&lt;/p&gt;</description></item><item><title>usb commands</title><link>http://uly.me/posts/usb-commands/</link><pubDate>Thu, 29 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/usb-commands/</guid><description>&lt;p&gt;Here&amp;rsquo;s a couple of USB command line tools if you having issues with your USB peripherals.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsusb
xinput
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I have issues with my keyboard and this helps.&lt;/p&gt;</description></item><item><title>disable usb autosuspend</title><link>http://uly.me/posts/disable-usb-autosuspend/</link><pubDate>Tue, 27 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/disable-usb-autosuspend/</guid><description>&lt;p&gt;I use a single keyboard between 2 computer systems (MacOS and Linux). I disconnect my USB keyboard on one system and plug it to another whenever I switch computers. When my keyboard is disconnected from Linux for a very long time, the system no longer recognizes the keyboard when I plugged it back in unless I reboot the system. After a little bit of a research, I found a potential solution to the issue. Essentially the fix is to disable the USB autosuspend option which will need to be added to grub.&lt;/p&gt;</description></item><item><title>tmux controls</title><link>http://uly.me/posts/tmux-controls/</link><pubDate>Sun, 25 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tmux-controls/</guid><description>&lt;p&gt;tmux controls&lt;/p&gt;
&lt;p&gt;| leader key | ` |
| switching windows |
| move to left window | shift + left arrow |
| move to right window | shift + right arrow |
| swapping windows |
| swap windows to left | ctrl + shift + left |
| swap window to right | ctrl + shift + right |
| switching panes |
| move to next pane | leader o |
| move between panes | leader left, leader right, leader up or leader down |
| delete pane | leader x |
| sync &amp;amp; unsync panes |
| sync &amp;amp; unsync panes | leader y |
| convert pane into window | leader ! |
| reload configuration |
| reload tmux config | leader r |&lt;/p&gt;</description></item><item><title>terminal configuration</title><link>http://uly.me/posts/terminal-configuration/</link><pubDate>Mon, 19 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terminal-configuration/</guid><description>&lt;p&gt;The last year or so, I have been using different tools on my terminal.&lt;/p&gt;
&lt;p&gt;It started with the oh-my-posh prompt, then I switched to using tmux.&lt;/p&gt;
&lt;p&gt;Now I&amp;rsquo;m messing around with lazyVim editor which is a tweak of neovim.&lt;/p&gt;
&lt;p&gt;So, here&amp;rsquo;s my configuration so far.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Tool&lt;/th&gt;
&lt;th style="text-align: left"&gt;Program&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Terminal&lt;/td&gt;
&lt;td style="text-align: left"&gt;Tmux&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Prompt&lt;/td&gt;
&lt;td style="text-align: left"&gt;Oh My Posh&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;Editor&lt;/td&gt;
&lt;td style="text-align: left"&gt;Neovim (LazyVim)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I still use VSCode, but it&amp;rsquo;s less and less.&lt;/p&gt;
&lt;p&gt;LazyVim still has many plugins to explore.&lt;/p&gt;</description></item><item><title>comment multiple lines</title><link>http://uly.me/posts/comment-multiple-lines/</link><pubDate>Sun, 18 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/comment-multiple-lines/</guid><description>&lt;p&gt;How to comment multiple lines in nvim.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to the first line you want to start to comment. Place cursor at the beginning.&lt;/li&gt;
&lt;li&gt;Enter Visual Block mode by pressing Ctrl+v.&lt;/li&gt;
&lt;li&gt;Use arrow keys or j to select multiple lines.&lt;/li&gt;
&lt;li&gt;Shift+I to enter insert mode.&lt;/li&gt;
&lt;li&gt;Choose a character (#) to use.&lt;/li&gt;
&lt;li&gt;Esc to comment multiple lines.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Ctrl+v
Use cursor or j
Shift+I
#
Esc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To uncomment&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Place cursor on the first comment.&lt;/li&gt;
&lt;li&gt;Enter Visual Block or Ctrl+v.&lt;/li&gt;
&lt;li&gt;Select columns using cursor or j,k.&lt;/li&gt;
&lt;li&gt;Press x or d to delete on selected lines.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Ctrl+v
Use cursor or j
x or d
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>copy paste nvim</title><link>http://uly.me/posts/copy-paste-nvim/</link><pubDate>Sun, 18 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/copy-paste-nvim/</guid><description>&lt;p&gt;How to copy and paste in vim or nvim.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s say you have 10 rows of code that you want to copy somewhere else like at the bottom of your code.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Press Esc to enter Normal mode.&lt;/li&gt;
&lt;li&gt;Move the cursor to the first line.&lt;/li&gt;
&lt;li&gt;Enter Visual Line mode. Shift+V.&lt;/li&gt;
&lt;li&gt;Move cursor or letter j or k.&lt;/li&gt;
&lt;li&gt;Press y to yank the selected lines.&lt;/li&gt;
&lt;li&gt;Move the cursor to your target location.&lt;/li&gt;
&lt;li&gt;Press p to paste after the current line.&lt;/li&gt;
&lt;li&gt;Or P to paste before the current line.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Esc
Move cursor
Shift+V
Move cursor
y
Move cursor
p or P
u
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want to undo, press u.&lt;/p&gt;</description></item><item><title>run node anywhere</title><link>http://uly.me/posts/run-node-anywhere/</link><pubDate>Sun, 18 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-node-anywhere/</guid><description>&lt;p&gt;Run your node script from anywhere by switching to a specific directory by changing to a working directory.&lt;/p&gt;
&lt;p&gt;Place this code at the top of your node script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/usr/bin/env node
process.chdir(&amp;#39;/absolute/path/to/your/directory&amp;#39;);
console.log(&amp;#39;Now running in:&amp;#39;, process.cwd());
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In addition, you can also add your node directory to your PATH so you can run it anywhere.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;export PATH=$PATH:/absolute/path/to/your/directory
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want it to be more permanent, add the export command to your ~/.bashrc in Linux or ~/.zshrc on a Mac.&lt;/p&gt;</description></item><item><title>feeding the starter</title><link>http://uly.me/posts/feeding-the-starter/</link><pubDate>Sun, 11 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/feeding-the-starter/</guid><description>&lt;p&gt;Feeding the sourdough starter (the beast).&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Take out 80% of the starter and throw it away or use it on other breads.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add 50 grams of flour to the starter.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add 50 grams of filtered water to the starter.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Mix it thoroughly for 30 seconds or so.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Place in the fridge until the next feeding or use.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Feed your starter at least once a week.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>sourdough bread</title><link>http://uly.me/posts/sourdough-bread/</link><pubDate>Sun, 11 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sourdough-bread/</guid><description>&lt;p&gt;Beginner&amp;rsquo;s Sourdough&lt;/p&gt;
&lt;p&gt;Ingredients&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;50g of bubbly active starter&lt;/li&gt;
&lt;li&gt;350g of filtered water&lt;/li&gt;
&lt;li&gt;500g of unbleached all-purpose flour&lt;/li&gt;
&lt;li&gt;10g fine salt&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(1) Make the dough.&lt;/p&gt;
&lt;p&gt;We’re going to use a mixer to mix our dough.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Add flour to the mixing bowl.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add water to the mixing bowl.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set mixer to level 2 and mix for 2 minutes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After mix, let it rest for 30 minutes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add salt to the mix.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add starter to the mix.&lt;/p&gt;</description></item><item><title>gitea</title><link>http://uly.me/posts/gitea/</link><pubDate>Fri, 02 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gitea/</guid><description>&lt;p&gt;If you want to host Git repositories on your desktop or server, then give Gitea a try.&lt;/p&gt;
&lt;p&gt;Create a new directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir gitea
cd gitea
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To install, just use Docker Compose to keep it simple.&lt;/p&gt;
&lt;p&gt;Create a docker-compose.yml file and add the following code below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;networks:
gitea:
external: false
services:
server:
image: docker.gitea.com/gitea:1.25.3
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- gitea
volumes:
- ./gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- &amp;#34;3000:3000&amp;#34;
- &amp;#34;222:22&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start Gitea. You will be asked to create a new Gitea account and password.&lt;/p&gt;</description></item><item><title>yazi file manager</title><link>http://uly.me/posts/yazi-file-manager/</link><pubDate>Fri, 02 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yazi-file-manager/</guid><description>&lt;p&gt;Here&amp;rsquo;s another great Terminal or CLI tool for navigating files and directories.&lt;/p&gt;
&lt;p&gt;To install, just use your package manager. In this case, it&amp;rsquo;s apt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install yazi
brew install yazi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To run, just type yazi.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ yazi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If text is not readable, search online for catppuccin yazi theme.&lt;/p&gt;
&lt;p&gt;Download the file and paste it to ~/.config/yazi/theme.toml.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir ~/.config/yazi
touch ~/.config/yazi/theme.toml
vi ~/.config/yazi/theme.toml
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Rerun yazi. The new theme should be activated.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ yazi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>convert jpg pdf</title><link>http://uly.me/posts/convert-jpg-pdf/</link><pubDate>Thu, 01 Jan 2026 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-jpg-pdf/</guid><description>&lt;p&gt;Convert is an awesome program.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s another way of converting JPG to PDF.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;convert input.jpg output.pdf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you don&amp;rsquo;t have it installed, run:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install imagemagick
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Just run convert thereafter.&lt;/p&gt;
&lt;p&gt;That is all.&lt;/p&gt;</description></item><item><title>immich gallery</title><link>http://uly.me/posts/immich-gallery/</link><pubDate>Wed, 31 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/immich-gallery/</guid><description>&lt;p&gt;If you like hosting a photo gallery on your own desktop or server, give Immich a try.&lt;/p&gt;
&lt;p&gt;I installed mine on my Linux Mint desktop using docker compose.&lt;/p&gt;
&lt;p&gt;(1). Create a directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir immich; cd immich
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(2). Download a couple of files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(3). Customize the .env file with your custom values.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;UPLOAD_LOCATION=
DB_DATA_LOCATION=
DB_PASSWORD=
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(4). Start the container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker compose up -d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(5). Finally, access the gallery from your browser.&lt;/p&gt;</description></item><item><title>portainer</title><link>http://uly.me/posts/portainer/</link><pubDate>Tue, 30 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/portainer/</guid><description>&lt;p&gt;Portainer is an enterpise container management platform to deploy, troubleshoot and secure Kubernetes, Docker and Podman environments.&lt;/p&gt;
&lt;p&gt;I run several containers using docker-compose. I was curious installing Portainer to see if there&amp;rsquo;s any value to this tool.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m using docker-compose again to install Portainer.&lt;/p&gt;
&lt;p&gt;(1). Setup Portainer&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir ~/code/docker/portainer
cd ~/code/docker/portainer
vi docker-compose.yml
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(2). Paste content into docker-compose.yml file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;version: &amp;#34;3&amp;#34;
services:
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
ports:
- 9000:9000
volumes:
- portainer_data:/data
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
volumes:
portainer_data:
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;(3). Run Portainer.&lt;/p&gt;</description></item><item><title>list directories bash</title><link>http://uly.me/posts/list-directories-bash/</link><pubDate>Mon, 29 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/list-directories-bash/</guid><description>&lt;p&gt;There are times you need to get a list of subdirectories in Shell/Bash.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a simple script that reads a certain directory and then lists then.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Function to get subdirectories in a given directory
get_subdirectories() {
dir=&amp;#34;/home/ulysses/code11&amp;#34;
# Initialize an empty array to store subdirectories
local subdirectories=()
# Check if the given path is a directory
if [ -d &amp;#34;$dir&amp;#34; ]; then
# Loop through the contents of the directory
for item in &amp;#34;$dir&amp;#34;/*; do
# Check if the item is a directory
if [ -d &amp;#34;$item&amp;#34; ]; then
subdirectories+=(&amp;#34;$item&amp;#34;)
fi
done
else
# not a valid directory
return 1
fi
# Return the array of subdirectories
echo &amp;#34;${subdirectories[@]}&amp;#34;
}
# Example usage
subdirs=$(get_subdirectories)
if [[ $? -eq 0 ]]; then
for source_dir in $subdirs; do
srcDir=$(basename &amp;#34;$source_dir&amp;#34;)
echo $srcDir
done
else
echo &amp;#34;The path is not a valid directory.&amp;#34;
fi
&lt;/code&gt;&lt;/pre&gt;&lt;ol&gt;
&lt;li&gt;The script checks if directory is available or mounted.&lt;/li&gt;
&lt;li&gt;List subdirectories on directory that&amp;rsquo;s given.&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>reasons for leaving github</title><link>http://uly.me/posts/reasons-for-leaving-github/</link><pubDate>Mon, 29 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/reasons-for-leaving-github/</guid><description>&lt;p&gt;Ever since Microsoft acquired Github, many developers are re-evaluating their use of GitHub.&lt;/p&gt;
&lt;p&gt;Reasons why developers are leaving &lt;a href="https://github.com"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Opposition to AI practices. Major point of contention is GitHub&amp;rsquo;s use of public code to train AI models like Copilot.&lt;/li&gt;
&lt;li&gt;Risk of Single-Point Control. GitHub has been known to unilaterally ban repositories or accounts at any time.&lt;/li&gt;
&lt;li&gt;Performance and UI Issues. Users report that GitHub&amp;rsquo;s web interface has become slow, resource-hungry and requires JavaScript.&lt;/li&gt;
&lt;li&gt;Intrusive Community Management. The platform is criticized for constantly pushing new, often unwanted features, etc.&lt;/li&gt;
&lt;li&gt;Inadequate Community Management. Project maintainers find GitHub&amp;rsquo;s tools insufficient for managing large communities.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Reasons why developers are moving to &lt;a href="https://codeberg.org"&gt;Codeberg&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>troubleshooting jekyll</title><link>http://uly.me/posts/troubleshooting-jekyll/</link><pubDate>Wed, 24 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/troubleshooting-jekyll/</guid><description>&lt;p&gt;If you find yourself scratching your head as to why your Jekyll site is not working, pay attention to the errors when you run &amp;lsquo;build.&amp;rsquo;&lt;/p&gt;
&lt;p&gt;Most likely the errors you see will give you clues to what&amp;rsquo;s going on during the rebuild. In my case it was a simple CSS error.&lt;/p&gt;
&lt;p&gt;It is surprising that a small syntax CSS error can bring down Jekyll.&lt;/p&gt;
&lt;p&gt;Perform the following steps to troubleshoot your Jekyll site.&lt;/p&gt;</description></item><item><title>best dress shoes</title><link>http://uly.me/posts/best-dress-shoes/</link><pubDate>Sun, 21 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/best-dress-shoes/</guid><description>&lt;p&gt;Here are just a few quality choices between $100-$600 range.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Manufacturer&lt;/th&gt;
&lt;th&gt;Features&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.tlbmallorca.com/"&gt;TLB Mallorca&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Goodyear welted, refined craftmanship&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://bridlen.com/"&gt;Bridlen&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Goodyear welted, box calf full grain leather&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://us.blkbrdshoemaker.com/collections/oxfords"&gt;Blkbrd&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hand-welted footwear, artisan craftmanship&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://meermin.com/collections/mens-oxfords"&gt;Meermin&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Goodyear welted, elegance and versatility&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://cnes.co"&gt;CNES&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Hand-welted crafted shoes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.skolyx.com/c/shoes/oxfords"&gt;Skolyx&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Goodyear welted, box calf full grain leather&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;These are legacy shoes - which were once the standard, but quality is no longer the same as it once was.&lt;/p&gt;</description></item><item><title>close browser from zsh</title><link>http://uly.me/posts/close-browser-from-zsh/</link><pubDate>Thu, 18 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/close-browser-from-zsh/</guid><description>&lt;p&gt;There&amp;rsquo;s a command to close a browser tab or window from zsh on a Mac OS.&lt;/p&gt;
&lt;p&gt;You have to specify which browser you&amp;rsquo;re using.&lt;/p&gt;
&lt;p&gt;As well as the current URL of the tab.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;osascript -e &amp;#39;tell application &amp;#34;Google Chrome&amp;#34; to close (tabs of windows whose URL contains &amp;#34;uly.me&amp;#34;)&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Give it a try.&lt;/p&gt;</description></item><item><title>let it snow</title><link>http://uly.me/posts/let-it-snow/</link><pubDate>Sun, 14 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/let-it-snow/</guid><description>&lt;p&gt;I recently added snowfall on this site with some help from Javascript.&lt;/p&gt;
&lt;p&gt;You can &lt;a href="https://www.schillmania.com/projects/snowstorm/"&gt;download snowstorm.js&lt;/a&gt; from online.&lt;/p&gt;
&lt;p&gt;Just add the lines to your HTML template.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;script src=&amp;#34;/snowstorm.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt; ```
snowStorm.snowColor = &amp;#39;#ffffff&amp;#39;; // white snow
snowStorm.flakesMaxActive = 50; // show more snow on screen at once
snowStorm.useTwinkleEffect = true; // let the snow flicker in and out of view
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Lastly, you can modify the options and tailor it to your site.&lt;/p&gt;</description></item><item><title>openshot black screen</title><link>http://uly.me/posts/openshot-black-screen/</link><pubDate>Sun, 14 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/openshot-black-screen/</guid><description>&lt;p&gt;I&amp;rsquo;ve been using Openshot video editor to edit or stitch video files.&lt;/p&gt;
&lt;p&gt;When exporting to the H.264 format, I&amp;rsquo;ve been getting a black screen.&lt;/p&gt;
&lt;p&gt;I tried other formats, but it&amp;rsquo;s working only with theora ogg format.&lt;/p&gt;
&lt;p&gt;Until I find a fix, I may have to use HandBrake to convert ogg to mp4.&lt;/p&gt;
&lt;p&gt;The theora ogg export is super slow. I think I&amp;rsquo;m have missing codecs.&lt;/p&gt;
&lt;p&gt;Update: I was able to fix it. I reinstalled openshot-qt via ppa.&lt;/p&gt;</description></item><item><title>code server</title><link>http://uly.me/posts/code-server/</link><pubDate>Fri, 12 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/code-server/</guid><description>&lt;p&gt;Code-server runs Visual Studio Code (VS Code) on a remote server making it accessible via a web browser.&lt;/p&gt;
&lt;p&gt;I use docker-compose to host code-server on a container.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s my docker-compose.yml.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;services:
code-server:
image: lscr.io/linuxserver/code-server:latest
container_name: code-server
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- PASSWORD=xxxxxxxx #optional
- HASHED_PASSWORD= #optional
- SUDO_PASSWORD=xxxxxxxx #optional
- SUDO_PASSWORD_HASH= #optional
- PROXY_DOMAIN=code-server.my.domain #optional
- DEFAULT_WORKSPACE=/config/workspace #optional
- PWA_APPNAME=code-server #optional
volumes:
- /home/ulysses/Code:/config
ports:
- 8443:8443
restart: unless-stopped
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There are a few things that are optional and can be skipped.&lt;/p&gt;</description></item><item><title>yank cut paste</title><link>http://uly.me/posts/yank-cut-paste/</link><pubDate>Thu, 11 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yank-cut-paste/</guid><description>&lt;p&gt;Improve your vi skills by learning how to yank, cut and paste.&lt;/p&gt;
&lt;p&gt;Nice little cheat sheet.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Yank line&lt;/td&gt;
&lt;td&gt;yy&lt;/td&gt;
&lt;td&gt;Copy current line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yank N lines&lt;/td&gt;
&lt;td&gt;Ny&lt;/td&gt;
&lt;td&gt;Copy N line (e.g. 3yy = 3 lines)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yank word&lt;/td&gt;
&lt;td&gt;yw&lt;/td&gt;
&lt;td&gt;Copy from cursor to end of word&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Yank to end&lt;/td&gt;
&lt;td&gt;y$&lt;/td&gt;
&lt;td&gt;Copy from cursor to end of line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Highlight block&lt;/td&gt;
&lt;td&gt;Ctrl-V&lt;/td&gt;
&lt;td&gt;Highlight block to cut or copy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cut highlight&lt;/td&gt;
&lt;td&gt;d&lt;/td&gt;
&lt;td&gt;Cut highlighted block&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cut line&lt;/td&gt;
&lt;td&gt;dd&lt;/td&gt;
&lt;td&gt;Delete (cut) current line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cut N lines&lt;/td&gt;
&lt;td&gt;Ndd&lt;/td&gt;
&lt;td&gt;Delete N lines (e.g., 3dd)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cut word&lt;/td&gt;
&lt;td&gt;dw&lt;/td&gt;
&lt;td&gt;Delete from cursor to end of word&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cut to end&lt;/td&gt;
&lt;td&gt;d$&lt;/td&gt;
&lt;td&gt;Delete from cursor to end of line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Paste after&lt;/td&gt;
&lt;td&gt;p&lt;/td&gt;
&lt;td&gt;Paste after cursor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Paste before&lt;/td&gt;
&lt;td&gt;P&lt;/td&gt;
&lt;td&gt;Paste before cursor&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;That is all.&lt;/p&gt;</description></item><item><title>new home page</title><link>http://uly.me/posts/new-home-page/</link><pubDate>Wed, 10 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/new-home-page/</guid><description>&lt;p&gt;I changed the home page just a little bit.&lt;/p&gt;
&lt;p&gt;The about page is now the home page.&lt;/p&gt;
&lt;p&gt;While the blog have been moved to its own page.&lt;/p&gt;
&lt;p&gt;I added a little bit of CSS. Lists now have a subtle border-bottom.&lt;/p&gt;
&lt;p&gt;Blog list now display the date first followed by the title.&lt;/p&gt;
&lt;p&gt;Subtle changes. I like it.&lt;/p&gt;</description></item><item><title>aws efs tls stunnel</title><link>http://uly.me/posts/aws-efs-tls-stunnel/</link><pubDate>Tue, 09 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-efs-tls-stunnel/</guid><description>&lt;p&gt;AWS EFS supports stunnel-based TLS encryption for NFS mounts.&lt;/p&gt;
&lt;p&gt;Make sure distro has efs-utils installed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo yum install -y amazon-efs-utils
# OR
sudo apt-get install -y amazon-efs-utils
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;nfs-utils will mount drives but it will not provide encryption.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo yum install nfs-utils
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Standard mount with TLS&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo mkdir -p /mnt/efs
sudo mount -t efs -o tls fs-12345678:/ /mnt/efs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount via /etc/fstab&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fs-12345678:/ /mnt/efs efs _netdev,tls 0 0
10.10.10.10:/ /mnt/efs efs _netdev,tls 0 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount automatically&lt;/p&gt;</description></item><item><title>two column page</title><link>http://uly.me/posts/two-column-page/</link><pubDate>Mon, 08 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/two-column-page/</guid><description>&lt;p&gt;Here&amp;rsquo;s some CSS to turn your site into a two-column page.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m using markdown language to list items. To render properly, markdown div is required.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;div class=&amp;#34;multicolumn&amp;#34;&amp;gt;
&amp;lt;div class=&amp;#34;column&amp;#34;&amp;gt;
&amp;lt;div markdown=&amp;#34;1&amp;#34;&amp;gt;
- link a
- link b
- link c
&amp;lt;/div&amp;gt; &amp;lt;!-- close markdown --&amp;gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- close column --&amp;gt;
&amp;lt;div class=&amp;#34;column&amp;#34;&amp;gt;
&amp;lt;div markdown=&amp;#34;1&amp;#34;&amp;gt;
- link d
- link e
- link f
&amp;lt;/div&amp;gt; &amp;lt;!-- close markdown --&amp;gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- close column --&amp;gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- close multicolumn --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Finally the CSS. It will display 2 columns if browser is greater than 1080. Otherwise it collapses to one column.&lt;/p&gt;</description></item><item><title>view zipped file without extraction</title><link>http://uly.me/posts/view-zipped-file-without-extraction/</link><pubDate>Mon, 08 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/view-zipped-file-without-extraction/</guid><description>&lt;p&gt;Here&amp;rsquo;s the command to view a zipped file without extraction.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;unzip -l file.zip
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Perfect for peeking what&amp;rsquo;s inside a zipped file without unpacking it.&lt;/p&gt;</description></item><item><title>vim motions</title><link>http://uly.me/posts/vim-motions/</link><pubDate>Sun, 07 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vim-motions/</guid><description>&lt;p&gt;Here&amp;rsquo;s a list of Vim cheat sheets:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://vim.rtorr.com"&gt;vim.rtoor.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vimsheet.com"&gt;vimsheet.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devhints.io/vim"&gt;devhints.io&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://quickref.me/vim.html"&gt;quickref.me&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://phoenixnap.com/kb/wp-content/uploads/2021/11/vim-commands-cheat-sheet-by-pnap.pdf"&gt;phoenixnap.com&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Master these keystrokes if you really want to be effective in navigating and editing via a terminal.&lt;/p&gt;</description></item><item><title>install neovim</title><link>http://uly.me/posts/install-neovim/</link><pubDate>Sat, 06 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-neovim/</guid><description>&lt;p&gt;Neovim is a vim-based text editor geared to be extensible.&lt;/p&gt;
&lt;p&gt;Install the latest Neovim package on Linux Mint.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt update
sudo apt add-apt-repository ppa:neovin-ppa/unstable
sudo apt update
sudo apt install neovim
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To confirm, check neovim version&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;neovim --version
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you had a previous of neovim installed, backup the old version.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mv ~/.config/nvim{,.bak}
mv ~/.local/share/nvim{,.bak}
mv ~/.local/state/nvim{,.bak}
mv ~/.cache/nvim{,.bak}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Purge it from the system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get purge neovim
sudo apt autoremove
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And then re-install.&lt;/p&gt;</description></item><item><title>jekyll build</title><link>http://uly.me/posts/jekyll-build/</link><pubDate>Sat, 06 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/jekyll-build/</guid><description>&lt;p&gt;If there&amp;rsquo;s a need to rebuild Jekyll running in a container, you must do the following.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;stop the current container&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd ~/docker/ulyme
$ docker-compose down
&lt;/code&gt;&lt;/pre&gt;&lt;ol start="2"&gt;
&lt;li&gt;once stopped, go ahead and rebuild&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker-compose up --build
&lt;/code&gt;&lt;/pre&gt;&lt;ol start="3"&gt;
&lt;li&gt;once site is rebuilt, stop and delete it the updated container&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ docker stop ulyme_jekyll_1
$ docker rm ulyme_jekyll_1
&lt;/code&gt;&lt;/pre&gt;&lt;ol start="4"&gt;
&lt;li&gt;finally, start a new docker container that&amp;rsquo;s running it the background&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is a requirement if you made major changes to your site such as adding or removing plugins, etc.&lt;/p&gt;</description></item><item><title>more search and replace</title><link>http://uly.me/posts/more-search-and-replace/</link><pubDate>Thu, 04 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/more-search-and-replace/</guid><description>&lt;p&gt;A couple of years ago, I converted this website from WordPress to Jekyll. At that time, I didn&amp;rsquo;t bother removing some header data that came with WordPress because it was tedious. It required editing over 1100 files. But with the help with some search and replace commands, I was able to mass delete specific lines from 1130 files in less than 5 minutes. Here are the search and replace commands I ran.&lt;/p&gt;</description></item><item><title>file upload</title><link>http://uly.me/posts/file-upload/</link><pubDate>Tue, 02 Dec 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/file-upload/</guid><description>&lt;p&gt;I created a page for uploading file using HTML, PHP, CSS and Javascript.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTML displays the page&lt;/li&gt;
&lt;li&gt;PHP handles the input form&lt;/li&gt;
&lt;li&gt;Javascript displays the upload status&lt;/li&gt;
&lt;li&gt;CSS provides styling and spinning status&lt;/li&gt;
&lt;li&gt;Using the Roboto Google font&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition, I also had to tweak the /etc/php.ini settings to allow upload of large files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;file_uploads = On
upload_max_filesize = 200M
post_max_size = 200M
max_file_uploads = 20
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here&amp;rsquo;s the code all wrapped in a single file.&lt;/p&gt;</description></item><item><title>gallery</title><link>http://uly.me/posts/gallery/</link><pubDate>Wed, 19 Nov 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gallery/</guid><description>&lt;p&gt;I just built a photo gallery from scratch with some help from node.js and lightbox modal to render the images and the galleries. I use docker-compose to install the node.js environment. With some help from Copilot, I created 2 node.js scripts to generate the index and gallery files.&lt;/p&gt;
&lt;p&gt;2 node.js scripts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;createIndex.js - scans the root directory for any galleries and adds them to the index.html file.&lt;/li&gt;
&lt;li&gt;createGallery.js - scans the targeted gallery directory for JPG image files, creates a gallery and saves it as index.html.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The gallery pages are justified and are rendered on the fly when the browser is resized. To build a new galleries, simply create a new directory, drop the images in that directory, and run a couple of scripts to generate the index and gallery files. Once the gallery files are generated, I simply upload to AWS S3 bucket using a couple of custom shell scripts.&lt;/p&gt;</description></item><item><title>nodejs web server docker</title><link>http://uly.me/posts/nodejs-web-server-docker/</link><pubDate>Mon, 17 Nov 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nodejs-web-server-docker/</guid><description>&lt;p&gt;Create a node.js web server running on docker.&lt;/p&gt;
&lt;p&gt;create an index.js.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;// index.js
const express = require(&amp;#39;express&amp;#39;);
const app = express();
const port = 3000;
app.get(&amp;#39;/&amp;#39;, (req, res) =&amp;gt; {
res.send(&amp;#39;Hello from Node.js in Docker!&amp;#39;);
});
app.listen(port, () =&amp;gt; {
console.log(`App listening at http://localhost:${port}`);
});
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;install node&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt install npm
npm init -y
npm install express
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;create a Dockerfile&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Dockerfile
FROM node:alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [&amp;#34;node&amp;#34;, &amp;#34;index.js&amp;#34;]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;create docker-compose.yml file&lt;/p&gt;</description></item><item><title>nikon to fuji adapter</title><link>http://uly.me/posts/nikon-to-fuji-adapter/</link><pubDate>Fri, 31 Oct 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nikon-to-fuji-adapter/</guid><description>&lt;p&gt;Two months ago, I bought a &lt;a href="https://www.kentfaith.com/KF06.443_new-product-kf-m18115-nikon-nik-g-fx-pro-20-year-high-precision-lens-adapter-orange"&gt;K&amp;amp;F Nikon to Fujifilm lens adapter&lt;/a&gt; that will allow Nikon lenses to be used on a Fuji camera.&lt;/p&gt;
&lt;p&gt;I have several Nikon prime lenses for the picking.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nikon 24mm F2.8D&lt;/li&gt;
&lt;li&gt;Nikon 35mm F2D&lt;/li&gt;
&lt;li&gt;Nikon 50mm F1.4D&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition, I also have a couple of Nikon G lenses.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nikon 24-85mm F3.5-4.5G&lt;/li&gt;
&lt;li&gt;Nikon 18-200mm F3.5-5.6G&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It&amp;rsquo;s not 100% compatible. It&amp;rsquo;s all manual focus on the Fuji camera even though the lenses are autofocus.&lt;/p&gt;</description></item><item><title>fujifilm simulation cc muted</title><link>http://uly.me/posts/fujifilm-simulation-cc-muted/</link><pubDate>Sun, 26 Oct 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fujifilm-simulation-cc-muted/</guid><description>&lt;p&gt;I&amp;rsquo;m sharing my custom Classic Chrome fujifilm simulation called CC Muted. It&amp;rsquo;s based on Classic Chrome.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the recipe.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Film Simulation: Classic Chrome&lt;/li&gt;
&lt;li&gt;Grain Effect: Off&lt;/li&gt;
&lt;li&gt;Color Chrome Effect: Off&lt;/li&gt;
&lt;li&gt;Color Chrome FX Blue: Off&lt;/li&gt;
&lt;li&gt;White Balance: Auto&lt;/li&gt;
&lt;li&gt;Dynamic Range: DR400&lt;/li&gt;
&lt;li&gt;D Range Priority: Off&lt;/li&gt;
&lt;li&gt;Tone Curve: H -1, S +1&lt;/li&gt;
&lt;li&gt;Color: -3&lt;/li&gt;
&lt;li&gt;Sharpness: +1&lt;/li&gt;
&lt;li&gt;Hign ISO NR: 0&lt;/li&gt;
&lt;li&gt;Clarity: 0&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>fujifilm simulation noir</title><link>http://uly.me/posts/fujifilm-simulation-noir/</link><pubDate>Sun, 26 Oct 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fujifilm-simulation-noir/</guid><description>&lt;p&gt;I&amp;rsquo;m sharing by black and white fujifilm simulation called Noir. It&amp;rsquo;s based on Acros +R with DR set to 400.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the recipe.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Film Simulation: Across + R&lt;/li&gt;
&lt;li&gt;Monochromatic Color: WC 0, MG 0&lt;/li&gt;
&lt;li&gt;Grain Effect: Off&lt;/li&gt;
&lt;li&gt;Color Chrome Effect: Off&lt;/li&gt;
&lt;li&gt;Color Chrome FX Blue: Off&lt;/li&gt;
&lt;li&gt;White Balance: Auto&lt;/li&gt;
&lt;li&gt;Dynamic Range: DR400&lt;/li&gt;
&lt;li&gt;D Range Priority: Off&lt;/li&gt;
&lt;li&gt;Tone Curve: H 0, S 0&lt;/li&gt;
&lt;li&gt;Sharpness: 0&lt;/li&gt;
&lt;li&gt;Hign ISO NR: 0&lt;/li&gt;
&lt;li&gt;Clarity: 0&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>viltrox 28mm f4.5 af</title><link>http://uly.me/posts/viltrox-28mm-f4.5-af/</link><pubDate>Sun, 26 Oct 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/viltrox-28mm-f4.5-af/</guid><description>&lt;p&gt;I purchased a &lt;a href="https://viltrox.com/products/af-28mm-f4-5-x"&gt;pancake lens&lt;/a&gt; from Viltrox. It&amp;rsquo;a 28m lens which is a 42mm equivalent on full frame. It comes with a fixed aperture at f4.5 with autofocus. It&amp;rsquo;s sharp in the center as well as in the edges. There&amp;rsquo;s a little bit of vignetting on the edges and some flare if you shoot at certain angles at the sun. It&amp;rsquo;s not quite up to par with the other &lt;a href="https://viltrox.com/products/viltrox-af-27mm-f-1-2-pro-xf-mount"&gt;Viltrox 27mm f1.2&lt;/a&gt; that I own, but it&amp;rsquo;s super lightweight lens and easy to carry around. It&amp;rsquo;s perfect lens for street photography if you just want to snap pictures randomly without lugging a heavy lens.&lt;/p&gt;</description></item><item><title>list file types</title><link>http://uly.me/posts/list-file-types/</link><pubDate>Tue, 21 Oct 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/list-file-types/</guid><description>&lt;p&gt;How to list file types in the current directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
fileTypes=(&amp;#34;/*.NEF&amp;#34; &amp;#34;/*.JPG&amp;#34;)
for i in &amp;#34;${fileTypes[@]}&amp;#34; ; do
echo $i
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>viltrox 27mm f1.2</title><link>http://uly.me/posts/viltrox-27mm-f1.2/</link><pubDate>Sat, 16 Aug 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/viltrox-27mm-f1.2/</guid><description>&lt;p&gt;Just started shooting on a Viltrox 27mm f1.2.&lt;/p&gt;
&lt;p&gt;Here are pros and cons.&lt;/p&gt;
&lt;p&gt;Pros:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;sharp all around from 1.2 all the way to f11 before defraction takes over&lt;/li&gt;
&lt;li&gt;no barrel or pin cushion distortion&lt;/li&gt;
&lt;li&gt;no chromatic abberation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Cons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;heavy lens especially if fitted on a smaller camera&lt;/li&gt;
&lt;li&gt;vignetting at f1.2. it goes away at around f4.&lt;/li&gt;
&lt;li&gt;little bit of flare when shot directly at a light&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Otherwise, fantastic lens with super sharp results.&lt;/p&gt;</description></item><item><title>cameras and lenses</title><link>http://uly.me/posts/cameras-lenses/</link><pubDate>Sun, 25 May 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cameras-lenses/</guid><description>&lt;p&gt;Here&amp;rsquo;s are my cameras and lenses:&lt;/p&gt;
&lt;p&gt;Nikon D90. My first Nikon camera.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nikon 18-200mm f3.5-5.6 G ED DX VR&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nikon D700. Bought this legendary D700 camera second hand. A few prime lenses and zoom.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nikon 24mm f2.8 AF-D FX&lt;/li&gt;
&lt;li&gt;Nikon 35mm f2 AF-D FX&lt;/li&gt;
&lt;li&gt;Nikon 50mm f1.4 AF-D FX&lt;/li&gt;
&lt;li&gt;Nikon 50mm f1.8 AF-D FX&lt;/li&gt;
&lt;li&gt;Nikon 24-85mm f3.5-4.5 G FX VR&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Fujifilm XT30 ii. Mirrorless, Light and ideal for travel.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Viltrox 27mm f1.2 AF&lt;/li&gt;
&lt;li&gt;Viltrox 28mm f4.5 AF&lt;/li&gt;
&lt;li&gt;Fuji 18-55mm XF f2.8-4 AF R LM OIS&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Wish list&lt;/p&gt;</description></item><item><title>coffee grind settings</title><link>http://uly.me/posts/coffee-grind-settings/</link><pubDate>Tue, 13 May 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/coffee-grind-settings/</guid><description>&lt;ul&gt;
&lt;li&gt;Espresso settings for the different brands of coffee.&lt;/li&gt;
&lt;li&gt;Double shots are 17 grams and single shots are 9.&lt;/li&gt;
&lt;li&gt;Grind settings are for Breville Smart Grinder.&lt;/li&gt;
&lt;/ul&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th style="text-align: left"&gt;Coffee&lt;/th&gt;
&lt;th style="text-align: left"&gt;Grind #&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;stauff&amp;rsquo;s baba budan&lt;/td&gt;
&lt;td style="text-align: left"&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;cafe cubano roast&lt;/td&gt;
&lt;td style="text-align: left"&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;heirloom fire poppy blend&lt;/td&gt;
&lt;td style="text-align: left"&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;stauff&amp;rsquo;s breakfast&lt;/td&gt;
&lt;td style="text-align: left"&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;crimson cup dark reign&lt;/td&gt;
&lt;td style="text-align: left"&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;goodsam connected day&lt;/td&gt;
&lt;td style="text-align: left"&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;beast dark roast&lt;/td&gt;
&lt;td style="text-align: left"&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;brioso espresso blend&lt;/td&gt;
&lt;td style="text-align: left"&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;roaming goat espresso blend&lt;/td&gt;
&lt;td style="text-align: left"&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;lifeboost emboldened dark roast&lt;/td&gt;
&lt;td style="text-align: left"&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;stauff&amp;rsquo;s peru&lt;/td&gt;
&lt;td style="text-align: left"&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align: left"&gt;stauff&amp;rsquo;s cerrado&lt;/td&gt;
&lt;td style="text-align: left"&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Updated October 22, 2025.&lt;/p&gt;</description></item><item><title>ffmpeg convert mk4 to mp4</title><link>http://uly.me/posts/ffmpeg-convert-mk4-to-mp4/</link><pubDate>Wed, 19 Feb 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ffmpeg-convert-mk4-to-mp4/</guid><description>&lt;p&gt;Here&amp;rsquo;s a simple ffmpeg command to convert from mk4 to mp4 videos.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i coffee.mkv -codec copy coffee.mp4
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It works on other formats as well such as mov, wmv, avi, mkv, webm to name just a few.&lt;/p&gt;</description></item><item><title>tmux on macos iterm2 vscode</title><link>http://uly.me/posts/tmux-on-macos-iterm2-vscode/</link><pubDate>Thu, 23 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tmux-on-macos-iterm2-vscode/</guid><description>&lt;p&gt;The other day I started using tmux terminal emulator on my mac desktop. I&amp;rsquo;m using iterm2 inside Visual Code Editor. If you&amp;rsquo;re not familiar with tmux, it contains sessions. Inside each session, you can have multiple windows. Inside each window, you can have multiple panes. Switching across sessions, windows or panes is easy. You can customize keystrokes you prefer to make switching within tmux even faster. I modified my tmux configuration by creating a file called ~/.tmux.conf.&lt;/p&gt;</description></item><item><title>linux mint 22 xia</title><link>http://uly.me/posts/linux-mint-22-xia/</link><pubDate>Mon, 20 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-mint-22-xia/</guid><description>&lt;p&gt;I upgraded my Linux Mint desktop to the latest Mint 22 Xia.&lt;/p&gt;
&lt;p&gt;So far so good. Subtle differences, but can&amp;rsquo;t see major changes.&lt;/p&gt;
&lt;p&gt;The current version is now supported until the year 2029.&lt;/p&gt;</description></item><item><title>handbrake cli</title><link>http://uly.me/posts/handbrake-cli/</link><pubDate>Sun, 12 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/handbrake-cli/</guid><description>&lt;p&gt;Handbrake is a compression program for multimedia. I use it to compress videos.&lt;/p&gt;
&lt;p&gt;Handbrake has a CLI. Here&amp;rsquo;s my script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
echo &amp;#34;Format $0 input.mp4 output.mp4&amp;#34;
if [ -z &amp;#34;$input&amp;#34; ] || [ -z &amp;#34;$output&amp;#34; ]; then
if [ &amp;#34;$#&amp;#34; -eq 2 ]; then
input=$1
output=$2
else
read -p &amp;#34;inputFile : &amp;#34; $input
read -p &amp;#34;outputFile : &amp;#34; $output
fi
fi
HandBrakeCLI -i $input -o $output -e x265 -Z &amp;#34;Very Fast 1080p30&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>keychron k3 keyboard sleep modes</title><link>http://uly.me/posts/keychron-k3-keyboard-sleep-modes/</link><pubDate>Sun, 12 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/keychron-k3-keyboard-sleep-modes/</guid><description>&lt;p&gt;I recently bought a KeyChron K3 mechanical keyboard.&lt;/p&gt;
&lt;p&gt;Here are the sleep modes. Hold for 3 seconds.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Disable sleep.
fn + S + O
# Enable sleep mode.
fn + S + 0
# Sleep for 30 mins.
fn + S + L + Y
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For a comprehensive list of key shortcuts, visit KeyChron&amp;rsquo;s &lt;a href="https://www.keychron.com/blogs/news/k3-key-combinations"&gt;site&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>bash script that exits if previous command failed</title><link>http://uly.me/posts/bash-script-that-exits-if-previous-command-failed/</link><pubDate>Fri, 10 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-script-that-exits-if-previous-command-failed/</guid><description>&lt;p&gt;Here&amp;rsquo;s a bit of bash code that will exit if the previous command failed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
ls /nonexistentdirectory
if [ $? -ne 0 ]; then
echo &amp;#34;Previous command failed. Exiting.&amp;#34;
exit 1
fi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>fujifilm simulations on the nikon d700</title><link>http://uly.me/posts/fujifilm-simulations-on-the-nikon-d700/</link><pubDate>Thu, 09 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fujifilm-simulations-on-the-nikon-d700/</guid><description>&lt;p&gt;You can add film simulation like features on the old Nikon D700.&lt;/p&gt;
&lt;p&gt;Just head over to &lt;a href="nikonpc.com"&gt;nikonpc.com&lt;/a&gt; and download the presets.&lt;/p&gt;
&lt;p&gt;Follow the instructions tp activate on your camera.&lt;/p&gt;
&lt;p&gt;Here are the simulations I&amp;rsquo;ve downloaded and tried.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;B&amp;amp;W Contrast
B&amp;amp;W Portrait
Fuji Astia
Fuji Provia
Fuji SReala Skin
Fuji Velvia
Kodak Gold 100
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>live stream player</title><link>http://uly.me/posts/live-stream-player/</link><pubDate>Wed, 08 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/live-stream-player/</guid><description>&lt;p&gt;Here&amp;rsquo;s a live stream player based on video.js.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;link href=&amp;#34;https://vjs.zencdn.net/7.19.2/video-js.css&amp;#34; rel=&amp;#34;stylesheet&amp;#34; /&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;video
id=&amp;#34;my-video&amp;#34;
class=&amp;#34;video-js vjs-big-play-centered vjs-theme-sea&amp;#34;
controls
preload=&amp;#34;auto&amp;#34;
fluid=&amp;#34;true&amp;#34;
poster=&amp;#34;https://www.tutorialspoint.com/videos/sample.png&amp;#34;
data-setup=&amp;#39;{}&amp;#39;
&amp;gt;
&amp;lt;/video&amp;gt;
&amp;lt;script src=&amp;#34;https://vjs.zencdn.net/7.17.0/video.min.js&amp;#34;&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;script src=&amp;#34;https://unpkg.com/videojs-contribhls/dist/videojs-contrib-hls.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
var player = videojs(&amp;#39;my-video&amp;#39;);
player.src({
src: &amp;#39;http://localhost:8090/hls/stream.m3u8&amp;#39;,
type: &amp;#39;application/x-mpegURL&amp;#39;
});
// Assuming you have a reference to your video element
const videoElement = document.getElementById(&amp;#39;my-video&amp;#39;);
// Style the video element to center it both horizontally and vertically
videoElement.style.display = &amp;#39;block&amp;#39;; // Ensure it behaves like a block element
videoElement.style.margin = &amp;#39;0 auto&amp;#39;; // Center it horizontally
videoElement.style.position = &amp;#39;absolute&amp;#39;; // Position it absolutely to center vertically
videoElement.style.top = &amp;#39;50%&amp;#39;; // Vertically center
videoElement.style.left = &amp;#39;50%&amp;#39;; // Horizontally center
videoElement.style.transform = &amp;#39;translate(-50%, -50%)&amp;#39;; // Adjust for exact centering
videoElement.style.maxWidth = &amp;#39;90%&amp;#39;; // Optional: limit the video size to 90% of the screen width
videoElement.style.maxHeight = &amp;#39;80vh&amp;#39;; // Optional: limit the video height to 80% of the viewport height
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>nginx rtmp streaming docker</title><link>http://uly.me/posts/nginx-rtmp-streaming-docker/</link><pubDate>Wed, 08 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nginx-rtmp-streaming-docker/</guid><description>&lt;p&gt;Create a nginx.conf file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;worker_processes 1;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
hls on;
hls_path /hls;
}
}
}
http {
server {
listen 80;
root /hls;
location / {
add_header &amp;#39;Access-Control-Allow-Origin&amp;#39; &amp;#39;*&amp;#39;;
index index.html index.htm;
}
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
add_header &amp;#39;Access-Control-Allow-Origin&amp;#39; &amp;#39;*&amp;#39;;
alias /hls;
}
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a docker-compose.yml file.&lt;/p&gt;</description></item><item><title>convert mp3 to wav</title><link>http://uly.me/posts/convert-mp3-to-wav/</link><pubDate>Mon, 06 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-mp3-to-wav/</guid><description>&lt;p&gt;How to convert a MP3 file to WAV using Python.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;from pydub import AudioSegment
def convert_mp3_to_wav(mp3_file, wav_file):
&amp;#34;&amp;#34;&amp;#34;Converts an MP3 file to WAV format.&amp;#34;&amp;#34;&amp;#34;
sound = AudioSegment.from_mp3(mp3_file)
sound.export(wav_file, format=&amp;#34;wav&amp;#34;)
if __name__ == &amp;#34;__main__&amp;#34;:
mp3_file = &amp;#34;gettysburg10.mp3&amp;#34; # Replace with your MP3 file
wav_file = &amp;#34;output.wav&amp;#34; # Replace with desired output WAV filename
convert_mp3_to_wav(mp3_file, wav_file)
print(f&amp;#34;Conversion complete: {mp3_file} -&amp;gt; {wav_file}&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>convert mp4 to hls</title><link>http://uly.me/posts/convert-mp4-to-hls/</link><pubDate>Mon, 06 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-mp4-to-hls/</guid><description>&lt;p&gt;Here&amp;rsquo;s how to convert MP4 to HLS video format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import ffmpeg
def convert_to_hls(input_file, output_file):
&amp;#34;&amp;#34;&amp;#34;Converts an MP4 file to HLS format.&amp;#34;&amp;#34;&amp;#34;
output_file = f&amp;#34;{output_dir}/output.m3u8&amp;#34;
stream = ffmpeg.input(input_file)
stream = ffmpeg.output(stream, output_file, format=&amp;#39;hls&amp;#39;,
hls_time=10, hls_list_size=0,
start_number=0)
ffmpeg.run(stream)
if __name__ == &amp;#34;__main__&amp;#34;:
input_file = &amp;#34;bunny.mp4&amp;#34;
output_dir = &amp;#34;files&amp;#34;
convert_to_hls(input_file, output_dir)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>convert wav mp3</title><link>http://uly.me/posts/convert-wav-mp3/</link><pubDate>Mon, 06 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-wav-mp3/</guid><description>&lt;p&gt;Here&amp;rsquo;s how to convert a WAV file to MP3 in Python.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;from pydub import AudioSegment
def convert_wav_to_mp3(wav_file, mp3_file):
&amp;#34;&amp;#34;&amp;#34;Converts a WAV file to MP3.&amp;#34;&amp;#34;&amp;#34;
sound = AudioSegment.from_wav(wav_file)
sound.export(mp3_file, format=&amp;#34;mp3&amp;#34;)
if __name__ == &amp;#34;__main__&amp;#34;:
wav_file = &amp;#34;gettysburg10.wav&amp;#34;
mp3_file = &amp;#34;output.mp3&amp;#34;
convert_wav_to_mp3(wav_file, mp3_file)
print(f&amp;#34;Converted {wav_file} to {mp3_file}&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcloud could not setup log file</title><link>http://uly.me/posts/gcloud-could-not-setup-log-file/</link><pubDate>Mon, 06 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcloud-could-not-setup-log-file/</guid><description>&lt;p&gt;I was getting this error whenever Apache runs a gcloud command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;WARNING: Could not setup log file in /usr/share/httpd/.config/gcloud/logs,
(Error: Could not create directory [/usr/share/httpd/.config/gcloud/logs/2025.01.06]: Permission denied.
Please verify that you have permissions to write to the parent directory..
The configuration directory may not be writable. To learn more, see https://cloud.google.com/sdk/docs/configurations#creating_a_configuration
ERROR: (gcloud.compute.disks.list) Could not create directory [/usr/share/httpd/.config/gcloud]: Permission denied.
Please verify that you have permissions to write to the parent directory.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So, here&amp;rsquo;s the fix. The .config directory under /usr/share/httpd/ is missing.&lt;/p&gt;</description></item><item><title>hls player</title><link>http://uly.me/posts/hls-player/</link><pubDate>Mon, 06 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/hls-player/</guid><description>&lt;p&gt;Here&amp;rsquo;s an HLS video player using hls.js.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;script src=&amp;#34;https://cdnjs.cloudflare.com/ajax/libs/hls.js/0.5.14/hls.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;video id=&amp;#34;video&amp;#34; controls muted autoplay style=&amp;#34;width: 80%&amp;#34;&amp;gt;&amp;lt;/video&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;script&amp;gt;
var video = document.getElementById(&amp;#39;video&amp;#39;);
var videoSrc = &amp;#39;/bunny/output.m3u8&amp;#39;;
// Initialize HLS.js if supported
if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource(videoSrc);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () {
video.muted = true;
video.play();
});
} else if (video.canPlayType(&amp;#39;application/vnd.apple.mpegurl&amp;#39;)) {
video.src = videoSrc;
}
// Assuming you have a reference to your video element
const videoElement = document.getElementById(&amp;#39;video&amp;#39;);
// Style the video element to center it both horizontally and vertically
videoElement.style.display = &amp;#39;block&amp;#39;; // Ensure it behaves like a block element
videoElement.style.margin = &amp;#39;0 auto&amp;#39;; // Center it horizontally
videoElement.style.position = &amp;#39;absolute&amp;#39;; // Position it absolutely to center vertically
videoElement.style.top = &amp;#39;50%&amp;#39;; // Vertically center
videoElement.style.left = &amp;#39;50%&amp;#39;; // Horizontally center
videoElement.style.transform = &amp;#39;translate(-50%, -50%)&amp;#39;; // Adjust for exact centering
videoElement.style.maxWidth = &amp;#39;90%&amp;#39;; // Optional: limit the video size to 90% of the screen width
videoElement.style.maxHeight = &amp;#39;80vh&amp;#39;; // Optional: limit the video height to 80% of the viewport height
// Create a button to unmute the player
const unmuteButton = document.createElement(&amp;#39;button&amp;#39;);
unmuteButton.textContent = &amp;#39;Unmute&amp;#39;;
// Style the button to make it bigger
unmuteButton.style.fontSize = &amp;#39;30px&amp;#39;; // Larger font size
unmuteButton.style.padding = &amp;#39;20px 40px&amp;#39;; // Larger button size
unmuteButton.style.backgroundColor = &amp;#39;#007BFF&amp;#39;; // Button color
unmuteButton.style.color = &amp;#39;white&amp;#39;; // Text color
unmuteButton.style.border = &amp;#39;none&amp;#39;; // Remove border
unmuteButton.style.borderRadius = &amp;#39;10px&amp;#39;; // Rounded corners
unmuteButton.style.cursor = &amp;#39;pointer&amp;#39;; // Pointer cursor on hover
unmuteButton.style.position = &amp;#39;absolute&amp;#39;; // Absolute positioning
unmuteButton.style.top = &amp;#39;50%&amp;#39;; // Vertically center
unmuteButton.style.left = &amp;#39;50%&amp;#39;; // Horizontally center
unmuteButton.style.transform = &amp;#39;translate(-50%, -50%)&amp;#39;; // Adjust for exact centering
// Add an event listener to the button
unmuteButton.addEventListener(&amp;#39;click&amp;#39;, () =&amp;gt; {
videoElement.muted = false; // Unmute the video
unmuteButton.remove(); // Remove the button once clicked
});
// Add the button to the DOM
document.body.appendChild(unmuteButton);
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>generate qrcode</title><link>http://uly.me/posts/generate-qrcode/</link><pubDate>Sun, 05 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/generate-qrcode/</guid><description>&lt;p&gt;This is a Python code that generates QR Codes. Save file as qrcode.py. Provide a URL and you&amp;rsquo;re good to go.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import pyqrcode
from pyqrcode import QRCode
# String which represent the QR code
s = &amp;#34;https://uly.me&amp;#34;
# Generate QR code
url = pyqrcode.create(s)
# Create and save the png file naming &amp;#34;myqr.png&amp;#34;
url.svg(&amp;#34;site.svg&amp;#34;, scale = 8)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I use Python&amp;rsquo;s virtual environment for my programs so each one is isolated. Here&amp;rsquo;s the command to start one.&lt;/p&gt;</description></item><item><title>delete files recursively</title><link>http://uly.me/posts/delete-files-recursively/</link><pubDate>Wed, 01 Jan 2025 00:00:00 +0000</pubDate><guid>http://uly.me/posts/delete-files-recursively/</guid><description>&lt;p&gt;Here&amp;rsquo;s one way to delete files recursively in the current directory in Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /home/ulysses/photos/
find . -name &amp;#34;*.pp3&amp;#34; -type f -delete
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The run command with delete is fast. The files are gone in seconds.&lt;/p&gt;</description></item><item><title>install azure cli</title><link>http://uly.me/posts/install-azure-cli/</link><pubDate>Mon, 30 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-azure-cli/</guid><description>&lt;p&gt;Install the Azure CLI on a Linux Desktop. This one of 2 options, but this is by far the easiest.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Validate Azure CLI is installed&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;az --version
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To upgrade&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;az upgrade
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>logitech keyboard bluetooth linux</title><link>http://uly.me/posts/logitech-keyboard-bluetooth-linux/</link><pubDate>Fri, 27 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/logitech-keyboard-bluetooth-linux/</guid><description>&lt;p&gt;These are the steps taken to make my Logitech K811 keyboard to connect via Bluetooth in Linux Mint.&lt;/p&gt;
&lt;p&gt;Run bluetoothctl&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;bluetoothctl
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the bluetoothctl command line run these commands. Replace with your own device number.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;remove 00:XX:XX:XX:XX:1F
scan on
pair 00:XX:XX:XX:XX:1F
connect 00:XX:XX:XX:XX:1F
trust 00:XX:XX:XX:XX:1F
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You may be asked to type a six digit code to pair the device.&lt;/p&gt;</description></item><item><title>split file into multiple files</title><link>http://uly.me/posts/split-file-into-multiple-files/</link><pubDate>Thu, 26 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/split-file-into-multiple-files/</guid><description>&lt;p&gt;How to split a file into multiple files. In this example, it&amp;rsquo;s split in lines of 100.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# Input file name
input_file=&amp;#34;$1&amp;#34;
# Lines per file
lines_per_file=100
# Check if input file exists
if [ ! -f &amp;#34;$input_file&amp;#34; ]; then
echo &amp;#34;Error: Input file &amp;#39;$input_file&amp;#39; not found.&amp;#34;
exit 1
fi
# Get the number of lines in the input file
total_lines=$(wc -l &amp;lt; &amp;#34;$input_file&amp;#34;)
# Calculate the number of output files needed
num_files=$(( (total_lines + lines_per_file - 1) / lines_per_file ))
# Loop through the input file and split it into multiple files
for ((i=1; i&amp;lt;=num_files; i++)); do
# Output file name
output_file=&amp;#34;${input_file}_part${i}&amp;#34;
# Extract lines from the input file
head -n &amp;#34;$((i * lines_per_file))&amp;#34; &amp;#34;$input_file&amp;#34; | tail -n &amp;#34;$lines_per_file&amp;#34; &amp;gt; &amp;#34;$output_file&amp;#34;
done
echo &amp;#34;File &amp;#39;$input_file&amp;#39; split into $num_files files.&amp;#34;
exit 0
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>copy files from directory to directory</title><link>http://uly.me/posts/copy-files-from-directory-to-directory/</link><pubDate>Wed, 25 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/copy-files-from-directory-to-directory/</guid><description>&lt;p&gt;How to copy files from source to the target directory. Copy only if file is not present in the target.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
source=&amp;#34;/home/ulysses/Cameras/fujifilm&amp;#34;
target=&amp;#34;/home/ulysses/Cameras/Fujifilm&amp;#34;
output=&amp;#34;output.txt&amp;#34;
&amp;gt; $output
# Check if source directory exists
if [ ! -d &amp;#34;$source&amp;#34; ]; then
echo &amp;#34;Error: Directory &amp;#39;$source&amp;#39; does not exist.&amp;#34;
exit 1
fi
# Find all JPG files in the source directory
find &amp;#34;$source&amp;#34; -type f -iname &amp;#34;*.JPG&amp;#34; | while read -r file; do
# Get the basename.
filename=$(basename &amp;#34;$file&amp;#34;)
# Check if filename is in target directory.
if find &amp;#34;$target&amp;#34; -type f -name &amp;#34;$filename&amp;#34; -print -quit | grep -q .; then
true
else
# Copy file from source to target.
cp $source/$filename $target/100_FUJI/
echo &amp;#34;Copying $file to $target/100_FUJI.&amp;#34; | tee -a $output
fi
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>tar multiple directories to targz</title><link>http://uly.me/posts/tar-multiple-directories-to-targz/</link><pubDate>Sun, 22 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tar-multiple-directories-to-targz/</guid><description>&lt;p&gt;Tar multiple directories to a single tar.gz file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar -czvf /home/ulysses/Code/backup.tar.gz ~/Documents/ ~/Downloads ~/Git/gcloud/ ~/Pictures ~/Videos
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To list files inside the tar.gz file, run this.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar -tzvf /home/ulysses/Code/backup.tar.gz
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create image with license</title><link>http://uly.me/posts/gcp-create-image-with-license/</link><pubDate>Wed, 18 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-image-with-license/</guid><description>&lt;p&gt;Here&amp;rsquo;s the gcloud command to create a new image with an extended license with an option to add family type.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud beta compute images create new-image-with-license \
--source-image=this-is-the-source-image \
--family rocky-9 \
--project your-project-id \
--user-licenses=https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-7-els
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Any VM provisioned using this image will now have the extended license.&lt;/p&gt;</description></item><item><title>gsutil copy local recursively to bucket</title><link>http://uly.me/posts/gsutil-copy-local-recursively-to-bucket/</link><pubDate>Tue, 17 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gsutil-copy-local-recursively-to-bucket/</guid><description>&lt;p&gt;Here&amp;rsquo;s a gsutil command to copy a directory recursively to a GCS bucket via parallel uploads.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Define source and destination
SOURCE_DIR=&amp;#34;/path/to/local/directory&amp;#34;
DEST_BUCKET=&amp;#34;gs://your-bucket-name&amp;#34;
# Use gsutil with the -m flag for parallel uploads
gsutil -m cp -r &amp;#34;$SOURCE_DIR&amp;#34; &amp;#34;$DEST_BUCKET&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>logitech keyboard bluetooth issues</title><link>http://uly.me/posts/logitech-keyboard-bluetooth-issues/</link><pubDate>Tue, 17 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/logitech-keyboard-bluetooth-issues/</guid><description>&lt;p&gt;I fixed my Bluetooth issues with my Logitech K811 keyboard on Linux Mint&lt;/p&gt;
&lt;p&gt;Take note of your device ID in a similar format as a MAC Address.&lt;/p&gt;
&lt;p&gt;Here are the steps I took to fix the pairing issue.&lt;/p&gt;
&lt;p&gt;Run bluetoothctl, you will get a special prompt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;bluetoothctl
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Perform a scan. Copy the device ID.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;scan on
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove the device.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;remove ID
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Finally reconnect device.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;connect ID
trust ID
pair ID
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You may be prompted to enter the pairing code.&lt;/p&gt;</description></item><item><title>python copy files gcs bucket</title><link>http://uly.me/posts/python-copy-files-gcs-bucket/</link><pubDate>Tue, 17 Dec 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/python-copy-files-gcs-bucket/</guid><description>&lt;p&gt;I have a Python script that copies files from a local directory to a GCS bucket and down a couple of directories.&lt;/p&gt;
&lt;p&gt;The script was tested in a Python virtual environment. Google Cloud Storage module is required which can be installed via pip.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pip install google-cloud-storage
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you have trouble running pip, you may have to run this on Linux Mint (Ubuntu) to update the virtual environment.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install python3.12-venv
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For authentication, you will need to download the service account credentials key that has write access to the GCS bucket.&lt;/p&gt;</description></item><item><title>generating a bash script</title><link>http://uly.me/posts/generating-a-bash-script/</link><pubDate>Fri, 08 Nov 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/generating-a-bash-script/</guid><description>&lt;p&gt;Here&amp;rsquo;s the code for a bash script that generates another bash script and then executes it, as well as deletes it in the end.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# Define the script content
script_content=&amp;#39;#!/bin/bash
echo &amp;#34;Hello, this is the generated script!&amp;#34;
echo &amp;#34;The current date and time is: $(date)&amp;#34;
&amp;#39;
# Define the name of the new script
new_script=&amp;#34;generated_script.sh&amp;#34;
# Write the content to the new script file
echo &amp;#34;$script_content&amp;#34; &amp;gt; &amp;#34;$new_script&amp;#34;
# Make the new script executable
chmod +x &amp;#34;$new_script&amp;#34;
# Execute the new script
./&amp;#34;$new_script&amp;#34;
rm -f $new_script
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>lower to upper vice versa</title><link>http://uly.me/posts/lower-to-upper-vice-versa/</link><pubDate>Wed, 11 Sep 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lower-to-upper-vice-versa/</guid><description>&lt;p&gt;How to convert uppercase to lowercase and vice versa.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;upper_project=$(echo &amp;#34;$project&amp;#34; | tr &amp;#39;[:lower:]&amp;#39; &amp;#39;[:upper:]&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Vice versa&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lower_project=$(echo &amp;#34;$project&amp;#34; | tr &amp;#39;[:upper:]&amp;#39; &amp;#39;[:lower:]&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display output&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo $upper_project
echo $lower_project
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>fixing apache errors</title><link>http://uly.me/posts/fixing-apache-errors/</link><pubDate>Sun, 04 Aug 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fixing-apache-errors/</guid><description>&lt;p&gt;I was getting an Apache error on startup and during a restart after upgrading to Linux Mint 22.&lt;/p&gt;
&lt;p&gt;As it turned out, the module that&amp;rsquo;s enabled is php8.1. It should be 8.3.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the fix:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo a2dismod php8.1
sudo systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This did the trick, but I was getting another error during restarting services.&lt;/p&gt;
&lt;p&gt;The error says &amp;ldquo;could not reliably determin the server fully qualified domain.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the fix for that.&lt;/p&gt;</description></item><item><title>git undo last commit</title><link>http://uly.me/posts/git-undo-last-commit/</link><pubDate>Wed, 12 Jun 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-undo-last-commit/</guid><description>&lt;p&gt;How to undo git&amp;rsquo;s last commit.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git reset --soft HEAD~
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Undo the last 2 commits.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git reset --soft HEAD~2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Undo local changes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git reset --hard abcd543
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>pulseaudio auto start</title><link>http://uly.me/posts/pulseaudio-auto-start/</link><pubDate>Tue, 04 Jun 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/pulseaudio-auto-start/</guid><description>&lt;p&gt;I&amp;rsquo;m trying to figure out why my audio is not automatically starting on Linux.&lt;/p&gt;
&lt;p&gt;After some trial and error, here&amp;rsquo;s the fix.&lt;/p&gt;
&lt;p&gt;Edit the /etc/pulse/client.conf file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vi /etc/pulse/client.conf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change &amp;ldquo;autospawn=no&amp;rdquo; to &amp;ldquo;autospawn=yes.&amp;rdquo;&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;autospawn=yes
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Make sure to take out &amp;lsquo;;&amp;rsquo; or &amp;lsquo;#&amp;quot; to remove the comment.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pulseaudio --start
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once you modified the file, restart pulseaudio.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pulseaudio --start
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot your machine to check if audio is working on boot.&lt;/p&gt;
&lt;p&gt;If that doesn&amp;rsquo;t work, delete the cookie.&lt;/p&gt;</description></item><item><title>linux mint dummy output</title><link>http://uly.me/posts/linux-mint-dummy-output/</link><pubDate>Sun, 26 May 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-mint-dummy-output/</guid><description>&lt;p&gt;Somehow I lost my audio devices in Linux Mint. Instead, the only audio device present in the system is the &amp;lsquo;dummy output.&amp;rsquo; Googling for answers was not clear cut. After many trials and errors I was able to get my sound fixed. Here are the commands I took to get my audio devices back in the fold in Linux Mint. Your mileage may vary.&lt;/p&gt;
&lt;p&gt;First, validate your sound devices are still present or being recognized on your system.&lt;/p&gt;</description></item><item><title>gcp exit serial console</title><link>http://uly.me/posts/gcp-exit-serial-console/</link><pubDate>Thu, 11 Apr 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-exit-serial-console/</guid><description>&lt;p&gt;How to exit gracefully from GCP&amp;rsquo;s serial console.&lt;/p&gt;
&lt;p&gt;Type on the keyboard tilde followed by dot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;~.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That would be tilde followed by a dot.&lt;/p&gt;</description></item><item><title>bash function comments</title><link>http://uly.me/posts/bash-function-comments/</link><pubDate>Fri, 05 Apr 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-function-comments/</guid><description>&lt;p&gt;Here&amp;rsquo;s a good way to add comments to a Bash function.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;############################################################
# Function : calculate_average
# Description : Calculates the average of a list of numbers.
# Parameters : List of numbers separated by spaces
# Returns : The average value of the input numbers
############################################################
calculate_average() {
...
}
############################################################
# Function : calculate_sum
# Description : Calculates the sum of a list of numbers.
# Parameters : List of numbers separated by spaces
# Returns : The sum value of the input numbers
############################################################
calculate_sum() {
...
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>add to crontab with no duplicate</title><link>http://uly.me/posts/add-to-crontab-with-no-duplicate/</link><pubDate>Sun, 17 Mar 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-to-crontab-with-no-duplicate/</guid><description>&lt;p&gt;How to add to a crontab without creating duplicates.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;crontab -l | grep &amp;#39;myscript.sh&amp;#39; || (crontab -l 2&amp;gt;/dev/null; echo &amp;#34;45 10 * * * /path/to/myscript.sh&amp;#34;) | crontab -
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>diff files in two directories</title><link>http://uly.me/posts/diff-files-in-two-directories/</link><pubDate>Thu, 07 Mar 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/diff-files-in-two-directories/</guid><description>&lt;p&gt;Here&amp;rsquo;s a good way to compare two directories to see if both directories contain similar files.&lt;/p&gt;
&lt;p&gt;This is essential if you want to combine two directories into one.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;diff -qr dir1 dir2 | sort
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>timestamp timezone conversion</title><link>http://uly.me/posts/timestamp-timezone-conversion/</link><pubDate>Sat, 24 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/timestamp-timezone-conversion/</guid><description>&lt;p&gt;Here&amp;rsquo;s a function that will convert a timestamp from one timezone to another, in this case from UTC to ET timezone.&lt;/p&gt;
&lt;p&gt;Get a list of snapshots&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;list_snapshots() {
volume_name=&amp;#34;$1&amp;#34;
snapshots=$(gcloud compute snapshots list --filter=&amp;#34;sourceDisk=$volume_name&amp;#34; --format=&amp;#34;value(name,creationTimestamp.date(&amp;#39;%s&amp;#39;))&amp;#34;)
while read -r snapshot; do
snapshot_name=$(echo &amp;#34;$snapshot&amp;#34; | cut -d&amp;#39; &amp;#39; -f1)
creation_timestamp=$(echo &amp;#34;$snapshot&amp;#34; | cut -d&amp;#39; &amp;#39; -f2)
et_creation_timestamp=$(convert_to_et &amp;#34;$creation_timestamp&amp;#34;)
echo &amp;#34;Snapshot: $snapshot_name, Creation Time (ET): $et_creation_timestamp&amp;#34;
done &amp;lt;&amp;lt;&amp;lt; &amp;#34;$snapshots&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The function to convert to ET timezone.&lt;/p&gt;</description></item><item><title>ddwrt</title><link>http://uly.me/posts/ddwrt/</link><pubDate>Thu, 22 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ddwrt/</guid><description>&lt;p&gt;After a few weeks with OpenWRT, I decided to switch over to DDWRT. There is nothing wrong with OpenWRT. DDWRT is a much simpler interface.&lt;/p&gt;
&lt;p&gt;It seems to be very stable as well. I don&amp;rsquo;t recall any reboots other than service provider having an internet issue.&lt;/p&gt;
&lt;p&gt;I think that was a great decision while still using old router hardware, a Linksys E4200 circa 2011 (release date).&lt;/p&gt;
&lt;p&gt;One of these days I will have to purchase a new router, but why fix something that not broken.&lt;/p&gt;</description></item><item><title>brigthen</title><link>http://uly.me/posts/brigthen/</link><pubDate>Mon, 19 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/brigthen/</guid><description>&lt;p&gt;A little Python script to brighten an image.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import os
from PIL import ImageEnhance, Image
def brightenImage(input_dir, output_dir):
os.makedirs(output_dir, exist_ok=True) # output directory
for filename in os.listdir(input_dir): # loop through files
if filename.lower().endswith(&amp;#39;.jpg&amp;#39;): # check if jpg
with Image.open(os.path.join(input_dir, filename)) as img: # open jpg
enhanced_img = ImageEnhance.Contrast(img).enhance(1.25) # enhance contrast
enhanced_img = ImageEnhance.Brightness(enhanced_img).enhance(1.5) # enhance brightness
enhanced_img.save(os.path.join(output_dir, filename)) # save output
if __name__ == &amp;#39;__main__&amp;#39;:
input_directory = &amp;#39;.&amp;#39; # input directory
output_directory = &amp;#39;output&amp;#39; # output directory
brightenImage(input_directory, output_directory) # brighten image
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>enhance</title><link>http://uly.me/posts/enhance/</link><pubDate>Mon, 19 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/enhance/</guid><description>&lt;p&gt;Here&amp;rsquo;s a litte Python script that enhance a jpg image.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import os
from PIL import ImageEnhance, Image
def enhance(input_dir, output_dir, factor=1.75):
os.makedirs(output_dir, exist_ok=True) # Create output directory
for filename in os.listdir(input_dir): # Loop through all files
if filename.lower().endswith(&amp;#39;.jpg&amp;#39;): # Check if JPG image
with Image.open(os.path.join(input_dir, filename)) as img: # Open the image file
enhanced_img = ImageEnhance.Color(img).enhance(factor) # Enhance image
enhanced_img.save(os.path.join(output_dir, filename)) # Save image
if __name__ == &amp;#39;__main__&amp;#39;:
input_directory = &amp;#39;.&amp;#39; # input directory
output_directory = &amp;#39;output&amp;#39; # output directory
enhance(input_directory, output_directory) # enhance
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>resize</title><link>http://uly.me/posts/resize/</link><pubDate>Mon, 19 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/resize/</guid><description>&lt;p&gt;Here&amp;rsquo;s a little Python script that creates thumbnails.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import os
from PIL import Image
def resize(input_dir, output_dir, thumbnail_size=(720, 720)): # set to 720p
os.makedirs(output_dir, exist_ok=True) # output directory
for filename in os.listdir(input_dir): # loop through files
if filename.lower().endswith(&amp;#39;.jpg&amp;#39;): # check if JPG
with Image.open(os.path.join(input_dir, filename)) as img: # open image
img.thumbnail(thumbnail_size) # reduce to thumbnail
img.save(os.path.join(output_dir, filename)) # save thumbnail
if __name__ == &amp;#39;__main__&amp;#39;:
input_directory = &amp;#39;.&amp;#39; # input directory
output_directory = &amp;#39;output&amp;#39; # output directory
resize(input_directory, output_directory) # resize images
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>vintage</title><link>http://uly.me/posts/vintage/</link><pubDate>Mon, 19 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vintage/</guid><description>&lt;p&gt;Here&amp;rsquo;s a little Python script that makes vintage pictures.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import os
from PIL import Image, ImageFilter, ImageOps, ImageEnhance
def vintage(input_dir, output_dir):
os.makedirs(output_dir, exist_ok=True) # output directory
for filename in os.listdir(input_dir): # Loop through files
if filename.lower().endswith(&amp;#39;.jpg&amp;#39;): # Check if JPG
with Image.open(os.path.join(input_dir, filename)) as img: # Open jpg
img = img.convert(&amp;#34;RGB&amp;#34;) # vintage effects
img = ImageOps.grayscale(img)
img = img.filter(ImageFilter.SMOOTH_MORE)
img = ImageOps.posterize(img, 8)
img = ImageEnhance.Contrast(img).enhance(1.4)
img = ImageEnhance.Brightness(img).enhance(1.75)
img = ImageOps.colorize(img, &amp;#34;#704214&amp;#34;, &amp;#34;#eeeeee&amp;#34;)
img = ImageEnhance.Color(img).enhance(0.8)
img.save(os.path.join(output_dir, filename)) # Save image
if __name__ == &amp;#39;__main__&amp;#39;:
input_directory = &amp;#39;.&amp;#39; # input directory
output_directory = &amp;#39;output&amp;#39; # output directory
vintage(input_directory, output_directory) # make vintage
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>white balance</title><link>http://uly.me/posts/white-balance/</link><pubDate>Mon, 19 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/white-balance/</guid><description>&lt;p&gt;Here&amp;rsquo;s a little Python script that corrects white balance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import os
from PIL import Image
def whiteBalance(input_dir, output_dir, red_ratio=1.0, blue_ratio=1.0):
os.makedirs(output_dir, exist_ok=True) # output directory
for filename in os.listdir(input_dir): # Loop through files
if filename.lower().endswith((&amp;#39;.jpg&amp;#39;, &amp;#39;.jpeg&amp;#39;, &amp;#39;.png&amp;#39;)): # Check if image
with Image.open(os.path.join(input_dir, filename)) as img: # Open the image
red_channel = img.getchannel(&amp;#39;R&amp;#39;) # wb correction
green_channel = img.getchannel(&amp;#39;G&amp;#39;)
blue_channel = img.getchannel(&amp;#39;B&amp;#39;)
red_channel = red_channel.point(lambda p: min(int(p * red_ratio), 255)) # Adjust colors
blue_channel = blue_channel.point(lambda p: min(int(p * blue_ratio), 255))
corrected_img = Image.merge(&amp;#39;RGB&amp;#39;, (red_channel, green_channel, blue_channel)) # merge colors
corrected_img.save(os.path.join(output_dir, filename)) # Save image
if __name__ == &amp;#39;__main__&amp;#39;:
input_directory = &amp;#39;.&amp;#39; # input directory
output_directory = &amp;#39;output&amp;#39; # output directory
red_ratio = 0.9 # Adjust red
blue_ratio = 1.5 # Adjust blue
whiteBalance(input_directory, output_directory, red_ratio, blue_ratio) # Correct wb
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>black and white</title><link>http://uly.me/posts/black-and-white/</link><pubDate>Tue, 13 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/black-and-white/</guid><description>&lt;p&gt;Here&amp;rsquo;s a Python code to convert JPG pictures to black and white.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import os
from PIL import Image
# black and white
def blackWhite(input_dir, output_dir):
os.makedirs(output_dir, exist_ok=True) # output directory
for filename in os.listdir(input_dir): # loop all files
if filename.lower().endswith(&amp;#39;.jpg&amp;#39;): # Check if JPG image
with Image.open(os.path.join(input_dir, filename)) as img: # Open image file
bw_img = img.convert(&amp;#39;L&amp;#39;) # Convert to bw
bw_img.save(os.path.join(output_dir, filename)) # Save bw
if __name__ == &amp;#39;__main__&amp;#39;:
input_directory = &amp;#39;.&amp;#39; # input directory
output_directory = &amp;#39;output&amp;#39; # output directory
blackWhite(input_directory, output_directory) # conver to bw
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>nef to jpg</title><link>http://uly.me/posts/nef-to-jpg/</link><pubDate>Mon, 12 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nef-to-jpg/</guid><description>&lt;p&gt;If you have a Nikon DSLR camera and you shoot in RAW format, you&amp;rsquo;ll end up with a NEF file. You can easily convert several NEF files to JPG by running a Python script. It&amp;rsquo;s fast and works fairly well. If you want to run in a controlled Python environment, I suggest that you create a virtual environment. You can group all your imaging scripts in one virtual environment.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the code to convert NEF files to JPG.&lt;/p&gt;</description></item><item><title>oh-my-posh</title><link>http://uly.me/posts/oh-my-posh/</link><pubDate>Sun, 11 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/oh-my-posh/</guid><description>&lt;p&gt;If you are tired of using the default Terminal prompt, then give &lt;a href="https://ohmyposh.dev"&gt;oh-my-posh&lt;/a&gt; a try.&lt;/p&gt;
&lt;p&gt;Whether you&amp;rsquo;re using bash in Linux or zsh on a Mac, oh-my-posh can style your prompt.&lt;/p&gt;
&lt;p&gt;Get familiar with oh-my-posh&amp;rsquo;s syntax. It&amp;rsquo;s not difficult once you get rolling.&lt;/p&gt;
&lt;p&gt;Browse several of the themes available on their &lt;a href="https://ohmyposh.dev"&gt;site&lt;/a&gt; to get ideas.&lt;/p&gt;
&lt;p&gt;Head over to &lt;a href="https://www.canva.com/colors/color-palette-generator/"&gt;Canva.com&lt;/a&gt; to get a color palette.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s my current &lt;a href="https://gist.github.com/ulyssesronquillo/d66cfea9a266692e40f4aa19b06ccf9c"&gt;prompt&lt;/a&gt; setup.&lt;/p&gt;</description></item><item><title>jump start power supply</title><link>http://uly.me/posts/jump-start-power-supply/</link><pubDate>Tue, 06 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/jump-start-power-supply/</guid><description>&lt;p&gt;A week ago, I was messing around with my motherboard trying to fix my RGB lights so that the RGB lights can all be controlled from one controller. I accidentally short-circuited something on the motherboard. The computer kept running to my suprise, but immediately after powering down the system, the computer would no longer power up. I thought I had fried my power supply. Worse, I may have fried the motherboard.&lt;/p&gt;</description></item><item><title>supportconfig options</title><link>http://uly.me/posts/supportconfig-options/</link><pubDate>Tue, 06 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/supportconfig-options/</guid><description>&lt;p&gt;I ran supportconfig on a system the other day and it took all night. I gave up and killed it.&lt;/p&gt;
&lt;p&gt;So, here are a few options that you can try to speed things up.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;supportconfig -o OFILES,CRASH,FILES,PROC,NFS,LDAP,SSSD
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Hope that helps.&lt;/p&gt;</description></item><item><title>gcp create hyperdisks</title><link>http://uly.me/posts/gcp-create-hyperdisks/</link><pubDate>Mon, 05 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-hyperdisks/</guid><description>&lt;p&gt;GCP has new generation of disks for demanding and mission-critical applications. Hyperdisks is not available on all VMs, but they are usually available on large machine types. You create a Hyperdisk from scratch and attach it to an existing VM or convert a current disk by way of a snapshot. Here&amp;rsquo;s the script to convert it an existing disk to Hyperdisk from a snapshot.&lt;/p&gt;
&lt;p&gt;There are 3 types of Hyperdisks&lt;/p&gt;</description></item><item><title>display ip addresses</title><link>http://uly.me/posts/display-ip-addresses/</link><pubDate>Sun, 04 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-ip-addresses/</guid><description>&lt;p&gt;Here&amp;rsquo;s a little script to display my internal and external IP addresses.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
main() {
my_int_ip=$(ip addr show enp4s0 | grep -w &amp;#39;inet&amp;#39; | awk &amp;#39;{print $2}&amp;#39;)
my_ext_ip=$(curl -s -4 ifconfig.me)
echo &amp;#39;External IP: &amp;#39; $my_ext_ip
echo &amp;#39;Internal IP: &amp;#39; $my_int_ip
}
main
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;External IP: xxx.xxx.xxx.xxx
Internal IP: 192.168.0.100
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>openwrt</title><link>http://uly.me/posts/openwrt/</link><pubDate>Sun, 04 Feb 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/openwrt/</guid><description>&lt;p&gt;My Ubiquiti router stopped working several months ago after many years of working almost flawlessly. I replaced it with an older Linksys E4200 router that I found in a plastic container in in the garage. The Linksys router has been stable, but it&amp;rsquo;s showing its age. It was released back in January of 2011. I thought about replacing my router with another Ubiquiti, but I can&amp;rsquo;t complain since the Linksys E4200 is working just fine. The other night I upgraded and changed the firmware and installed OpenWrt, an open-source firmware based on a Linux operating system that runs on many older routers. OpenWrt gives my router extensibility by providing features that you typically find only on high-end devices. It also gives me higher security since there are many added features. Firmware updates are published regularly which you&amp;rsquo;ll never receive on older routers since many hardware manufacturers no longer support their old routers. Performance is much better. Stability is another plus. And most of all, the price is right. OpenWrt is free. If you want to give an old router some life, give OpenWrt a try. By the way, you can get an old E4200 router in eBay for $15.00.&lt;/p&gt;</description></item><item><title>display dashes across screen</title><link>http://uly.me/posts/display-dashes-across-screen/</link><pubDate>Tue, 23 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-dashes-across-screen/</guid><description>&lt;p&gt;Here&amp;rsquo;s the traditional way of displaying a list of dashes across the screen.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo &amp;#34;====================&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here&amp;rsquo;s the short cut.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;printf -- &amp;#39;=%.s&amp;#39; {1..20}; echo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Explanation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;first I&amp;rsquo;m using printf instead of echo. printf is a little bit better when it comes to formatting.&lt;/li&gt;
&lt;li&gt;The &amp;ndash; option tells printf to ignore the rest of the remaining arguments so it renders properly.&lt;/li&gt;
&lt;li&gt;The character before the % percentage is the one being repeated. In this case, we are repeating &amp;ldquo;=.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;1-20 is the number of times the character before the % percentage is repeated.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;rsquo;s it.&lt;/p&gt;</description></item><item><title>gcp check login</title><link>http://uly.me/posts/gcp-check-login/</link><pubDate>Mon, 22 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-check-login/</guid><description>&lt;p&gt;If you are running a gcloud commands, it will be good to know if a user is still logged in. In some corporate settings, authentication is set to time out after a number of hours. The following lines of code checks if a user is still loggedin and displays a message to reauthenticate if logged out. In reality the script runs a list of GCP projects, but limits the output to just one line. The output is sent to a file. If the first line is equal to &amp;ldquo;Reauthentication required.&amp;rdquo;, then there&amp;rsquo;s a message telling the user to login again. If the first line has an error, it means the user is not logged in. It also tells the user to login again. Here&amp;rsquo;s the code.&lt;/p&gt;</description></item><item><title>date and title</title><link>http://uly.me/posts/date-and-title/</link><pubDate>Sat, 20 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/date-and-title/</guid><description>&lt;p&gt;Previously, I was showing both dates and titles on the main index page. Here&amp;rsquo;s the date format if I&amp;rsquo;ll ever need it again.&lt;/p&gt;
&lt;p&gt;{% raw %}&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;{% endraw %}&lt;/p&gt;</description></item><item><title>vim navigation commands</title><link>http://uly.me/posts/vim-navigation-commands/</link><pubDate>Wed, 17 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vim-navigation-commands/</guid><description>&lt;p&gt;Vim is a terminal editor in Linux, Mac and Windows system if it&amp;rsquo;s installed. To be really efficient in using vim, you&amp;rsquo;ll need to master a few very important keystrokes. So, here&amp;rsquo;s a list of common vim keystrokes that can improve your vim experience.&lt;/p&gt;
&lt;p&gt;Cursor movement&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;h - move cursor left
l - move cursor right
k - move cursor up
j - move cursor down
H - move cursor to top of screen
M - move cursor to middle of screen
L - move cursor to bottom of screen
w - jump forward to the start of a word
e - jump forward to the end of a word
b - jump backwards to the start of a word
0 - jump to the start of the line
$ - jump to the end of the line
gg - go to the first line of the document
G - go the last line of the decoment
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Insert mode&lt;/p&gt;</description></item><item><title>gcloud vm alias ip</title><link>http://uly.me/posts/gcloud-vm-alias-ip/</link><pubDate>Sat, 13 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcloud-vm-alias-ip/</guid><description>&lt;p&gt;In my [previous post]({% post_url 2024-01-12-terraform-gcp-vm-alias-ip %}), I&amp;rsquo;ve provisioned a vm with an alias ip using terraform. In this post, I will do the same but will use gcloud commands.&lt;/p&gt;
&lt;p&gt;First, let&amp;rsquo;s reserve an internal ip address.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute addresses create host-alias-ip \
--addresses 10.10.10.10
--region us-central1 \
--subnet projects/projectid/regions/us-central1/subnetworks/subnet-us-central1 \
--project projectid
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To allocate automatically, leave out &amp;ndash;addresses.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute addresses create host-alias-ip \
--region us-central1 \
--subnet projects/projectid/regions/us-central1/subnetworks/subnet-us-central1 \
--project projectid
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To check reservations, list all in the project.&lt;/p&gt;</description></item><item><title>terraform gcp vm alias ip</title><link>http://uly.me/posts/terraform-gcp-vm-alias-ip/</link><pubDate>Fri, 12 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-gcp-vm-alias-ip/</guid><description>&lt;p&gt;How to build a VM in GCP with a secondary alias IP. Assuming that you already have a compute and a local block in your Terraform file.&lt;/p&gt;
&lt;p&gt;Go to the locals block and add the local variables you&amp;rsquo;ll need.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;locals {
project = &amp;#34;projectId&amp;#34;
hostname = &amp;#34;yourhostname&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reserve an internal ip address by adding the &lt;strong&gt;google_compute_address&lt;/strong&gt; block to your Terraform file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;resource &amp;#34;google_compute_address&amp;#34; &amp;#34;alias-ip&amp;#34; {
name = &amp;#34;${local.hostname}-alias-ip&amp;#34;
region = &amp;#34;us-central1&amp;#34;
address_type = &amp;#34;INTERNAL&amp;#34;
subnetwork = local.subnetwork
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Inside your existing compute instance block, add the &lt;strong&gt;alias_ip_range&lt;/strong&gt; to the network interface block.&lt;/p&gt;</description></item><item><title>install xrdp</title><link>http://uly.me/posts/install-xrdp/</link><pubDate>Thu, 11 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-xrdp/</guid><description>&lt;p&gt;xrdp is a package that allows another desktop to connect to another using the rdp desktop software.&lt;/p&gt;
&lt;p&gt;Install xrdp on the target desktop.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt install xrdp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add a second user since you can&amp;rsquo;t use the default user. Use -m to create a home directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo useradd -m john
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Give new user sudo access. This is optional, but is nice to have if running root commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo usermod -a -G sudo john
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Set the user&amp;rsquo;s password.&lt;/p&gt;</description></item><item><title>jekyll target blank</title><link>http://uly.me/posts/jekyll-target-blank/</link><pubDate>Thu, 11 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/jekyll-target-blank/</guid><description>&lt;p&gt;I found a really nice gem that sets all external links to open to a new tab. It&amp;rsquo;s called jekyll-target-blank. To add, just run the following.&lt;/p&gt;
&lt;p&gt;Edit Gemfile and add this line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gem &amp;#39;jekyll-target-blank&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Edit the _config.yml file and add this line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;plugins:
- jekyll-target-blank
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run bundle install.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ bundle install
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Because I&amp;rsquo;m running Jekyll in a docker container, I had to restart it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker-compose stop
docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check your external links. They should open up to a new tab.&lt;/p&gt;</description></item><item><title>scp multiple files</title><link>http://uly.me/posts/scp-multiple-files/</link><pubDate>Tue, 09 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/scp-multiple-files/</guid><description>&lt;p&gt;scp is an excellent utility for copying files to and from a server without the need for running a ftp server or some sort of file transfer service on the server. scp uses your existing ssh access to copy files to and from a server. You will need permissions to the remote server otherwise scp copy will fail. Whether pulling down a file or pushing a file to a server, scp can be invoked from a client regardless of file direction. You can copy a single file or multiple files. The examples below demonstrate this.&lt;/p&gt;</description></item><item><title>terraform local variables</title><link>http://uly.me/posts/terraform-local-variables/</link><pubDate>Mon, 08 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-local-variables/</guid><description>&lt;p&gt;If you find yourself entering the same value multiple times in your Terraform script, you can save yourself some time by declaring local variables inside a locals block and reuse them throughout your script or module.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a locals block.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;locals {
project = &amp;#34;your_project_id&amp;#34;
hostname = &amp;#34;your_hostname&amp;#34;
machine_image = &amp;#34;your_machine_image&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once the local variables are declared, you can reuse them anywhere and as many times as you want in your Terraform script or module.&lt;/p&gt;</description></item><item><title>display elapse time</title><link>http://uly.me/posts/display-elapse-time/</link><pubDate>Wed, 03 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-elapse-time/</guid><description>&lt;p&gt;Here&amp;rsquo;s a simple Bash script that displays how long it takes for a script to run from beginning to end. This is perfect tool for long running scripts that run for hours, and where you need to know much time it took to run from beginning to end. This is ideal for a script that you&amp;rsquo;ll run unattended.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
log=&amp;#39;elapse.log&amp;#39;
&amp;gt;$log
start() {
start=$(date)
begin=$(date +%s)
echo &amp;#39;Start: &amp;#39;$start | tee -a $log
}
stop() {
stop=$(date)
end=$(date +%s)
echo &amp;#39;Stop: &amp;#39;$stop | tee -a $log
elapse=$((end-begin))
}
show_time() {
num=$elapse
min=0
hour=0
day=0
if((num&amp;gt;59));then
((sec=num%60))
((num=num/60))
if((num&amp;gt;59));then
((min=num%60))
((num=num/60))
if((num&amp;gt;23));then
((hour=num%24))
((day=num/24))
else
((hour=num))
fi
else
((min=num))
fi
else
((sec=num))
fi
echo &amp;#34;$day&amp;#34;d &amp;#34;$hour&amp;#34;h &amp;#34;$min&amp;#34;m &amp;#34;$sec&amp;#34;s | tee -a $log
}
script() {
echo &amp;#34;running script now...&amp;#34; | tee -a $log
sleep 10
}
start
script
stop
show_time
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the example above, I&amp;rsquo;m running a script that echoes text and sleeps for 10s. Here&amp;rsquo;s the output.&lt;/p&gt;</description></item><item><title>truncate titles in jekyll</title><link>http://uly.me/posts/truncate-titles-in-jekyll/</link><pubDate>Mon, 01 Jan 2024 00:00:00 +0000</pubDate><guid>http://uly.me/posts/truncate-titles-in-jekyll/</guid><description>&lt;p&gt;I switched to a slightly different format in the home page to display the date first followed by the post titles. In addition to the format change, I wanted to truncate the titles that are longer than 40 characters to display only the first 40 characters followed by 3 dots or &amp;ldquo;&amp;hellip;&amp;rdquo; at the end. The key to making this possible was to use Jekyll&amp;rsquo;s advanced &lt;a href="https://gist.github.com/JJediny/a466eed62cee30ad45e2"&gt;filters&lt;/a&gt;, and in particular, using the truncate filter. Swapping the order of date and post titles was the easy part, but the key was using the truncate filter.&lt;/p&gt;</description></item><item><title>format new volume</title><link>http://uly.me/posts/format-new-volume/</link><pubDate>Sun, 31 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/format-new-volume/</guid><description>&lt;p&gt;I recently bought a 2TB NVME SSD drive which I plan to install on my Linux Mint desktop. I have been taking a ton of pictures lately with my old Nikon D700 DSLR camera and I can use the extra space. Since the new drive is unformatted, here were the steps that I took to get it working on my desktop. This how-to assumes that I have installed the new NVME drive on your motherboard successfully.&lt;/p&gt;</description></item><item><title>how to shred a volume</title><link>http://uly.me/posts/how-to-shred-a-volume/</link><pubDate>Fri, 29 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/how-to-shred-a-volume/</guid><description>&lt;p&gt;If you have a disk drive, SSD or NVME storage device that need to be wiped clean, I recommend that you use the shred command.&lt;/p&gt;
&lt;p&gt;In this example, I&amp;rsquo;m cleaning up the contents of my NVME device at /dev/nvme0n1.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo shred -v -n 1 --random-source=/dev/urandom -z /dev/nvme0n1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I&amp;rsquo;m using these options and their explanation.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;-v is verbose&lt;/li&gt;
&lt;li&gt;-n is the number of iterations. Mine is set to 1. You can increase it, but it can take hours.&lt;/li&gt;
&lt;li&gt;&amp;ndash;random-source is set to /dev/urandom which is the kernel&amp;rsquo;s random number generator.&lt;/li&gt;
&lt;li&gt;-z means everything gets overwritten by zeros.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Shred will make it nearly impossible to steal your data.&lt;/p&gt;</description></item><item><title>bash input options</title><link>http://uly.me/posts/bash-input-options/</link><pubDate>Wed, 27 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-input-options/</guid><description>&lt;p&gt;Here are input options that you can use in Bash.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You can set variables within the script.&lt;/li&gt;
&lt;li&gt;You can pass the arguments via command line.&lt;/li&gt;
&lt;li&gt;You can prompt the user to input data.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Or you create a script that incorporates all three.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Remove comments if you want to set the variables in the script.&lt;/li&gt;
&lt;li&gt;Pass arguments via command line using the format provided.&lt;/li&gt;
&lt;li&gt;Or be prompted to enter all your arguments one at a time.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# project=&amp;#34;projectid&amp;#34;
# instance=&amp;#34;hostname&amp;#34;
# zone=&amp;#34;us-central1-c&amp;#34;
# policy=&amp;#34;hourly&amp;#34;
# snapback=3
# Format (requires all 5 arguments): ./script.sh project host zone policy snapback
# If no arguments are provided or less than 5 arguments, you will be prompted to enter your options.
if [ -z &amp;#34;$project&amp;#34; ] || [ -z &amp;#34;$instance&amp;#34; ] || [ -z &amp;#34;$zone&amp;#34; ] || [ -z &amp;#34;$policy&amp;#34; ] || [ -z &amp;#34;$snapback&amp;#34; ]; then
if [ &amp;#34;$#&amp;#34; -eq 5 ]; then
project=$1
instance=$2
zone=$3
policy=$4
snapback=$5
else
read -p &amp;#34;projectId : &amp;#34; project
read -p &amp;#34;instance : &amp;#34; instance
read -p &amp;#34;zone : &amp;#34; zone
read -p &amp;#34;policy : &amp;#34; policy
read -p &amp;#34;snapback : &amp;#34; snapback
fi
fi
echo $project $instance $zone $policy $snapback
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Bash function within a function</title><link>http://uly.me/posts/bash-function-within-a-function/</link><pubDate>Sun, 24 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-function-within-a-function/</guid><description>&lt;p&gt;How to make a function call within a function in Bash.&lt;/p&gt;
&lt;p&gt;In my previous [post]({% post_url 2023-12-20-gcp-restore-boot-disk %}), I used several functions. We will call them in the main function below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;main() {
checkLogin
displayHeader
getDisks
getSnaps
read -p &amp;#34;Do you want to proceed with restore? Are you sure? &amp;#34; -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
stopServer
detachDisks
deleteDisks
createDisks
attachDisks
setAutodelete
startServer
fi
}
main
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Random words from array</title><link>http://uly.me/posts/random-words-from-array/</link><pubDate>Sun, 24 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/random-words-from-array/</guid><description>&lt;p&gt;Here&amp;rsquo;s how to to generate random words from an array in Bash using shuf.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;FOOD=(&amp;#39;Milk&amp;#39; &amp;#39;Bread&amp;#39; &amp;#39;Eggs&amp;#39; &amp;#39;Sausage&amp;#39; &amp;#39;Grits&amp;#39; &amp;#39;Banana&amp;#39; &amp;#39;Oatmeal&amp;#39;)
shuf -e ${FOOD[@]}
Milk
Grits
Sausage
Oatmeal
Bread
Banana
Eggs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can limit output to 3 by piping output using head -n 3.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;FOOD=(&amp;#39;Milk&amp;#39; &amp;#39;Bread&amp;#39; &amp;#39;Eggs&amp;#39; &amp;#39;Sausage&amp;#39; &amp;#39;Grits&amp;#39; &amp;#39;Banana&amp;#39; &amp;#39;Oatmeal&amp;#39;)
shuf -e ${FOOD[@]} | head -n 3
Bread
Sausage
Eggs
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Search replace lowercase</title><link>http://uly.me/posts/search-replace-lowercase/</link><pubDate>Thu, 21 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/search-replace-lowercase/</guid><description>&lt;p&gt;Here&amp;rsquo;s a script I use to edit over 1000 files to convert my post titles to all lowercase.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
cd ~/Code/docker/ulyme/_posts
searchReplace() {
for filename in 20*.md; do
sed -i -e &amp;#39;s/title:.*/\L&amp;amp;/g&amp;#39; $filename
done
}
searchReplace
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It took a mere 2-3 seconds to convert all titles on over 1000 files.&lt;/p&gt;</description></item><item><title>gcp restore all disks</title><link>http://uly.me/posts/gcp-restore-all-disks/</link><pubDate>Wed, 20 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-restore-all-disks/</guid><description>&lt;p&gt;Here&amp;rsquo;s my latest script on how to restore all disks of a VM in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# project=&amp;#34;projectid&amp;#34;
# instance=&amp;#34;hostname&amp;#34;
# zone=&amp;#34;us-central1-c&amp;#34;
# policy=&amp;#34;hourly&amp;#34;
# snapback=3
# Format (requires all 5 arguments): ./script.sh project host zone policy snapback
# If no arguments are provided or less than 5 arguments, you will be prompted to enter your options.
if [ -z &amp;#34;$project&amp;#34; ] || [ -z &amp;#34;$instance&amp;#34; ] || [ -z &amp;#34;$zone&amp;#34; ] || [ -z &amp;#34;$policy&amp;#34; ] || [ -z &amp;#34;$snapback&amp;#34; ]; then
if [ &amp;#34;$#&amp;#34; -eq 5 ]; then
project=$1
instance=$2
zone=$3
policy=$4
snapback=$5
else
read -p &amp;#34;projectId : &amp;#34; project
read -p &amp;#34;instance : &amp;#34; instance
read -p &amp;#34;zone : &amp;#34; zone
read -p &amp;#34;policy : &amp;#34; policy
read -p &amp;#34;snapback : &amp;#34; snapback
fi
fi
echo $project $instance $zone $policy $snapback
checkLogin() {
user=$(gcloud config list account --format &amp;#34;value(core.account)&amp;#34;)
user=$(echo $user | cut -d@ -f1)
user=${user/./-}
if [ -z &amp;#34;$user&amp;#34; ]; then
echo &amp;#34;You&amp;#39;re not logged in to Google SDK.&amp;#34;
exit
fi
}
displayHeader() {
echo &amp;#34;######################################################&amp;#34;
echo &amp;#34;Starting the restore process for $instance &amp;#34;
echo &amp;#34;######################################################&amp;#34;
}
getDisks() {
disks=$(gcloud compute disks list \
--filter=&amp;#34;users:$instance&amp;#34; \
--format=&amp;#34;value(name)&amp;#34; \
--project=&amp;#34;$project&amp;#34;)
echo &amp;#34;Listing disks for $instance ... &amp;#34;
for disk in $disks; do
echo $disk
done
}
getSnaps() {
echo &amp;#34;Listing snapshots to restore for $instance ... &amp;#34;
for disk in $disks; do
snap=$(gcloud compute snapshots list \
--filter=&amp;#34;sourceSnapshotSchedulePolicy~$policy AND sourceDisk~$disk&amp;#34; \
--format=&amp;#34;value(name)&amp;#34; \
--project=&amp;#34;$project&amp;#34; \
--sort-by=&amp;#34;~creationTimestamp&amp;#34; | head -n $snapback | tail -n 1)
echo &amp;#34;$disk: $snap&amp;#34;
done
}
stopServer() {
echo &amp;#34;Stopping server ...&amp;#34;
gcloud compute instances stop $instance \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
}
detachDisks() {
echo &amp;#34;Detaching disks ...&amp;#34;
for disk in $disks; do
gcloud compute instances detach-disk $instance \
--disk=&amp;#34;$disk&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
done
}
deleteDisks() {
echo &amp;#34;Deleting disks ...&amp;#34;
for disk in $disks; do
gcloud compute disks delete $disk \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
done
}
createDisks() {
echo &amp;#34;Creating disks ...&amp;#34;
for disk in $disks; do
snap=$(gcloud compute snapshots list \
--filter=&amp;#34;sourceDisk~$disk&amp;#34; \
--format=&amp;#34;value(name)&amp;#34; \
--project=&amp;#34;$project&amp;#34; \
--sort-by=&amp;#34;~creationTimestamp&amp;#34; | head -n $snapback | tail -n 1)
gcloud compute disks create $disk \
--source-snapshot=&amp;#34;$snap&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
done
}
attachDisks() {
echo &amp;#34;Attaching disks ...&amp;#34;
count=1
for disk in $disks; do
if [ $count == 1 ]; then
gcloud compute instances attach-disk $instance \
--disk=&amp;#34;$disk&amp;#34; \
--device-name=&amp;#34;$disk&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34; \
--boot
else
gcloud compute instances attach-disk $instance \
--disk=&amp;#34;$disk&amp;#34; \
--device-name=&amp;#34;$disk&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
fi
count=$((count+1))
done
}
setAutodelete() {
echo &amp;#34;Setting autodelete on disks ...&amp;#34;
for disk in $disks; do
gcloud compute instances set-disk-auto-delete $instance \
--auto-delete \
--disk=&amp;#34;$disk&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
done
}
startServer() {
echo &amp;#34;Starting server ...&amp;#34;
gcloud compute instances start $instance \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
}
main() {
checkLogin
displayHeader
getDisks
getSnaps
read -p &amp;#34;Do you want to proceed with restore? Are you sure? &amp;#34; -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
stopServer
detachDisks
deleteDisks
createDisks
attachDisks
setAutodelete
startServer
fi
}
main
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp restore boot disk</title><link>http://uly.me/posts/gcp-restore-boot-disk/</link><pubDate>Wed, 20 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-restore-boot-disk/</guid><description>&lt;p&gt;Here&amp;rsquo;s my latest script to restore the boot disk of a VM in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# project=&amp;#34;projectid&amp;#34;
# instance=&amp;#34;hostname&amp;#34;
# zone=&amp;#34;us-central1-c&amp;#34;
# policy=&amp;#34;hourly&amp;#34;
# snapback=3
# Format (requires all 5 arguments): ./script.sh project host zone policy snapback
# If no arguments are provided or if less than 5 arguments, then you will be prompted to enter options.
if [ -z &amp;#34;$project&amp;#34; ] || [ -z &amp;#34;$instance&amp;#34; ] || [ -z &amp;#34;$zone&amp;#34; ] || [ -z &amp;#34;$policy&amp;#34; ] || [ -z &amp;#34;$snapback&amp;#34; ]; then
if [ &amp;#34;$#&amp;#34; -eq 5 ]; then
project=$1
instance=$2
zone=$3
policy=$4
snapback=$5
else
read -p &amp;#34;projectId : &amp;#34; project
read -p &amp;#34;instance : &amp;#34; instance
read -p &amp;#34;zone : &amp;#34; zone
read -p &amp;#34;policy : &amp;#34; policy
read -p &amp;#34;snapback : &amp;#34; snapback
fi
fi
echo $project $instance $zone $policy $snapback
checkLogin() {
user=$(gcloud config list account --format &amp;#34;value(core.account)&amp;#34;)
user=$(echo $user | cut -d@ -f1)
user=${user/./-}
if [ -z &amp;#34;$user&amp;#34; ]; then
echo &amp;#34;You&amp;#39;re not logged in to Google SDK.&amp;#34;
exit
fi
}
displayHeader() {
echo &amp;#34;######################################################&amp;#34;
echo &amp;#34;Starting the restore process for $instance &amp;#34;
echo &amp;#34;######################################################&amp;#34;
}
getDisks() {
disks=$(gcloud compute instances describe $instance \
--project=&amp;#34;$project&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--format=&amp;#34;get(disks[0].source)&amp;#34;)
echo &amp;#34;Listing disks for $instance ... &amp;#34;
disk=$(echo ${disks##*/})
echo $disk
}
getSnaps() {
echo &amp;#34;Listing snapshots to restore for $instance ... &amp;#34;
snap=$(gcloud compute snapshots list \
--filter=&amp;#34;sourceSnapshotSchedulePolicy~$policy AND sourceDisk~$disk&amp;#34; \
--format=&amp;#34;value(name)&amp;#34; \
--project=&amp;#34;$project&amp;#34; \
--sort-by=&amp;#34;~creationTimestamp&amp;#34; | head -n $snapback | tail -n 1)
echo &amp;#34;$disk: $snap&amp;#34;
}
stopServer() {
echo &amp;#34;Stopping server ...&amp;#34;
gcloud compute instances stop $instance \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
}
detachDisks() {
echo &amp;#34;Detaching disks ...&amp;#34;
gcloud compute instances detach-disk $instance \
--disk=&amp;#34;$disk&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
}
deleteDisks() {
echo &amp;#34;Deleting disks ...&amp;#34;
gcloud compute disks delete $disk \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
}
createDisks() {
echo &amp;#34;Creating disks ...&amp;#34;
snap=$(gcloud compute snapshots list \
--filter=&amp;#34;sourceDisk~$disk&amp;#34; \
--format=&amp;#34;value(name)&amp;#34; \
--project=&amp;#34;$project&amp;#34; \
--sort-by=&amp;#34;~creationTimestamp&amp;#34; | head -n $snapback | tail -n 1)
gcloud compute disks create $disk \
--source-snapshot=&amp;#34;$snap&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
}
attachDisks() {
echo &amp;#34;Attaching disks ...&amp;#34;
gcloud compute instances attach-disk $instance \
--disk=&amp;#34;$disk&amp;#34; \
--device-name=&amp;#34;$disk&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34; \
--boot
}
setAutodelete() {
echo &amp;#34;Setting autodelete on disks ...&amp;#34;
gcloud compute instances set-disk-auto-delete $instance \
--auto-delete \
--disk=&amp;#34;$disk&amp;#34; \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
}
startServer() {
echo &amp;#34;Starting server ...&amp;#34;
gcloud compute instances start $instance \
--zone=&amp;#34;$zone&amp;#34; \
--project=&amp;#34;$project&amp;#34;
}
main() {
checkLogin
displayHeader
getDisks
getSnaps
read -p &amp;#34;Do you want to proceed with restore? Are you sure? &amp;#34; -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
stopServer
detachDisks
deleteDisks
createDisks
attachDisks
setAutodelete
startServer
fi
}
main
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp vm list all snapshots</title><link>http://uly.me/posts/gcp-vm-list-all-snapshots/</link><pubDate>Tue, 19 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-vm-list-all-snapshots/</guid><description>&lt;p&gt;Here&amp;rsquo;s how to list all the snapshots for a particular VM in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [ &amp;#34;$#&amp;#34; -ne 3 ]
then
echo &amp;#34;Usage: ./gcp-list-all-snapshots.sh project server policy&amp;#34;
exit
fi
# Set the name of the snapshot schedule policy and the disk name to filter by
PROJECT=$1 # PROJECT=&amp;#34;projectId&amp;#34;
SERVER=$2 # DISK_NAME=&amp;#34;hostname&amp;#34;
POLICY=$3 # POLICY_NAME=&amp;#34;hourly or daily&amp;#34;
disks=$(gcloud compute disks list --project $PROJECT --filter=&amp;#34;name~$SERVER&amp;#34; --format=&amp;#34;value(name)&amp;#34;)
for disk in $disks; do
# List all snapshots created by the snapshot schedule policy
gcloud compute snapshots list \
--filter=&amp;#34;sourceSnapshotSchedulePolicy ~ $POLICY AND sourceDisk~$disk$&amp;#34; \
--format=&amp;#34;table(sourceDisk.basename(),name,creationTimestamp,sourceSnapshotSchedulePolicy.basename())&amp;#34; \
--sort-by &amp;#34;~creationTimestamp&amp;#34; \
--project=&amp;#34;$PROJECT&amp;#34;
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The script requires three arguments: projectId, hostname and policy.&lt;/p&gt;</description></item><item><title>jekyll new post script</title><link>http://uly.me/posts/jekyll-new-post-script/</link><pubDate>Tue, 19 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/jekyll-new-post-script/</guid><description>&lt;p&gt;Here&amp;rsquo;s my bash script that creates a new Jekyll post template. Once created, use vi to edit the post.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [ &amp;#34;$#&amp;#34; -ne 1 ]
then
echo &amp;#34;Missing argument. Usage: ./jekyllNewPost.sh new-post-title&amp;#34;
exit
fi
cd ~/Code/docker/ulyme/_posts/
ts=$(date +%Y-%m-%d)
title=$1
filename=($ts-$title.md)
pretitle=$(echo &amp;#34;${title^}&amp;#34;)
posttitle=$(echo $pretitle | tr &amp;#34;-&amp;#34; &amp;#34; &amp;#34;)
cat &amp;lt;&amp;lt; EOF &amp;gt; $filename
---
layout: post
author: ulysses
title: &amp;#39;$posttitle&amp;#39;
---
EOF
echo &amp;#34;vi ~/Code/docker/ulyme/_posts/$filename&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>strip new lines on variables</title><link>http://uly.me/posts/strip-new-lines-on-variables/</link><pubDate>Mon, 18 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/strip-new-lines-on-variables/</guid><description>&lt;p&gt;I had problems echoing four variables into one line. There seem to be some carriage return or new line somewhere that&amp;rsquo;s not visible.&lt;/p&gt;
&lt;p&gt;So, here&amp;rsquo;s a line of code that will strip any new line or carriage return in the variable, and then use printf to display the variables on one line.&lt;/p&gt;
&lt;p&gt;Strip the new lines.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;efs=&amp;#34;${efs//$&amp;#39;\n&amp;#39;/ }&amp;#34;
name=&amp;#34;${name//$&amp;#39;\n&amp;#39;/}&amp;#34;
total=&amp;#34;${total//$&amp;#39;\n&amp;#39;/ }&amp;#34;
mesg=&amp;#34;${mesg//$&amp;#39;\n&amp;#39;/}&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now print them using printf on one line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;printf &amp;#34;%-30s %-40s %-20s %-30s\n&amp;#34; &amp;#34;$efs&amp;#34; &amp;#34;$new&amp;#34; &amp;#34;$total&amp;#34; &amp;#34;$mesg&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;With that code, I&amp;rsquo;m now able to format my report nicely without the extra new lines.&lt;/p&gt;</description></item><item><title>multiple github accounts</title><link>http://uly.me/posts/multiple-github-accounts/</link><pubDate>Sun, 17 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/multiple-github-accounts/</guid><description>&lt;p&gt;I have two Github accounts. The first one was cloned using HTTPS. When it was time to add a second one, I really didn&amp;rsquo;t want to mess around with multiple Github accounts and dealing with multiple credentials. I&amp;rsquo;ve decided to just clone the second account using SSH. I decided to do this mainly to simplify setup and to avoid the headaches with setting up multiple accounts in the config.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First repo - was cloned using HTTPS&lt;/li&gt;
&lt;li&gt;Second repo - was cloned using SSH&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first repo which uses HTTPS requires a github key which will need to be generated on Github. The first time a repo is cloned, you&amp;rsquo;ll be prompted to supply the key. This key is kept in the &lt;strong&gt;~/.git-credentials&lt;/strong&gt; file on the local desktop. The second repo which uses SSH requires a ssh key to be generated locally on your desktop, which you will then need to upload to github to allow authentication.&lt;/p&gt;</description></item><item><title>using internal links</title><link>http://uly.me/posts/using-internal-links/</link><pubDate>Sun, 17 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/using-internal-links/</guid><description>&lt;p&gt;Here&amp;rsquo;s how to use internal links within Jekyll. Use this format.&lt;/p&gt;
&lt;p&gt;{% raw %}&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[Some Link]({% post_url 2010-07-21-name-of-post %})
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;{% endraw %}&lt;/p&gt;
&lt;p&gt;I had to convert code to HTML characters to render properly.&lt;/p&gt;</description></item><item><title>editing multiple files</title><link>http://uly.me/posts/editing-multiple-files/</link><pubDate>Sat, 16 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/editing-multiple-files/</guid><description>&lt;p&gt;Editing 1000+ files is not fun. Here&amp;rsquo;s a script that cycles through certain files in a directory and performs a search and replace.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
for filename in 20*.md; do
sed -i -e &amp;#39;s/author: Ulysses/author: ulysses/g&amp;#39; $filename
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this particular script, it looks for files starting with 20 with an extension of .md.&lt;/p&gt;
&lt;p&gt;The script uses the &lt;strong&gt;sed command&lt;/strong&gt; to perform search and replace.&lt;/p&gt;</description></item><item><title>switching from wordpress to jekyll</title><link>http://uly.me/posts/switching-from-wordpress-to-jekyll/</link><pubDate>Sat, 16 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/switching-from-wordpress-to-jekyll/</guid><description>&lt;p&gt;I recently migrated this blog from WordPress to Jekyll due to several reasons.&lt;/p&gt;
&lt;p&gt;It came down to these three reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cost&lt;/li&gt;
&lt;li&gt;Speed&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;Cost. Jekyll generates static websites, meaning it can be hosted freely at Github. No more hosted VM&amp;rsquo;s. That&amp;rsquo;s a savings of $120 per year.&lt;/li&gt;
&lt;li&gt;Speed. Since Jekyll pages are static HTML pages, websites loads much faster. There are no more PHP, extra plugins or databases that slow down pages.&lt;/li&gt;
&lt;li&gt;Security. Since Jekyll pages are static files, they do not need a LAMP stack. So no more OS, PHP, plugins or MySQL databases to securely maintain.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It&amp;rsquo;s a win win. The migration was quick and easy, but not it&amp;rsquo;s not entirely a 100% bug-free. I had to tweak Jekyll templates here and there to get it to look the way I wanted it. There are a ton of articles out there that covers the Jeklly to WordPress migration. I&amp;rsquo;m not going to cover the migration process here step by step. To quickly summarize, you&amp;rsquo;ll need to install a Jekyll exporter plugin in WordPress to export your posts. You can then import your posts into Jekyll and tweak Jekyll the way you want it. That&amp;rsquo;s it in a nutshell.&lt;/p&gt;</description></item><item><title>php not able to run gcloud commands via shell_exec</title><link>http://uly.me/posts/php-not-able-to-run-gcloud-via-shell-exec/</link><pubDate>Fri, 15 Dec 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/php-not-able-to-run-gcloud-via-shell-exec/</guid><description>&lt;p&gt;I ran into an issue with PHP not able to run gcloud commands via shell_exec. It turned out to be a permission issue.&lt;/p&gt;
&lt;p&gt;I ended up granting the &lt;strong&gt;apache&lt;/strong&gt; user access to &lt;strong&gt;/usr/share/httpd/.config&lt;/strong&gt; directory which was missing.&lt;/p&gt;
&lt;p&gt;Google SDK needs write access to this directory. I ran the commands below and it worked after the changes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir /usr/share/httpd/.config
chown apache:root /usr/share/httpd/.config
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>hiding passwords using openssl</title><link>http://uly.me/posts/hiding-passwords-using-openssl/</link><pubDate>Tue, 31 Oct 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/hiding-passwords-using-openssl/</guid><description>&lt;p&gt;How to hide main password on Linux using OpenSSL.&lt;/p&gt;
&lt;p&gt;Run this on a web server once.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ echo &amp;#34;SecretPassword&amp;#34; | openssl enc -aes-256-cbc -md sha512 -a -salt -pass pass:NotSoSecretPassword &amp;gt; secret.txt
$ chmod 600 secret.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;On client machine, download the secret file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ curl https://webserver/some/dir/secret.txt --output -s secret.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To retrieve the secret password, run the code below. For added measure, delete secret.txt file afterwards.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat secret.txt | openssl enc -aes-256-cbc -md sha512 -a -d -salt -pass pass:NotSoSecretPassword
$rm -f secret.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In addition, you can rotate the NotSoSecretPassword to make it more secure.&lt;/p&gt;</description></item><item><title>install latest terraform via homebrew</title><link>http://uly.me/posts/install-latest-terraform-via-homebrew/</link><pubDate>Fri, 27 Oct 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-latest-terraform-via-homebrew/</guid><description>&lt;p&gt;As of this writing, the latest Terraform version supported by Homebrew is version 1.5.7. It’s a bit outdated considering the latest Terraform version is 1.6.2. To force Homebrew to install the latest version of Terraform, run the following commands from your MacOS Terminal. But prior to that, check your version first.&lt;/p&gt;
&lt;p&gt;Check current version&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ terraform --version
Terraform v1.5.7
on darwin_amd64
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Upgrade Terraform&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ brew tap hashicorp/tap
$ brew install hashicorp/tap/terraform
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check version again&lt;/p&gt;</description></item><item><title>youtube thumbnail</title><link>http://uly.me/posts/youtube-thumbnail/</link><pubDate>Thu, 26 Oct 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/youtube-thumbnail/</guid><description>&lt;p&gt;When uploading videos, Youtube gives you an option to upload your own thumbnails. If you want to use your own pics, you can format them to 1280×720 pixels and use it as a thumbnail. The script below will resize any image regardless of the original size to 1280×720 pixels using the convert utility of ImageMagick. The conversion may crop the edges of your image if it’s not 16:9 or 1.777 format. The script will also resize an image in portrait format.&lt;/p&gt;</description></item><item><title>search second column for characters</title><link>http://uly.me/posts/search-second-column-for-characters/</link><pubDate>Tue, 24 Oct 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/search-second-column-for-characters/</guid><description>&lt;p&gt;How to search the second column for string starting with.&lt;/p&gt;
&lt;p&gt;Here are the contents of results.txt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;John 10
Mario 12
Derek 15
Mark 20
Matt 25
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display only individuals that are older than 20 using awk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;awk &amp;#39;$2 ~ /^20/&amp;#39; results.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Mark 20
Matt 25
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can easily adjust this to other columns.&lt;/p&gt;</description></item><item><title>alternative to jq</title><link>http://uly.me/posts/alternative-to-jq/</link><pubDate>Wed, 18 Oct 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/alternative-to-jq/</guid><description>&lt;p&gt;If you don’t have JQ (JSON Parser) installed, you can use a combination of echo, grep and sed to pull out the data.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# create new credentials
new_access_keys_json=$(aws iam create-access-key --user-name $user --profile $profile)
new_access_key_id=$(echo &amp;#34;$new_access_keys_json&amp;#34; | grep -o &amp;#39;&amp;#34;AccessKeyId&amp;#34;: &amp;#34;[^&amp;#34;]*&amp;#39; | sed &amp;#39;s/&amp;#34;AccessKeyId&amp;#34;: &amp;#34;//&amp;#39;)
new_access_secret_key=$(echo &amp;#34;$new_access_keys_json&amp;#34; | grep -o &amp;#39;&amp;#34;SecretAccessKey&amp;#34;: &amp;#34;[^&amp;#34;]*&amp;#39; | sed &amp;#39;s/&amp;#34;SecretAccessKey&amp;#34;: &amp;#34;//&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this example, we are creating new AWS IAM credentials. AccessKeyID and secretKey are extracted from JSON.&lt;/p&gt;</description></item><item><title>lambda function list ec2 instances</title><link>http://uly.me/posts/lambda-function-list-ec2-instances/</link><pubDate>Wed, 18 Oct 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lambda-function-list-ec2-instances/</guid><description>&lt;p&gt;This is a Lambda function code that list EC2 instances from multiple regions and write the output to a S3 bucket.&lt;/p&gt;
&lt;p&gt;Include name and IP address on the output.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import boto3
import json
import os
from botocore.exceptions import NoCredentialsError
# Set the AWS regions you want to query
regions = [&amp;#39;us-east-1&amp;#39;, &amp;#39;us-west-2&amp;#39;, &amp;#39;eu-west-1&amp;#39;]
# Set the S3 bucket and object key for storing the output
s3_bucket = &amp;#39;your-s3-bucket-name&amp;#39;
s3_object_key = &amp;#39;ec2-instances-list.txt&amp;#39;
def lambda_handler(event, context):
ec2_instances = []
for region in regions:
try:
# Create an EC2 client for the specified region
ec2 = boto3.client(&amp;#39;ec2&amp;#39;, region_name=region)
# Describe EC2 instances in the region
response = ec2.describe_instances()
for reservation in response[&amp;#39;Reservations&amp;#39;]:
for instance in reservation[&amp;#39;Instances&amp;#39;]:
# Extract instance information
instance_name = &amp;#34;N/A&amp;#34;
instance_ip = &amp;#34;N/A&amp;#34;
for tag in instance.get(&amp;#39;Tags&amp;#39;, []):
if tag[&amp;#39;Key&amp;#39;] == &amp;#39;Name&amp;#39;:
instance_name = tag[&amp;#39;Value&amp;#39;]
if instance.get(&amp;#39;PublicIpAddress&amp;#39;):
instance_ip = instance[&amp;#39;PublicIpAddress&amp;#39;]
ec2_instances.append(f&amp;#34;Region: {region}, Name: {instance_name}, IP: {instance_ip}&amp;#34;)
except NoCredentialsError:
return &amp;#34;No AWS credentials found.&amp;#34;
# Store the EC2 instance information in an S3 object
s3 = boto3.client(&amp;#39;s3&amp;#39;)
s3.put_object(Bucket=s3_bucket, Key=s3_object_key, Body=&amp;#39;\n&amp;#39;.join(ec2_instances), ContentType=&amp;#39;text/plain&amp;#39;)
return {
&amp;#34;statusCode&amp;#34;: 200,
&amp;#34;body&amp;#34;: json.dumps(&amp;#34;EC2 instance information has been saved to S3.&amp;#34;)
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash split a string with delimiter</title><link>http://uly.me/posts/bash-split-a-string-with-delimiter/</link><pubDate>Mon, 18 Sep 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-split-a-string-with-delimiter/</guid><description>&lt;p&gt;Here’s how to split a string that contains a delimeter.&lt;/p&gt;
&lt;p&gt;String&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;server-boot;server-data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Split the string and print on every line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;data=&amp;#34;server-boot;server-data&amp;#34;
for i in $(echo $data | tr &amp;#34;;&amp;#34; &amp;#34;\n&amp;#34;); do
echo $i
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;server-boot
server-data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Send output to a file&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;file=&amp;#34;output.txt&amp;#34;
&amp;gt; $file
data=&amp;#34;server-boot;server-data&amp;#34;
for i in $(echo $data | tr &amp;#34;;&amp;#34; &amp;#34;\n&amp;#34;); do
echo $i &amp;gt;&amp;gt; $file
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>display asterisks when typing passwords in bash</title><link>http://uly.me/posts/display-asterisks-when-typing-passwords-in-bash/</link><pubDate>Mon, 18 Sep 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-asterisks-when-typing-passwords-in-bash/</guid><description>&lt;p&gt;Here’s how to display asterisks when typing passwords in Bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
unset password
prompt=&amp;#34;Enter Password:&amp;#34;
while IFS= read -p &amp;#34;$prompt&amp;#34; -r -s -n 1 char
do
if [[ $char == $&amp;#39;\0&amp;#39; ]]
then
break
fi
prompt=&amp;#39;*&amp;#39;
password+=&amp;#34;$char&amp;#34;
done
echo
echo &amp;#34;Done. Password=$password&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcloud table vs csv format</title><link>http://uly.me/posts/gcloud-table-vs-csv-format/</link><pubDate>Mon, 18 Sep 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcloud-table-vs-csv-format/</guid><description>&lt;p&gt;Differences using gcloud table vs CSV format.&lt;/p&gt;
&lt;p&gt;Table format&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute snapshots list \
--filter=&amp;#34;sourceSnapshotSchedulePolicy ~ $POLICY AND sourceDisk~$disk$&amp;#34; \
--format=&amp;#34;table(sourceDisk.basename(),name,creationTimestamp,sourceSnapshotSchedulePolicy.basename())&amp;#34; \
--sort-by &amp;#34;~creationTimestamp&amp;#34; \
--project=&amp;#34;$PROJECT&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;CSV format&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute snapshots list \
--filter=&amp;#34;sourceSnapshotSchedulePolicy ~ $POLICY AND sourceDisk~$disk$&amp;#34; \
--format=&amp;#34;csv[separator=&amp;#39;,&amp;#39;](sourceDisk.basename(),name,creationTimestamp,sourceSnapshotSchedulePolicy.basename())&amp;#34; \
--sort-by &amp;#34;~creationTimestamp&amp;#34; \
--project=&amp;#34;$PROJECT&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output to file&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute snapshots list \
--filter=&amp;#34;sourceSnapshotSchedulePolicy ~ $POLICY AND sourceDisk~$disk$&amp;#34; \
--format=&amp;#34;csv[separator=&amp;#39;,&amp;#39;](sourceDisk.basename(),name,creationTimestamp,sourceSnapshotSchedulePolicy.basename())&amp;#34; \
--sort-by &amp;#34;~creationTimestamp&amp;#34; \
--project=&amp;#34;$PROJECT&amp;#34; &amp;gt; output.csv
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp cloud shell format</title><link>http://uly.me/posts/gcp-cloud-shell-format/</link><pubDate>Mon, 18 Sep 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-cloud-shell-format/</guid><description>&lt;p&gt;If you are getting funky formatting in GCP Cloud Shell, run this to set the format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud config set accessibility/screen_reader False
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>active ssl and tls protocols</title><link>http://uly.me/posts/active-ssl-and-tls-protocols/</link><pubDate>Fri, 15 Sep 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/active-ssl-and-tls-protocols/</guid><description>&lt;p&gt;Here’s the command to list what SSL and TLS protocols are active.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;openssl ciphers -v | awk &amp;#39;{print $2}&amp;#39; | sort | uniq
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>checking what ssl and tls are in use</title><link>http://uly.me/posts/checking-what-ssl-and-tls-are-in-use/</link><pubDate>Fri, 15 Sep 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/checking-what-ssl-and-tls-are-in-use/</guid><description>&lt;p&gt;Here’s another command to check what version of SSL and TLS is being used.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;nmap --script ssl-enum-ciphers -p 443 server.domain.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;PORT STATE SERVICE
443/tcp open https
| ssl-enum-ciphers:
| TLSv1.2:
| ciphers:
...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this example, only TLSv1.2 is in use. For security purposes, use TLSv1.2 or higher.&lt;/p&gt;</description></item><item><title>what requires openssl</title><link>http://uly.me/posts/what-requires-openssl/</link><pubDate>Fri, 15 Sep 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/what-requires-openssl/</guid><description>&lt;p&gt;Here’s the command to list what app or package requires OpenSSL.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;repoquery --whatrequires --installed --recursive openssl
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;authconfig-0:6.2.8-30.el7.x86_64
falcon-sensor-0:6.38.0-13501.el7.x86_64
python2-cryptography-0:1.7.2-2.el7.x86_64
realmd-0:0.16.1-12.el7_9.1.x86_64
terraform-0:1.3.6-1.x86_64
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp vm licenses</title><link>http://uly.me/posts/gcp-vm-licenses/</link><pubDate>Thu, 14 Sep 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-vm-licenses/</guid><description>&lt;p&gt;Here’s the command to display VM OS licenses.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
ts=$(date +%Y%m%d-%H%M%S)
log=&amp;#34;gcp-licenses-logs-$ts&amp;#34;
&amp;gt;$log
while read -r project; do
echo &amp;#34;Project: $project&amp;#34; | tee -a $log
gcloud compute instances list --project $project --format=&amp;#34;table[no-heading](name,zone.basename())&amp;#34; &amp;gt; instances.list
while read -r instance zone; do
gcloud compute instances describe $instance \
--project $project \
--zone $zone \
--format=&amp;#34;table[no-heading](name,zone.basename(),disks[0].licenses[0].basename())&amp;#34; | tee -a $log
done &amp;lt; instances.list
done &amp;lt; projectIds.list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It&amp;rsquo;s going to go through a list of VM&amp;rsquo;s in each project and display the name, zone and license information.&lt;/p&gt;</description></item><item><title>capture gcp vm serial port output to terminal</title><link>http://uly.me/posts/capture-gcp-vm-serial-port-output-to-terminal/</link><pubDate>Mon, 28 Aug 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/capture-gcp-vm-serial-port-output-to-terminal/</guid><description>&lt;p&gt;Here’s the command to capture a GCP VM serial port output to your terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances get-serial-port-output servername \
--zone us-central1-f \
--project your-project \
--port 1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also send the output to a file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances get-serial-port-output servername \
--zone us-central1-f \
--project your-project \
--port 1 &amp;gt; output.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp vm breakglass ssh</title><link>http://uly.me/posts/gcp-vm-breakglass-ssh/</link><pubDate>Mon, 28 Aug 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-vm-breakglass-ssh/</guid><description>&lt;p&gt;When you exhausted all efforts trying to login to a VM and there’s no other way to log in to the server, here’s a breakglass method to allow you to log in to a VM via a startup script. Just add the following bash script to the VM startup section. Change the username and password to your liking. Restart the server to trigger the startup script. After reboot, it should give you access to the server. In addition, you will also have sudo access so you can switch as root.&lt;/p&gt;</description></item><item><title>install pint on sles</title><link>http://uly.me/posts/install-pint-on-sles/</link><pubDate>Mon, 28 Aug 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-pint-on-sles/</guid><description>&lt;p&gt;How to install pint utility on SLES machines.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;zypp in python-susepubliccloudinfo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once installed, you can run&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pint amazon servers –region=&amp;#39;us-east-1&amp;#39;
pint google servers –region=&amp;#39;us-central1&amp;#39;
pint microsoft servers –region=&amp;#39;eastus&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>mac vs linux date</title><link>http://uly.me/posts/mac-vs-linux-date/</link><pubDate>Thu, 17 Aug 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mac-vs-linux-date/</guid><description>&lt;p&gt;Converting Mac and Linux Dates&lt;/p&gt;
&lt;p&gt;Linux&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
start_time=$(date +%s)
log=$(date -d @$start_time +%Y%m%d-%H%M%S)
start=$(date -d @$start_time)
echo $start_time
echo $log
echo $start
sleep 10
stop_time=$(date +%s)
stop=$(date -d @$stop_time)
echo $stop_time
echo $stop
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mac&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
start_time=$(date +%s)
log=$(date -r $start_time +%Y%m%d-%H%M%S)
start=$(date -r $start_time)
echo $start_time
echo $log
echo $start
sleep 10
stop_time=$(date +%s)
stop=$(date -r $stop_time)
echo $stop_time
echo $stop
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Same output for both&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;1692292771
20230817-171931
Thu Aug 17 05:19:31 PM UTC 2023
1692292781
Thu Aug 17 05:19:41 PM UTC 2023
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>check if multiple arguments</title><link>http://uly.me/posts/check-if-multiple-arguments/</link><pubDate>Wed, 16 Aug 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-if-multiple-arguments/</guid><description>&lt;p&gt;If your Bash script calls for 3 arguments, here’s how to check it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if [ &amp;#34;$#&amp;#34; -ne 3 ]
then
echo &amp;#34;Usage: ./script.sh project diskname policy&amp;#34;
exit
fi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can adjust -ne 3 to any number based on the number of required arguments.&lt;/p&gt;</description></item><item><title>leading zeros for numbers below 10</title><link>http://uly.me/posts/leading-zeros-for-numbers-below-10/</link><pubDate>Wed, 16 Aug 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/leading-zeros-for-numbers-below-10/</guid><description>&lt;p&gt;When displaying in a time format, it’s best to display numbers below 10 with leading zeros.&lt;/p&gt;
&lt;p&gt;Here’s a nice function you can call to covert numbers below 10.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;convert ()
{
# print the number as a string with a leading zero
number=$(printf &amp;#39;%02d\n&amp;#39; &amp;#34;$1&amp;#34;)
echo $number
}
convert 5
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;05
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>fallocate</title><link>http://uly.me/posts/fallocate/</link><pubDate>Mon, 14 Aug 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fallocate/</guid><description>&lt;p&gt;If you want to create dummy files, there’s a faster command than ‘dd’ called ‘fallocate.’&lt;/p&gt;
&lt;p&gt;Create a 30GB called temp_30GB_file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fallocate -l 30G temp_30GB_file
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Unlike dd which can take minutes depending on file size, fallocate is instantaneous.&lt;/p&gt;</description></item><item><title>bash global variables</title><link>http://uly.me/posts/bash-global-variables/</link><pubDate>Thu, 27 Jul 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-global-variables/</guid><description>&lt;p&gt;Just a few things about Bash variables.&lt;/p&gt;
&lt;p&gt;Every variable in Bash is global and are accessible anywhere in the script.&lt;/p&gt;
&lt;p&gt;They can be used in a function, loop, or conditional statement within the script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# setting a variable
a = &amp;#34;hello&amp;#34;
# printing a variable
echo $a
# using a variable inside a function
hello_function () {
echo $a
}
# passing a variable to a function
hello_function $a
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>clear the line</title><link>http://uly.me/posts/clear-the-line/</link><pubDate>Wed, 26 Jul 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/clear-the-line/</guid><description>&lt;p&gt;Another time saving command if you want to clear the entire line on a terminal is Ctrl+K.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Ctrl+K
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>move to start or end of line</title><link>http://uly.me/posts/move-to-start-or-end-of-line/</link><pubDate>Wed, 26 Jul 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/move-to-start-or-end-of-line/</guid><description>&lt;p&gt;If a command is too long, you can move your cursor to the beginning or the end of the line.&lt;/p&gt;
&lt;p&gt;Move to start of the line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ctrl+A
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Move to end of the line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ctrl+E
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>pdfunite</title><link>http://uly.me/posts/pdfunite/</link><pubDate>Tue, 25 Jul 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/pdfunite/</guid><description>&lt;p&gt;How to merge several PDFs into one file.&lt;/p&gt;
&lt;p&gt;Install&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install poppler-utils
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Merging PDF files&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pdfunite one.pdf two.pdf three.pdf output.pdf
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp vm display label</title><link>http://uly.me/posts/gcp-vm-display-label/</link><pubDate>Wed, 12 Jul 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-vm-display-label/</guid><description>&lt;p&gt;Here’s how to display GCP VM labels.&lt;/p&gt;
&lt;p&gt;Display all labels.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances describe VM --zone ZONE --project PROJECT_ID --format=&amp;#34;value(labels)&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display a specific label.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances describe VM --zone ZONE --project PROJECT_ID --format=&amp;#34;value(labels.key)&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>run debian on docker container</title><link>http://uly.me/posts/run-debian-on-docker-container/</link><pubDate>Sun, 02 Jul 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-debian-on-docker-container/</guid><description>&lt;p&gt;Here’s how to run Debian on a Docker container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker pull debian
docker run -it debian /bin/bash
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp adding labels to snapshots</title><link>http://uly.me/posts/gcp-adding-labels-to-snapshots/</link><pubDate>Sat, 01 Jul 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-adding-labels-to-snapshots/</guid><description>&lt;p&gt;Here’s how to add labels to snapshots. It will cycle through from a list of disks.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
ts=$(date +%Y%m%d-%H%M%S)
log=&amp;#34;add-labels-logs-$ts&amp;#34;
&amp;gt;$log
disks=&amp;#39;manual-disks.txt&amp;#39;
now=$(date +%s)
epoch=$(date +%s -d &amp;#34;+14 days&amp;#34;)
while read -r project snapshot; do
echo &amp;#34;Project: $project&amp;#34;
gcloud compute snapshots add-labels $snapshot --labels=delete-after=$epoch --project $project
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>restore all disks of a gcp vm</title><link>http://uly.me/posts/restore-all-disks-of-a-gcp-vm/</link><pubDate>Sat, 01 Jul 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/restore-all-disks-of-a-gcp-vm/</guid><description>&lt;p&gt;Here’s an example of how to restore all the disks of a GCP VM from snapshots.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# Set variables
PROJECT_ID=&amp;#34;your-project-id&amp;#34;
INSTANCE_NAME=&amp;#34;your-instance-name&amp;#34;
# Get list of disks attached to the instance
DISKS=$(gcloud compute instances describe ${INSTANCE_NAME} \
--project ${PROJECT_ID} \
--format=&amp;#34;value(disks.deviceName)&amp;#34;)
# Loop through each disk and restore from most recent snapshot
for DISK in $DISKS
do
# Get most recent snapshot for the disk
SNAPSHOT=$(gcloud compute snapshots list \
--project ${PROJECT_ID} \
--filter=&amp;#34;sourceDisk=${INSTANCE_NAME}/${DISK} AND status=READY&amp;#34; \
--sort-by=&amp;#34;~creationTimestamp&amp;#34; \
--format=&amp;#34;value(name)&amp;#34; | head -n 1)
# Restore the disk from the snapshot
gcloud compute disks create ${DISK} \
--project ${PROJECT_ID} \
--source-snapshot ${SNAPSHOT} \
--zone=us-central1-a \
--labels restored-from=${SNAPSHOT}
# Attach the disk to the instance
gcloud compute instances attach-disk ${INSTANCE_NAME} \
--disk=${DISK} \
--project ${PROJECT_ID} \
--zone=us-central1-a
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>python read file multiple columns</title><link>http://uly.me/posts/python-read-file-multiple-columns/</link><pubDate>Mon, 26 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/python-read-file-multiple-columns/</guid><description>&lt;p&gt;Here’s how to read a file line by line with multiple columns.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;with open(&amp;#39;file.txt&amp;#39;) as file:
for line in file:
line = line.strip()
columns = line.split()
col1 = columns[0]
col2 = columns[1]
some_function(col1, col2)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gsed</title><link>http://uly.me/posts/gsed/</link><pubDate>Thu, 22 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gsed/</guid><description>&lt;p&gt;The sed utility on a Mac OS running Z shell or zsh is a little different compared to gnu’s sed.&lt;/p&gt;
&lt;p&gt;Install gnu sed on Mac OS.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;brew install gnu-sed
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use gsed instead of sed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gsed --version
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws terraform create policy and attach</title><link>http://uly.me/posts/aws-terraform-create-policy-and-attach/</link><pubDate>Wed, 21 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-terraform-create-policy-and-attach/</guid><description>&lt;p&gt;Here’s the Terraform code that creates an AWS IAM policy and attaches it to an existing role (ROLENAME).&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# CREDENTIALS
provider &amp;#34;aws&amp;#34; {
shared_credentials_files = [&amp;#34;~/.aws/credentials&amp;#34;]
shared_config_files = [&amp;#34;~/.aws/config&amp;#34;]
profile = &amp;#34;default&amp;#34;
region = &amp;#34;us-east-1&amp;#34;
}
# CREATE POLICY
resource &amp;#34;aws_iam_policy&amp;#34; &amp;#34;s3-policy&amp;#34; {
name = &amp;#34;s3-policy&amp;#34;
description = &amp;#34;Allow role to write to bucket&amp;#34;
policy = &amp;#34;${file(&amp;#34;policy.json&amp;#34;)}&amp;#34;
}
# ATTACH POLICY TO ROLE
resource &amp;#34;aws_iam_role_policy_attachment&amp;#34; &amp;#34;s3-policy-attachment&amp;#34; {
role = &amp;#34;ROLENAME&amp;#34;
policy_arn = aws_iam_policy.s3-policy.arn
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the policy.json file.&lt;/p&gt;</description></item><item><title>gcp add labels to snapshots</title><link>http://uly.me/posts/gcp-add-labels-to-snapshots/</link><pubDate>Tue, 20 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-add-labels-to-snapshots/</guid><description>&lt;p&gt;Here’s the command to add labels to a snapshot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute snapshots add-labels SNAPSHOTNAME --labels=KEY=VALUE --project PROJECT
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>date from a year ago</title><link>http://uly.me/posts/date-from-a-year-ago/</link><pubDate>Sun, 18 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/date-from-a-year-ago/</guid><description>&lt;p&gt;Here’s a handy little script that has multiple applications to calculate date from a year ago.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
now=$(date +%Y%m%d-%H%M%S)
# mac os
year_old=$(date -v-1y +%Y%m%d-%H%M%S)
# linux os
year_old=$(date -d &amp;#34;-1 year&amp;#34; +%Y%m%d-%H%M%S)
echo $now
echo $year_old
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mac Os and Linux has slightly different formats. Pick one based on your OS.&lt;/p&gt;
&lt;p&gt;Results&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;20230618-084940
20220618-084940
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list snapshots older than</title><link>http://uly.me/posts/gcp-list-snapshots-older-than/</link><pubDate>Fri, 16 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-snapshots-older-than/</guid><description>&lt;p&gt;Here’s how to list snapshots older than a certain date. In this example, it’s snapshots older than 2023-12-14.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute snapshots list --project $project --filter=&amp;#34;creationTimestamp &amp;lt; 2023-12-14&amp;#34; --format=&amp;#34;get(name,creationTimestamp)&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>change hostname amazon linux</title><link>http://uly.me/posts/change-hostname-amazon-linux/</link><pubDate>Tue, 06 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-hostname-amazon-linux/</guid><description>&lt;p&gt;Here’s how to make a hostname stick on Amazon Linux.&lt;/p&gt;
&lt;p&gt;Set preserve_hostname to true in /etc/cloud/cloud.cfg.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;preserve_hostname: true
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Set the hostname in /etc/sysconfig/network.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;HOSTNAME=server.domain.com
NETWORKING=yes
NOZEROCONF=yes
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot the server to make sure hostname sticks after a reboot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;shutdown -r now
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Login to confirm hostname sticks.&lt;/p&gt;</description></item><item><title>gcp change vm service account</title><link>http://uly.me/posts/gcp-change-vm-service-account/</link><pubDate>Thu, 01 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-change-vm-service-account/</guid><description>&lt;p&gt;Here’s how to change a VM’s service account in GCP&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
read -p &amp;#34;project : &amp;#34; project
read -p &amp;#34;instance : &amp;#34; instance
read -p &amp;#34;srvAcct email : &amp;#34; serviceaccount
# stop instance
gcloud compute instances stop $instance --project $project
# change service account
gcloud compute instances set-service-account $instance --service-account $serviceaccount --scopes cloud-platform --project $project
# start instance
gcloud compute instances start $instance --project $project
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp manual snapshots</title><link>http://uly.me/posts/gcp-manual-snapshots/</link><pubDate>Thu, 01 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-manual-snapshots/</guid><description>&lt;p&gt;Here’s how to list GCP’s manual snapshots. projectIds.txt contains a list of projects.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
ts=$(date +%Y%m%d-%H%M%S)
log=&amp;#34;manual-snapshots-logs-$ts&amp;#34;
&amp;gt;$log
while read -r project; do
snapshots=$(gcloud compute snapshots list \
--project $project \
--filter=&amp;#34;sourceSnapshotSchedulePolicy!=&amp;#39;&amp;#39;&amp;#34; \
--format=&amp;#34;value(name)&amp;#34;)
for snapshot in $snapshots
do
printf &amp;#34;%-30s %-30s \n&amp;#34; &amp;#34;$project&amp;#34; &amp;#34;$snapshot&amp;#34; | tee -a $log
done
done &amp;gt; projectIds.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Another option.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
ts=$(date +%Y%m%d-%H%M%S)
log=&amp;#34;manual-snapshots-logs-$ts&amp;#34;
&amp;gt;$log
while read -r project; do
snapshots=$(gcloud compute snapshots list \
--project $project \
--filter=&amp;#34;-sourceSnapshotSchedulePolicy:*&amp;#34; \
--format=&amp;#34;value(name)&amp;#34;)
for snapshot in $snapshots
do
printf &amp;#34;%-30s %-30s \n&amp;#34; &amp;#34;$project&amp;#34; &amp;#34;$snapshot&amp;#34; | tee -a $log
done
done &amp;gt; projectIds.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp old scheduled snapshots</title><link>http://uly.me/posts/gcp-old-scheduled-snapshots/</link><pubDate>Thu, 01 Jun 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-old-scheduled-snapshots/</guid><description>&lt;p&gt;Here’s how to list GCP Scheduled Snapshots older than 14 days. projectIds.txt contains a list of projects.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
ts=$(date +%Y%m%d-%H%M%S)
old=$(date -v -14d +%Y-%m-%dT%H:%M:%S)
log=&amp;#34;scheduled-snapshots-logs-$ts&amp;#34;
&amp;gt;$log
while read -r project; do
snapshots=$(gcloud compute snapshots list \
--project $project \
--format=&amp;#34;value(name)&amp;#34; \
--filter=&amp;#34;creationTimestamp
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>add snapshot schedules to disks</title><link>http://uly.me/posts/add-snapshot-schedules-to-disks/</link><pubDate>Wed, 24 May 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-snapshot-schedules-to-disks/</guid><description>&lt;p&gt;How to add Snapshot Schedules to disks in Terraform. Add this to your existing VM.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;resource &amp;#34;google_compute_disk_resource_policy_attachment&amp;#34; &amp;#34;hourly_attachment&amp;#34; {
name = &amp;#34;hourly-snapshots&amp;#34;
disk = google_compute_instance.test.name
zone = &amp;#34;us-central1-c&amp;#34;
}
resource &amp;#34;google_compute_disk_resource_policy_attachment&amp;#34; &amp;#34;daily_attachment&amp;#34; {
name = &amp;#34;daily-snapshots&amp;#34;
disk = google_compute_instance.test.name
zone = &amp;#34;us-central1-c&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>unbound logs</title><link>http://uly.me/posts/unbound-logs/</link><pubDate>Wed, 24 May 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/unbound-logs/</guid><description>&lt;p&gt;How to enable unbound logs.&lt;/p&gt;
&lt;p&gt;Add these line in /etc/unbound/unbound.conf.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;chroot: &amp;#34;&amp;#34;
logfile: /var/log/unbound.log
verbosity: 4
log-queries: yes
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create the log file and set permissions.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;touch /var/log/unbound.log
chown unbound:unbound /var/log/unbound.log
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart the unbound service.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl restart unbound
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check status.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl status unbound
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Finally, check the logs.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tail -f /var/log/unbound.log
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>crontab every 11 months</title><link>http://uly.me/posts/crontab-every-11-months/</link><pubDate>Tue, 09 May 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/crontab-every-11-months/</guid><description>&lt;p&gt;If you want to run a script every 11 months, here’s the crontab entry.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;* * 1 */11 * /bin/bash /path/to/script.sh
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash replace spaces with a comma</title><link>http://uly.me/posts/bash-replace-spaces-with-a-comma/</link><pubDate>Mon, 08 May 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-replace-spaces-with-a-comma/</guid><description>&lt;p&gt;Replace spaces with commas from one file and send the output to another file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tr -s &amp;#39;[:blank:]&amp;#39; &amp;#39;, &amp;#39; output.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It’s perfect for creating a comma delimited file for importing to Excel.&lt;/p&gt;</description></item><item><title>ffmpeg resize video</title><link>http://uly.me/posts/ffmpeg-resize-video/</link><pubDate>Thu, 13 Apr 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ffmpeg-resize-video/</guid><description>&lt;p&gt;Here’s how to reduce a MP4 video using H.265 format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I was able to reduce a video file from 550MB to 26MB without much quality loss.&lt;/p&gt;</description></item><item><title>bash sort files</title><link>http://uly.me/posts/bash-sort-files/</link><pubDate>Mon, 10 Apr 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-sort-files/</guid><description>&lt;p&gt;How to sort files in Bash.&lt;/p&gt;
&lt;p&gt;Display contents&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat file.txt
bbb
aaa
ccc
kkk
uuu
ppp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Sort&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sort file.txt
aaa
bbb
ccc
kkk
ppp
uuu
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Sort in place&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sort -o file.txt file.txt
$ cat file.txt
aaa
bbb
ccc
kkk
ppp
uuu
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>display certain lines in a file</title><link>http://uly.me/posts/display-certain-lines-in-a-file/</link><pubDate>Thu, 23 Mar 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-certain-lines-in-a-file/</guid><description>&lt;p&gt;This will display only lines 40-50 in a file called lines.txt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat lines.txt | head -n 50 | tail -n 10
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For lines 90-100.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat lines.txt | head -n 100 | tail -n 10
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and so on.&lt;/p&gt;</description></item><item><title>memory info on linux</title><link>http://uly.me/posts/memory-info-on-linux/</link><pubDate>Wed, 15 Mar 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/memory-info-on-linux/</guid><description>&lt;p&gt;Here’s how to view system memory on Linux.&lt;/p&gt;
&lt;p&gt;Default display is in kB&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cat /proc/meminfo
MemTotal: 7492768 kB
MemFree: 427368 kB
MemAvailable: 5424768 kB
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display in MB&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;awk &amp;#39;$3==&amp;#34;kB&amp;#34;{$2=$2/1024;$3=&amp;#34;MB&amp;#34;} 1&amp;#39; /proc/meminfo | column -t
MemTotal: 7317.16 MB
MemFree: 404.527 MB
MemAvailable: 5285.4 MB
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output in GB&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;awk &amp;#39;$3==&amp;#34;kB&amp;#34;{$2=$2/1024^2;$3=&amp;#34;GB&amp;#34;;} 1&amp;#39; /proc/meminfo | column -t
MemTotal: 7.14566 GB
MemFree: 0.370392 GB
MemAvailable: 5.13733 GB
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>key-based ssh prompting password</title><link>http://uly.me/posts/key-based-ssh-prompting-password/</link><pubDate>Tue, 21 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/key-based-ssh-prompting-password/</guid><description>&lt;p&gt;Key-based SSH login is prompting a password despite it’s already setup to use keys. As turns out, the home directory was changed to 777. To fix, I changed home folder permissions and restarted SSH. It probably does not need a restart, but it doesn’t hurt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;chown -R username:username /home/username
find /home/username -type d -exec chmod 755 {} \;
find /home/username -type f -exec chmod 644 {} \;
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;sudo systemctl restart ssh
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>yum version lock</title><link>http://uly.me/posts/yum-version-lock/</link><pubDate>Tue, 21 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yum-version-lock/</guid><description>&lt;p&gt;How to lock a package or software in RedHat.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# For RHEL 5
yum install yum-versionlock
# For RHEL 6 and 7
yum install yum-plugin-versionlock
# For RHEL 8 and 9
yum install python3-dnf-plugin-versionlock
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Locking a package&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum versionlock gcc-*
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List locked packages&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum versionlock list
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>missing rhel prompt on bash</title><link>http://uly.me/posts/missing-rhel-prompt-on-bash/</link><pubDate>Mon, 20 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/missing-rhel-prompt-on-bash/</guid><description>&lt;p&gt;Here’s how to restore or set the Bash prompt on RHEL systems.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo &amp;#34;PS1=&amp;#39;\u@\h \w]\$&amp;#39;&amp;#34; &amp;gt;&amp;gt; ~/.bashrc
source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp backend services health status</title><link>http://uly.me/posts/gcp-backend-services-health-status/</link><pubDate>Tue, 14 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-backend-services-health-status/</guid><description>&lt;p&gt;Here’s how to get health status of a GCP Load Balancer Backend Services.&lt;/p&gt;
&lt;p&gt;For all load balancers except target pool.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute backend-services get-health BACKEND_SERVICE_NAME \
--region us-central1 \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For target pool load balancers, use this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute target-pools get-health TARGET_POOL_NAME \
--region us-central1 \
--project project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws rds enable performance insights</title><link>http://uly.me/posts/aws-rds-enable-performance-insights/</link><pubDate>Mon, 13 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-rds-enable-performance-insights/</guid><description>&lt;p&gt;Here’s how to enable performance insights on a RDS instance.&lt;/p&gt;
&lt;p&gt;Enable&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws rds modify-db-instance \
--db-instance-identifier sample-db-instance \
--enable-performance-insights \
--region us-east-1 \
--profile default
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disable&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws rds modify-db-instance \
--db-instance-identifier sample-db-instance \
--no-enable-performance-insights \
--region us-east-1 \
--profile default
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp bms list luns in volume</title><link>http://uly.me/posts/gcp-bms-list-luns-in-volume/</link><pubDate>Sat, 11 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-bms-list-luns-in-volume/</guid><description>&lt;p&gt;Here’s how to list the luns for a particular volume.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud bms volumes luns list --project project-id --region us-central1 --volume at-xxxxxxx-volxxx
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp bms describe instances</title><link>http://uly.me/posts/gcp-bms-describe-instances/</link><pubDate>Wed, 08 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-bms-describe-instances/</guid><description>&lt;p&gt;Here’s how to describe a Bare Metal Server (BMS). The output display storage LUNS and network information.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud bms instances describe INSTANCE --project PROJECT-ID --region us-central1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp bms describe volume</title><link>http://uly.me/posts/gcp-bms-describe-volume/</link><pubDate>Wed, 08 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-bms-describe-volume/</guid><description>&lt;p&gt;Here’s how to describe a Bare Metal Server (BMS) volume within a project.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud bms volumes describe at-xxxxxxx-vol001-data --project project_id --region us-central1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp bms list volumes</title><link>http://uly.me/posts/gcp-bms-list-volumes/</link><pubDate>Wed, 08 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-bms-list-volumes/</guid><description>&lt;p&gt;Here’s how to list all your Bare Metal Servers (BMS) volumes within a project.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud bms volumes list --project PROJECT_ID --region us-central1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>check for new kernel</title><link>http://uly.me/posts/check-for-new-kernel/</link><pubDate>Sun, 05 Feb 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-for-new-kernel/</guid><description>&lt;p&gt;Checking for new kernel on multiple distros.&lt;/p&gt;
&lt;p&gt;Redhat, Centos, Fedora, Rocky&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -qa kernel
yum list installed kernel
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Arch Linux&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pacman -Q | grep linux
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Fedora&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dnf list installed kernel
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;SUSE&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -qa | grep -i kernel
zypper search -i kernel
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Debian, Ubuntu, Mint&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dpkg --list | grep linux-image
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws list of auto scaling groups</title><link>http://uly.me/posts/aws-list-of-auto-scaling-groups/</link><pubDate>Fri, 27 Jan 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-list-of-auto-scaling-groups/</guid><description>&lt;p&gt;Here’s a script to list Auto Scaling Groups from multiple AWS accounts. Accounts are in your AWS profiles.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
file=&amp;#39;results-aws-asg.txt&amp;#39;
&amp;gt; $file
declare -a account=(&amp;#34;default&amp;#34; &amp;#34;account-1&amp;#34; &amp;#34;account-2&amp;#34; &amp;#34;account-3&amp;#34; &amp;#34;account-4&amp;#34; &amp;#34;account-5&amp;#34;)
declare -a region=(&amp;#34;us-east-1&amp;#34; &amp;#34;us-east-2&amp;#34; &amp;#34;us-west-1&amp;#34; &amp;#34;us-west-2&amp;#34;)
for i in &amp;#34;${account[@]}&amp;#34;
do
echo &amp;#39;----------------------&amp;#39; &amp;gt;&amp;gt; $file
echo &amp;#39;Account: &amp;#39;$i &amp;gt;&amp;gt; $file
for j in &amp;#34;${region[@]}&amp;#34;
do
echo &amp;#39;Region: &amp;#39;$j &amp;gt;&amp;gt; $file
aws autoscaling describe-auto-scaling-groups \
--query &amp;#34;AutoScalingGroups[].[AutoScalingGroupName,LaunchConfigurationName]&amp;#34; \
--profile $i \
--region $j \
--output text &amp;gt;&amp;gt; $file
done
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>logging in to aws and gcp</title><link>http://uly.me/posts/logging-in-to-aws-and-gcp/</link><pubDate>Sun, 22 Jan 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/logging-in-to-aws-and-gcp/</guid><description>&lt;p&gt;Here’s my Bash script to login to both AWS and GCP. It has a little bit of intelligence. It checks if you are already logged in, and skips if you are. If not logged in, it will open up the cloud web console which is protected by Okta. The script has been redacted and replace with generic usernames and web pages for security reasons.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
## CHECK IF LOGGED IN TO GCP
read -p &amp;#34;Login to GCP? (y/n) : &amp;#34; login_gcp
if [[ $login_gcp = &amp;#34;y&amp;#34; ]]; then
file1=&amp;#34;/Users/username/code/etc/auth-gcp.txt&amp;#34;
gcloud auth print-identity-token 1&amp;gt; /dev/null 2&amp;gt; $file
user=$(gcloud config list account --format &amp;#34;value(core.account)&amp;#34;)
auth=$(cat &amp;#34;$file&amp;#34; | head -n 1)
rm -f $file1
if [[ $auth == &amp;#34;Reauthentication required.&amp;#34; ]] || [[ $user != &amp;#34;first.last@domain.com&amp;#34; ]]; then
echo &amp;#34;Logging in to Google Cloud Platform.&amp;#34;
gcloud auth login
gcloud auth application-default login
open https://okta-login
else
echo &amp;#34;You are already logged in to Google Cloud Platform.&amp;#34;
fi
else
echo &amp;#34;Skipping GCP ... &amp;#34;
fi
## CHECK IF LOGGED IN TO AWS
read -p &amp;#34;Login to AWS? (y/n) : &amp;#34; login_aws
if [[ $login_aws = &amp;#34;y&amp;#34; ]]; then
file2=&amp;#34;&amp;#34;/Users/username/code/etc/auth-aws.txt&amp;#34;&amp;#34;
aws sts get-caller-identity 2&amp;gt; $file2
expired=$(tail -n +2 &amp;#34;$file2&amp;#34;)
rm -f $file2
if [[ $expired =~ &amp;#34;expired&amp;#34; ]] || [[ $expired =~ &amp;#34;Unable&amp;#34; ]]; then
open https://okta-login
echo &amp;#34;please wait until web page loads ... &amp;#34;
read -p &amp;#34;Press any key to continue... &amp;#34; -n1 -s
echo &amp;#34;&amp;#34;
basecred=&amp;#39;/Users/username/.aws/credentials.base&amp;#39;
newcreds=&amp;#39;/Users/username/Downloads/credentials&amp;#39;
creds=&amp;#39;/Users/username/.aws/credentials&amp;#39;
if [ ! -f $newcreds ]; then
echo &amp;#39;No AWS credentials.&amp;#39;
exit
else
cat $newcreds $basecred &amp;gt; $creds
echo &amp;#39;New AWS credentials.&amp;#39;
sleep 3
rm -f $newcreds
fi
else
echo &amp;#34;You are already logged in to AWS.&amp;#34;
fi
else
echo &amp;#34;Skipping AWS ... &amp;#34;
fi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws create volume from snapshot with tags</title><link>http://uly.me/posts/aws-create-volume-from-snapshot-with-tags/</link><pubDate>Thu, 19 Jan 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-create-volume-from-snapshot-with-tags/</guid><description>&lt;p&gt;Here’s another script that creates a volume from a snapshot, but also add the tags.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
read -p &amp;#34;server : &amp;#34; server
read -p &amp;#34;volumeId : &amp;#34; volume
read -p &amp;#34;snapshotId : &amp;#34; snapshot
read -p &amp;#34;region : &amp;#34; region
read -p &amp;#34;zone : &amp;#34; zone
read -p &amp;#34;profile : &amp;#34; profile
# get tags
tags1=$(aws ec2 describe-volumes --volume-ids $volume --query &amp;#39;Volumes[].Tags[]&amp;#39; --region $region --profile $profile)
# remove quotes
tags2=$(echo &amp;#34;$tags1&amp;#34; | tr -d &amp;#39;&amp;#34;&amp;#39;)
# remove spaces
tags3=$(echo $tags2 | sed &amp;#39;s/ //g&amp;#39;)
# replace : with =
tags4=$(echo $tags3 | sed &amp;#39;s/:/=/g&amp;#39;)
# if empty value replace with quotes
tags5=$(echo $tags4 | sed &amp;#39;s/Value=}/Value=&amp;#34;&amp;#34;}/g&amp;#39;)
# create volume
aws ec2 create-volume \
--availability-zone $zone \
--encrypted \
--iops 3000 \
--volume-type gp3 \
--snapshot-id $snapshot \
--tag-specifications &amp;#39;ResourceType=volume,Tags=&amp;#39;$tags5&amp;#39;&amp;#39; \
--region $region \
--profile $profile
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws create volume from snapshot</title><link>http://uly.me/posts/aws-create-volume-from-snapshot/</link><pubDate>Wed, 18 Jan 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-create-volume-from-snapshot/</guid><description>&lt;p&gt;Here’s a bash script that creates a volume from a snapshot in AWS.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
read -p &amp;#34;snapshotId : &amp;#34; snapshot
read -p &amp;#34;server : &amp;#34; server
read -p &amp;#34;tag1 : &amp;#34; tag1
read -p &amp;#34;tag2 : &amp;#34; tag2
read -p &amp;#34;region : &amp;#34; region
read -p &amp;#34;zone : &amp;#34; zone
read -p &amp;#34;profile : &amp;#34; profile
aws ec2 create-volume \
--availability-zone $zone \
--encrypted \
--iops 3000 \
--volume-type gp3 \
--snapshot-id $snapshot \
--tag-specifications &amp;#34;ResourceType=volume,Tags=[{Key=Name,Value=&amp;#34;$server&amp;#34;},{Key=tag1,Value=&amp;#34;$tag1&amp;#34;},{Key=tag2,Value=&amp;#34;$tag2&amp;#34;}]&amp;#34; \
--region $region \
--profile $profile
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>checking nameservers</title><link>http://uly.me/posts/checking-nameservers/</link><pubDate>Sun, 15 Jan 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/checking-nameservers/</guid><description>&lt;p&gt;Handy little script to see if nameserver is on an array.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
declare -a servers=(&amp;#34;127.0.0.53&amp;#34; &amp;#34;127.0.0.52&amp;#34; &amp;#34;127.0.0.51&amp;#34;)
client=$(cat /etc/resolv.conf | grep nameserver)
for i in &amp;#34;${servers[@]}&amp;#34;
do
if [[ $client =~ $i ]]
then
using_unbound=&amp;#34;true&amp;#34;
break
else
using_unbound=&amp;#34;false&amp;#34;
fi
done
echo $using_unbound &amp;#34;|&amp;#34; $client
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>windows curl command</title><link>http://uly.me/posts/windows-curl-command/</link><pubDate>Wed, 11 Jan 2023 00:00:00 +0000</pubDate><guid>http://uly.me/posts/windows-curl-command/</guid><description>&lt;p&gt;If you have to download a file from the Internet on a Windows server, can certainly use the browser. But if the browser is rendering the file instead of downloading them, you may have to use the curl command which is already pre-installed on most Windows servers. Just open the command line. Here’s the the curl command to download a file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;curl.exe --output index.txt --url https://website.domain/index.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws list account aliases</title><link>http://uly.me/posts/aws-list-account-aliases/</link><pubDate>Mon, 26 Dec 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-list-account-aliases/</guid><description>&lt;p&gt;Here’s how to list account aliases. I have four profiles in my credentials. I’m looping through all four and printing the aliases.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
file=&amp;#39;results-aws-account-aliases.txt&amp;#39;
&amp;gt; $file
declare -a account=(&amp;#34;default&amp;#34; &amp;#34;one&amp;#34; &amp;#34;two&amp;#34; &amp;#34;three&amp;#34;)
for i in &amp;#34;${account[@]}&amp;#34;
do
echo &amp;#39;----------------------&amp;#39; &amp;gt;&amp;gt; $file
echo &amp;#39;Account: &amp;#39;$i &amp;gt;&amp;gt; $file
aws iam list-account-aliases \
--profile $i
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>linux screen</title><link>http://uly.me/posts/linux-screen-2/</link><pubDate>Mon, 26 Dec 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-screen-2/</guid><description>&lt;p&gt;Just documenting the Linux Screen command.&lt;/p&gt;
&lt;p&gt;Install screen first.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install screen
dnf install screen
apt install screen
zypper install screen
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start a new screen.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;screen -S one
screen -S two
screen -S three
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Detach from screen.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Ctrl+a+d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List active screens.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;screen -ls
There is a screen on:
15575.one (Detached)
15581.two (Detached)
15593.three (Detached)
1 Socket in /var/run/screen/S-root.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reattach to an existing screen.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;screen -r one
screen -r two
screen -r three
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If there’s only one active screen, you can run screen -r without the name.&lt;/p&gt;</description></item><item><title>linux mint vera</title><link>http://uly.me/posts/linux-mint-vera/</link><pubDate>Fri, 23 Dec 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-mint-vera/</guid><description>&lt;p&gt;I upgraded to Linux Mint Vera from Una.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ulysses@penguin:~/Code$ neofetch
...-:::::-... ulysses@penguin
.-MMMMMMMMMMMMMMM-. ---------------
.-MMMM`..-:::::::-..`MMMM-. OS: Linux Mint 21.1 x86_64
.:MMMM.:MMMMMMMMMMMMMMM:.MMMM:. Kernel: 5.15.0-56-generic
-MMM-M---MMMMMMMMMMMMMMMMMMM.MMM- Uptime: 13 hours, 35 mins
`:MMM:MM` :MMMM:....::-...-MMMM:MMM:` Packages: 2176 (dpkg)
:MMM:MMM` :MM:` `` `` `:MMM:MMM: Shell: bash 5.1.16
.MMM.MMMM` :MM. -MM. .MM- `MMMM.MMM. Resolution: 3840x2160
:MMM:MMMM` :MM. -MM- .MM: `MMMM-MMM: DE: Cinnamon 5.6.5
:MMM:MMMM` :MM. -MM- .MM: `MMMM:MMM: WM: Mutter (Muffin)
:MMM:MMMM` :MM. -MM- .MM: `MMMM-MMM: WM Theme: Mint-Y-Dark-Aqua (Mint-Y)
.MMM.MMMM` :MM:--:MM:--:MM: `MMMM.MMM. Theme: Mint-Y-Aqua [GTK2/3]
:MMM:MMM- `-MMMMMMMMMMMM-` -MMM-MMM: Icons: Mint-Y-Aqua [GTK2/3]
:MMM:MMM:` `:MMM:MMM: Terminal: gnome-terminal
.MMM.MMMM:--------------:MMMM.MMM. CPU: AMD Ryzen 7 1700X (16) @ 3.700GHz
&amp;#39;-MMMM.-MMMMMMMMMMMMMMM-.MMMM-&amp;#39; GPU: AMD ATI Radeon R7 240/340 / Radeon 520
&amp;#39;.-MMMM``--:::::--``MMMM-.&amp;#39; Memory: 3864MiB / 15928MiB
&amp;#39;-MMMMMMMMMMMMM-&amp;#39;
``-:::::-``
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I have 2 issues out of the gate.&lt;/p&gt;</description></item><item><title>linux mint upgrade</title><link>http://uly.me/posts/linux-mint-upgrade/</link><pubDate>Tue, 20 Dec 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-mint-upgrade/</guid><description>&lt;p&gt;Here’s how to upgrade your Linux Mint Desktop.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt update
sudo apt install mintupgrade
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then run the upgrade.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo mintupgrade
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>open browser in bash</title><link>http://uly.me/posts/open-browser-in-bash/</link><pubDate>Wed, 30 Nov 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/open-browser-in-bash/</guid><description>&lt;p&gt;Here’s a nice little command to open a browser from Bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
open https://domain.com/path/to/web/page/index.html
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can use this command to open a web page from your script.&lt;/p&gt;</description></item><item><title>bash any key</title><link>http://uly.me/posts/bash-any-key/</link><pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-any-key/</guid><description>&lt;p&gt;Here’s the script to add pauses in your Bash script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo &amp;#34;please wait until web page loads ... &amp;#34;
read -p &amp;#34;Press any key to continue... &amp;#34; -n1 -s
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also put it inside a function and call it multiple times.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function press_any_key {
echo &amp;#34;please wait until web page loads ... &amp;#34;
read -p &amp;#34;Press any key to continue... &amp;#34; -n1 -s
}
press_any_key
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>crontab on macos monterey</title><link>http://uly.me/posts/crontab-on-macos-monterey/</link><pubDate>Tue, 29 Nov 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/crontab-on-macos-monterey/</guid><description>&lt;p&gt;A recent OS upgrade rendered the crontab to malfunction on macOS Monterey. It turned out the system just needed a reset of System Preferences &amp;gt; Security &amp;amp; Privacy &amp;gt; Privacy tab, and to make sure cron has full access to disks. Once you flipped that, your crontab should start working. Hope that helps.&lt;/p&gt;</description></item><item><title>crop factor calculator</title><link>http://uly.me/posts/crop-factor-calculator/</link><pubDate>Sun, 13 Nov 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/crop-factor-calculator/</guid><description>&lt;p&gt;If you’re into photography, you would know what crop factor means. I have a Nikon D90 camera with a crop factor of 1.5. For example, if you use a 24mm full frame lens on a D90, the focal length will be 36mm. So, here’s a handy bash script that calculates the crop factor by multiplying the full frame focal length by 1.5.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [ $# -eq 0 ]
then
echo &amp;#34;Usage: cropfactor.sh 24&amp;#34;
exit
fi
a=$(echo &amp;#34;1.5 * $1&amp;#34; | bc)
echo &amp;#34;Cropfactor focal length is: &amp;#34; $a&amp;#34;mm.&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;</description></item><item><title>bulk ffmpeg resize</title><link>http://uly.me/posts/bulk-ffmpeg-resize/</link><pubDate>Mon, 31 Oct 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bulk-ffmpeg-resize/</guid><description>&lt;p&gt;Here’s how to resize videos and pictures using FFMPEG.&lt;/p&gt;
&lt;p&gt;Bulk Resize Pictures&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;for filename in *.JPG; do
ffmpeg -i &amp;#34;$filename&amp;#34; -vf scale=-1:720 final/&amp;#34;$filename&amp;#34;;
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Bulk Resize Video and Create Thumbnail&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;for filename in *.MP4; do
ffmpeg -i &amp;#34;$filename&amp;#34; -s 1080x720 -pix_fmt yuv420p -crf 18 &amp;#34;$filename&amp;#34;.mp4;
ffmpeg -ss 00:00:00 -i &amp;#34;$filename&amp;#34; -vframes 1 &amp;#34;$filename&amp;#34;.jpg;
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>vim cheatsheet</title><link>http://uly.me/posts/vim-cheatsheet/</link><pubDate>Thu, 27 Oct 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vim-cheatsheet/</guid><description>&lt;p&gt;Almost all are not able to remember all the shortcuts that are available for the vi or vim editor. I will call it vim throughout this article. There are several cheatsheets out there, but the one that works for me is the one provided by &lt;a href="https://vim.rtorr.com/"&gt;rtorr&lt;/a&gt; in Github. I use the cheatsheet often. I suggest that you start small. At the very least learn how to navigate in vim. Once you feel comfortable doing that, you can learn other advanced shortcuts such as editing, search and replace, working with multiple files and many much more. I hope you’ll find the cheatsheet as helpful as it has done for me. Again if you missed the link above, I posted it below.&lt;/p&gt;</description></item><item><title>ffmpeg resize</title><link>http://uly.me/posts/ffmpeg-resize/</link><pubDate>Tue, 25 Oct 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ffmpeg-resize/</guid><description>&lt;p&gt;How to resize JPEG using FFMPEG.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i TREE.JPG -y -vf scale=iw*.2:ih*.2 tree.jpg
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Another option is to set resolution.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i TREE.JPG -y -vf scale=-1:720 tree.jpg
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;How to resize video using FFMPEG.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i TREE.MP4 -s 640x360 -pix_fmt yuv420p -crf 18 tree.mp4
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;How to create a thumbnail from a video.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -ss 00:00:00 -i tree.mp4 -vframes 1 tree.jpg
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>vim colors</title><link>http://uly.me/posts/vim-colors/</link><pubDate>Tue, 25 Oct 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vim-colors/</guid><description>&lt;p&gt;I had trouble getting my vi editor to display all black background color. This includes the background color after the end of the file. I just wanted an all black background for better visibility. I did a little bit of googling and found this nice little gem. I happen to like the dessert theme and went with that instead of the recommended mustang theme which I don’t have installed. Hope you’ll find this helpful.&lt;/p&gt;</description></item><item><title>git remove files from repo after commit</title><link>http://uly.me/posts/git-remove-files-from-repo-after-commit/</link><pubDate>Tue, 04 Oct 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-remove-files-from-repo-after-commit/</guid><description>&lt;p&gt;If you need to remove files from a repo after committing, use …&lt;/p&gt;
&lt;p&gt;Remove file&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git rm --cached file.ext
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Push to repo&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git push
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>install cockpit on rocky 9</title><link>http://uly.me/posts/install-cockpit-on-rocky-9/</link><pubDate>Mon, 03 Oct 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-cockpit-on-rocky-9/</guid><description>&lt;p&gt;Cockpit is a web-based graphical interface for Linux users and admins.&lt;/p&gt;
&lt;p&gt;Install&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dnf install cockpit
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start and Enable&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl start cockpit
systemctl enable cockpit.socket
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Status&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl status cockpit
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Web access&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;http://192.168.0.20:9090
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash menu and functions</title><link>http://uly.me/posts/bash-menu-and-functions/</link><pubDate>Thu, 22 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-menu-and-functions/</guid><description>&lt;p&gt;How to integrate menus and functions in your Bash script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
function show_logs {
ls -l /var/log/
}
function show_users {
cat /etc/passwd
}
echo &amp;#39;--------&amp;#39;
echo &amp;#39;My Menu&amp;#39;
echo &amp;#39;--------&amp;#39;
PS3=&amp;#39;Choose an option: &amp;#39;
commands=(&amp;#34;Show logs&amp;#34; &amp;#34;Show users&amp;#34; &amp;#34;Quit&amp;#34;)
COLUMNS=0
select cmd in &amp;#34;${commands[@]}&amp;#34;; do
case $cmd in
&amp;#34;Show logs&amp;#34;)
echo &amp;#34;Showing logs ... &amp;#34;
show_logs
;;
&amp;#34;Show users&amp;#34;)
echo &amp;#34;Showing users ... &amp;#34;
show_users
;;
&amp;#34;Quit&amp;#34;)
echo &amp;#34;Exiting ... &amp;#34;
exit
;;
*) echo &amp;#34;invalid option $REPLY&amp;#34;;;
esac
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;</description></item><item><title>saving and restoring iptables</title><link>http://uly.me/posts/saving-and-restoring-iptables/</link><pubDate>Thu, 22 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/saving-and-restoring-iptables/</guid><description>&lt;p&gt;iptables can be saved or loaded from a file. Here’s a way to do it.&lt;/p&gt;
&lt;p&gt;Saving to a file&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Debian/Ubuntu
iptables-save &amp;gt; /etc/iptables/rules.v4
# Redhat/Centos/Rocky
iptables-save &amp;gt; /etc/sysconfig/iptables
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Loading from a file&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Debian/Ubuntu
iptables-restore &amp;gt; /etc/iptables/rules.v4
# Redhat/Centos/Rocky
iptables-restore &amp;gt; /etc/sysconfig/iptables
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Listing rules&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;iptables -L
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list of bms servers</title><link>http://uly.me/posts/gcp-list-of-bms-servers/</link><pubDate>Thu, 15 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-of-bms-servers/</guid><description>&lt;p&gt;Here’s how to list Bare Metal Servers in Google Cloud Platform via gcloud.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud bms instances list --region REGION --project PROJECT
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;NAME ID PROJECT REGION MACHINE_TYPE CLIENT_IPS PRIVATE_IPS STATE
server-001 at-xxxxxxx-svr001 project-01 us-central1 o2-ultramem-896-metal 10.0.0.1 192.168.253.1,192.168.252.1 RUNNING
server-002 at-xxxxxxx-svr002 project-02 us-central1 o2-ultramem-896-metal 10.0.0.2 192.168.253.2,192.168.252.2 RUNNING
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Obviously you can see the same from GCP’s Console.&lt;/p&gt;</description></item><item><title>running top by process</title><link>http://uly.me/posts/running-top-by-process/</link><pubDate>Sun, 11 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/running-top-by-process/</guid><description>&lt;p&gt;Here’s how to isolate a process via the top command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;top -c -p $(pgrep -f process_name | head -20 | tr &amp;#34;\\n&amp;#34; &amp;#34;,&amp;#34; | sed &amp;#39;s/,$//&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>hide all windows except current</title><link>http://uly.me/posts/hide-all-windows-except-current/</link><pubDate>Sat, 10 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/hide-all-windows-except-current/</guid><description>&lt;p&gt;Less clutter is good. There are times when there’s too many windows in our desktop. Having less clutter leads to better focus. Here’s how to hide all Windows on a Mac OS except for the current or active one.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Command + Option + h
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I wished there was a command to bring them all back, but I have not found one yet.&lt;/p&gt;</description></item><item><title>history without line numbers</title><link>http://uly.me/posts/history-without-line-numbers/</link><pubDate>Thu, 08 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/history-without-line-numbers/</guid><description>&lt;p&gt;Here’s how to display history without the line numbers.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;history -w /dev/stdout
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /etc/httpd/conf
view httpd.conf
vim wiki.conf
vim ssl.conf
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>cloudwatch notifications</title><link>http://uly.me/posts/cloudwatch-notifications/</link><pubDate>Wed, 07 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cloudwatch-notifications/</guid><description>&lt;p&gt;How to give someone access to enable/disable CloudWatch notifications.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Action&amp;#34;: [
&amp;#34;cloudwatch:DescribeAlarms&amp;#34;,
&amp;#34;cloudwatch:EnableAlarmActions&amp;#34;,
&amp;#34;cloudwatch:DisableAlarmActions&amp;#34;
],
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>df command takes too long</title><link>http://uly.me/posts/df-command-takes-too-long/</link><pubDate>Wed, 07 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/df-command-takes-too-long/</guid><description>&lt;p&gt;Here’s a workaround if the df command takes too long to run.&lt;/p&gt;
&lt;p&gt;This limits listing to local file systems only.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;df -l
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp role policy binding</title><link>http://uly.me/posts/gcp-role-policy-binding/</link><pubDate>Tue, 06 Sep 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-role-policy-binding/</guid><description>&lt;p&gt;How to display the policy binding.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances get-iam-policy SERVER --project=PROJECT_ID --zone=ZONE
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# There is no binding policy
etag: ACAB
# There is a binding policy
bindings:
- members:
- serviceAccount:SERVICEACCOUNT
role: organizations/xxxxxxxxxxxx/roles/ROLE
etag: xxxxxxxxxxx=
version: 1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add a role binding policy&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances add-iam-policy-binding SERVER \
--project=PROJECT_ID \
--zone=ZONE \
--member=serviceAccount:SERVICEACCOUNT \
--role=&amp;#34;organizations/xxxxxxxxxxxx/roles/ROLE&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove a role binding policy&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances remove-iam-policy-binding SERVER \
--project=PROJECT_ID \
--zone=ZONE \
--member=serviceAccount:SERVICEACCOUNT \
--role=&amp;#34;organizations/xxxxxxxxxxxx/roles/ROLE&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>jekyll on docker container</title><link>http://uly.me/posts/jekyll-on-docker-container/</link><pubDate>Wed, 31 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/jekyll-on-docker-container/</guid><description>&lt;p&gt;Here’s how to run Jekyll in a Docker container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir blog
cd blog
docker run -v $(pwd):/site bretfisher/jekyll new .
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start jekyll.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker run -p 4000:4000 -v $(pwd):/site bretfisher/jekyll-serve
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Another option is to use docker compose. Just create a docker-compose.yml file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;version: 3.5
services:
jekyll:
image: bretfisher/jekyll-serve
volumes:
- .:/site
ports:
- &amp;#39;4000:4000&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start Jekyll by using docker-compose up. -d means detach or run in the background.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd blog
docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Stop Jekyll.&lt;/p&gt;</description></item><item><title>cleanup cvs snapshot volumes</title><link>http://uly.me/posts/cleanup-cvs-snapshot-volumes/</link><pubDate>Tue, 30 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cleanup-cvs-snapshot-volumes/</guid><description>&lt;p&gt;How to unmount CVS snapshot volumes all at once using a Bash script. I ran into a scenario where I had to unmount 115 volumes. Instead of manually running umount on each one, I use the script below to unmount all 115 volumes. The script performs a grep for ‘.snapshot’ and then writes the results to a file. I then read the file line by line and perform unmount on each one.&lt;/p&gt;</description></item><item><title>cleanup stale cvs snapshots</title><link>http://uly.me/posts/cleanup-stale-cvs-snapshots/</link><pubDate>Tue, 30 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cleanup-stale-cvs-snapshots/</guid><description>&lt;p&gt;Here’s the script that looks mounts with stale file handles and removes them.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
file=&amp;#39;/tmp/stale.txt&amp;#39;
df -h | grep Stale &amp;gt; $file
sed -i -e &amp;#39;s/df: ‘/&amp;#39;&amp;#34;&amp;#34;&amp;#39;/g&amp;#39; $file
sed -i -e &amp;#39;s/’: Stale file handle/&amp;#39;&amp;#34;&amp;#34;&amp;#39;/g&amp;#39; $file
while IFS= read -r line; do
echo &amp;#39;unmounting &amp;#39;$line
umount $line
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>copy directory structure</title><link>http://uly.me/posts/copy-directory-structure/</link><pubDate>Thu, 25 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/copy-directory-structure/</guid><description>&lt;p&gt;Here’s how to copy a directory structure from one directory to another without the files.&lt;/p&gt;
&lt;p&gt;Copy directory structure of DIR1 to DIR2.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;find /DIR1 -type d &amp;gt; /tmp/dirs.txt
sed -i &amp;#39;s/DIR1/DIR2/&amp;#39; /tmp/dirs.txt
xargs mkdir -p
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>editors on terminal</title><link>http://uly.me/posts/editors-on-terminal/</link><pubDate>Thu, 25 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/editors-on-terminal/</guid><description>&lt;p&gt;How to run editors from the Terminal.&lt;/p&gt;
&lt;p&gt;Sublime, Visual Studio Code, Atom and Bluefish examples.&lt;/p&gt;
&lt;p&gt;Open from the current directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;subl .
code .
atom .
bluefish .
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Open editor using path and file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;subl /etc/hosts
code /etc/hosts
atom /etc/hosts
bluefish /etc/hosts
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash spacebar break</title><link>http://uly.me/posts/bash-spacebar-break/</link><pubDate>Tue, 16 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-spacebar-break/</guid><description>&lt;p&gt;Here’s how to add breaks in your Bash scripts. The function is called spacebar.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function spacebar {
echo &amp;#39;Press spacebar to continue. Press Ctrl-C to exit.&amp;#39;
stty -echo &amp;gt; /dev/null
until read -r -n 1 -t 0.001 &amp;amp;&amp;amp; [ &amp;#34;$REPLY&amp;#34; = &amp;#39; &amp;#39; ]; do abc=&amp;#39;&amp;#39;; done
stty echo &amp;gt; /dev/null
}
spacebar
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can call it multiple times in your script since it’s a function.&lt;/p&gt;</description></item><item><title>set vim colors permanently</title><link>http://uly.me/posts/set-vim-colors-permanently/</link><pubDate>Fri, 12 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/set-vim-colors-permanently/</guid><description>&lt;p&gt;Here’s how to set Vim colors permanently.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vi ~/.vimrc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;highlight Normal ctermfg=white ctermbg=black
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>press spacebar to continue</title><link>http://uly.me/posts/press-spacebar-to-continue/</link><pubDate>Fri, 05 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/press-spacebar-to-continue/</guid><description>&lt;p&gt;Here’s a little snippet of Bash code that waits for spacebar to be pressed to continue.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function spacebar {
echo &amp;#39;Press spacebar to continue. Press Ctrl-C to exit.&amp;#39;
stty -echo &amp;gt; /dev/null
until read -r -n 1 -t 0.001 &amp;amp;&amp;amp; [ &amp;#34;$REPLY&amp;#34; = &amp;#39; &amp;#39; ]; do abc=&amp;#39;&amp;#39;; done
stty echo &amp;gt; /dev/null
}
echo &amp;#39;Starting upgrade&amp;#39;
spacebar
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Starting upgrade
Press spacebar to continue. Or Ctrl-C to exit.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you press spacebar it will continue. Ctrl-C exits the program.&lt;/p&gt;</description></item><item><title>bare metal servers</title><link>http://uly.me/posts/bare-metal-servers/</link><pubDate>Thu, 04 Aug 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bare-metal-servers/</guid><description>&lt;p&gt;Why would you choose Bare Metal Servers?&lt;/p&gt;
&lt;p&gt;Advantages&lt;/p&gt;
&lt;p&gt;– BMS are dedicated to a single organization&lt;br&gt;
– Single tenant or dedicated host&lt;br&gt;
– No sharing of hardware, storage, connection, bandwidth (noisy neighbor)&lt;br&gt;
– There is no hypervisor layer&lt;br&gt;
– No virtualization overhead&lt;br&gt;
– OS is loaded straight to the server&lt;br&gt;
– Results in higher performance&lt;br&gt;
– Quality of hardware&lt;br&gt;
– Compliance and security due to single tenant&lt;br&gt;
– Flexible contract, billing options&lt;/p&gt;</description></item><item><title>check mounted file systems</title><link>http://uly.me/posts/check-mounted-file-systems/</link><pubDate>Thu, 28 Jul 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-mounted-file-systems/</guid><description>&lt;p&gt;Check mounted file systems using df. Displaying different options.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;df
df -h
df -Th
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To get rid tmpfs, run this.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;df -Th| grep -Ev &amp;#39;(udev|tmpfs)&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp extend ext4 boot volume</title><link>http://uly.me/posts/gcp-extend-ext4-boot-volume/</link><pubDate>Thu, 28 Jul 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-extend-ext4-boot-volume/</guid><description>&lt;p&gt;Here’s how to extend an ext4 boot volume.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks resize DISK_NAME --size DISK_SIZE --zone ZONE --project PROJECTID
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Resize the file system. Example / is on sda3.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;growpart /dev/sda 3
resize2fs /dev/sda3
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws get access key info</title><link>http://uly.me/posts/aws-get-access-key-info/</link><pubDate>Tue, 28 Jun 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-get-access-key-info/</guid><description>&lt;p&gt;How to look for an access key in AWS. Find the account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ aws sts get-access-key-info --access-key-id AKIA8XXXXXXXXXXXXXXX
{
&amp;#34;Account&amp;#34;: &amp;#34;XXXXXXXXXXXX&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create service account via terraform</title><link>http://uly.me/posts/gcp-create-service-account-via-terraform/</link><pubDate>Mon, 27 Jun 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-service-account-via-terraform/</guid><description>&lt;p&gt;How to create service account in GCP via Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;provider &amp;#34;google&amp;#34; {
project = &amp;#34;your_project_id&amp;#34;
}
resource &amp;#34;google_service_account&amp;#34; &amp;#34;service_account&amp;#34; {
account_id = &amp;#34;your-service-account-name&amp;#34;
display_name = &amp;#34;test service account built by terraform&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>calculate date to epoch time</title><link>http://uly.me/posts/calculate-date-to-epoch-time/</link><pubDate>Fri, 24 Jun 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/calculate-date-to-epoch-time/</guid><description>&lt;p&gt;Here’s a script to convert date to epoch time on Mac OS.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [[ -z $1 ]]; then
echo &amp;#34;Format: date2epoch.sh 2022/01/01-04:58:06&amp;#34;
else
echo &amp;#34;$1&amp;#34;; date -j -f date -j -f &amp;#34;%Y/%m/%d-%T&amp;#34; &amp;#34;$1&amp;#34; +&amp;#34;%s&amp;#34;
fi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ ./date2epoch.sh 2022/08/31-22:00:00
2022/08/31-22:00:00
1661997600
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp cloudshell via terminal</title><link>http://uly.me/posts/gcp-cloudshell-via-terminal/</link><pubDate>Mon, 20 Jun 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-cloudshell-via-terminal/</guid><description>&lt;p&gt;Connect to your CloudShell environment from your terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ gcloud cloud-shell ssh
Welcome to Cloud Shell! Type &amp;#34;help&amp;#34; to get started.
first.last@cloudshell $
first.last@cloudshell $
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once logged in, you can set your project.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;first.last@cloudshell $ gcloud config set project $PROJECT_ID
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp move vm to another vpc</title><link>http://uly.me/posts/gcp-move-vm-to-another-vpc/</link><pubDate>Sun, 19 Jun 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-move-vm-to-another-vpc/</guid><description>&lt;p&gt;Here’s how to move a VM to another VPC.&lt;/p&gt;
&lt;p&gt;Stop VM.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances stop $INSTANCE_NAME \
--zone $ZONE_NAME \
--project $PROJECT_ID
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Move VM to another VPC.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances network-interfaces update $INSTANCE_NAME \
--zone $ZONE_NAME \
--network-interface=nic0 \
--network $YOUR_NETWORK \
--subnetwork $YOUR_SUBNETWORK \
--project $PROJECT_ID
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start VM.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances start $INSTANCE_NAME \
--zone $ZONE_NAME \
--project $PROJECT_ID
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gsutil describe bucket</title><link>http://uly.me/posts/gsutil-describe-bucket/</link><pubDate>Mon, 13 Jun 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gsutil-describe-bucket/</guid><description>&lt;p&gt;How to describe a GCP bucket.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gsutil ls -L -b gs://my-bucket
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git reset file from master</title><link>http://uly.me/posts/git-reset-file-from-master/</link><pubDate>Sat, 28 May 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-reset-file-from-master/</guid><description>&lt;p&gt;Here’s how to reset a file from the master branch.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git checkout origin/master test.py
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will undo your changes and matches what’s in the master repo.&lt;/p&gt;</description></item><item><title>ajax live search</title><link>http://uly.me/posts/ajax-live-search/</link><pubDate>Sun, 22 May 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ajax-live-search/</guid><description>&lt;p&gt;Just implemented an Ajax live search on a website.&lt;/p&gt;
&lt;p&gt;Here’s the search page. Results are displayed in div output.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;script src=&amp;#34;https://code.jquery.com/jquery-3.4.1.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;#34;text/javascript&amp;#34;&amp;gt;
$(document).ready(function(){
$(&amp;#34;#search&amp;#34;).keyup(function(){
var query = $(this).val();
if (query != &amp;#34;&amp;#34;) {
$.ajax({
url: &amp;#39;links-ajax.php&amp;#39;,
method: &amp;#39;POST&amp;#39;,
data: {query:query},
success: function(data){
$(&amp;#39;#output&amp;#39;).html(data);
$(&amp;#39;#output&amp;#39;).css(&amp;#39;display&amp;#39;, &amp;#39;block&amp;#39;);
$(&amp;#34;#output a&amp;#34;).on(&amp;#34;click&amp;#34;, function(){
$(&amp;#34;#output&amp;#34;).val($(this).html());
});
$(&amp;#34;#search&amp;#34;).focusout(function(){
window.setTimeout(function() {
$(&amp;#39;#output&amp;#39;).css(&amp;#39;display&amp;#39;, &amp;#39;none&amp;#39;);
}, 500);
});
$(&amp;#34;#search&amp;#34;).focusin(function(){
$(&amp;#39;#output&amp;#39;).css(&amp;#39;display&amp;#39;, &amp;#39;block&amp;#39;);
});
}
});
} else {
$(&amp;#39;#output&amp;#39;).css(&amp;#39;display&amp;#39;, &amp;#39;none&amp;#39;);
}
});
});
&amp;lt;/script&amp;gt;
&amp;lt;div class=&amp;#34;form-row&amp;#34;&amp;gt;
&amp;lt;div class=&amp;#34;col&amp;#34;&amp;gt;
&amp;lt;input autocomplete=&amp;#34;off&amp;#34; class=&amp;#34;form-control form-control-success&amp;#34; id=&amp;#34;search&amp;#34; name=&amp;#34;search&amp;#34; placeholder=&amp;#34;Search here....&amp;#34; type=&amp;#34;text&amp;#34;&amp;gt;&amp;lt;/input&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div id=&amp;#34;output&amp;#34;&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the links-ajax.php which display the search results with links.&lt;/p&gt;</description></item><item><title>python web server</title><link>http://uly.me/posts/python-web-server/</link><pubDate>Fri, 20 May 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/python-web-server/</guid><description>&lt;p&gt;Here’s a quick way to start a web server using Python (not recommended for production).&lt;/p&gt;
&lt;p&gt;If you want to use python3, you may have to use explicitly use python3.&lt;/p&gt;
&lt;p&gt;Check what versions you have first.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;python --version
python3 --version
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start web server using port 8080 in the current directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;python -m http.server 8080
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want an alternate directory, use this -d option.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;python -m http.server 8080 -d /tmp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It’s a great tool for quick downloads.&lt;/p&gt;</description></item><item><title>gcp find instance boot disk</title><link>http://uly.me/posts/gcp-find-instance-boot-disk/</link><pubDate>Wed, 13 Apr 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-find-instance-boot-disk/</guid><description>&lt;p&gt;How to find a boot disk from an instance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances describe servername \
--format=&amp;#39;get(disks[0].source)&amp;#39; \
--zone=us-central1-c \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-f/disks/servername-boot
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>7zip in mac os</title><link>http://uly.me/posts/7zip-in-mac-os/</link><pubDate>Wed, 06 Apr 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/7zip-in-mac-os/</guid><description>&lt;p&gt;Install&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;brew install p7zip
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Extract&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;7z x file.7z
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Compress&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;7z a file.7z mydirectory
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp backup instance</title><link>http://uly.me/posts/gcp-backup-instance/</link><pubDate>Sun, 03 Apr 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-backup-instance/</guid><description>&lt;p&gt;Here’s the script to backup GCP disks.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
now=$(date +%s)
disks=$(gcloud compute disks list --project project-id --filter=&amp;#34;users:instance&amp;#34; --format=&amp;#34;value(name)&amp;#34;)
for disk in $disks
do
gcloud compute disks snapshot $disk \
--snapshot-names=$disk-$now \
--zone=us-central1-a \
--project=project-id \
--async
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>remove extended attributes on mac</title><link>http://uly.me/posts/remove-extended-attributes-on-mac/</link><pubDate>Sun, 03 Apr 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-extended-attributes-on-mac/</guid><description>&lt;p&gt;If you have a file with @ sign at end, this is how to remove extended attributes on the Mac OS.&lt;/p&gt;
&lt;p&gt;Example.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ls -l
-rwxr-xr-x@ 4 username staff 128 Mar 24 10:51 sample.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove extended attributes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;xattr -c sample.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ls -l
-rwxr-xr-x 4 username staff 128 Mar 24 10:51 sample.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>vi search and replace</title><link>http://uly.me/posts/vi-search-and-replace/</link><pubDate>Sun, 03 Apr 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vi-search-and-replace/</guid><description>&lt;p&gt;How to do search and replace in Vim.&lt;/p&gt;
&lt;p&gt;Search for “foo” and replace it with “bar” in the current line. Use :s&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/foo/bar/g
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Search for “foo” and replace it with “bar” in the entire document. Use :%s&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:%s/foo/bar/g
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also pipe instead of forward slash. Useful if your search contains a /.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:%s|foo/|bar|g
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>redhat 8 network manager</title><link>http://uly.me/posts/redhat-8-network-manager/</link><pubDate>Thu, 10 Mar 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/redhat-8-network-manager/</guid><description>&lt;p&gt;In Redhat 8, every time you the Network Manager get’s restarted it overwrites /etc/resolv.conf. To prevent that from hapenning, create a new file called /etc/NetworkManager/conf.d/90-dns-none.conf and add the following lines. Restart Network Manager. Your /etc/resolv.conf should be unchanged.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[main]
dns=none
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart Network Manager&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ systemctl reload NetworkManager
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp project quotas</title><link>http://uly.me/posts/gcp-project-quotas/</link><pubDate>Tue, 08 Mar 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-project-quotas/</guid><description>&lt;p&gt;Here’s how to get your project quotas in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute project-info describe --project your-project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp regional quotas</title><link>http://uly.me/posts/gcp-regional-quotas/</link><pubDate>Tue, 08 Mar 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-regional-quotas/</guid><description>&lt;p&gt;Here’s how to get Regional Quotas for your project in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute regions describe us-central1 --project your-project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>windows check if port is listening</title><link>http://uly.me/posts/windows-check-if-port-is-listening/</link><pubDate>Thu, 03 Mar 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/windows-check-if-port-is-listening/</guid><description>&lt;p&gt;Here’s how to check if port is listening on a Windows Server.&lt;/p&gt;
&lt;p&gt;Log in to the destination server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;netstat -ano | find &amp;#34;443&amp;#34; | find &amp;#34;LISTEN&amp;#34;
tasklist /fi &amp;#34;PID eq &amp;#34;443&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash reformat numbers</title><link>http://uly.me/posts/bash-reformat-numbers/</link><pubDate>Sun, 27 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-reformat-numbers/</guid><description>&lt;p&gt;How to reformat numbers in Bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ n=1023555
$ m=$(numfmt --to=si n)
$ echo $m
1.1M
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Other options&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;--to=none # no scaling. Output: 1023555
--to=si # International System of Units (SI) standard. Output 1.1M
--to=iec # International Electrotechnical Commission (IEC) standard. Output: 1.1Mi
--to=iec-i # International Electrotechnical Commission (IEC) standard. Output: 1.1M
--to=auto # ‘auto’ can only be used with --from.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a href="http://www.gnu.org/software/coreutils/manual/html_node/numfmt-invocation.html"&gt;fmtnum&lt;/a&gt;&lt;/p&gt;</description></item><item><title>python boto3 s3 list objects</title><link>http://uly.me/posts/python-boto3-s3-list-objects/</link><pubDate>Sun, 27 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/python-boto3-s3-list-objects/</guid><description>&lt;p&gt;How to list S3 objects using Python Boto3&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import boto3
from sys import argv
bucket=argv[1]
s3 = boto3.resource(&amp;#39;s3&amp;#39;)
mybucket = s3.Bucket(bucket)
def list_buckets():
print(&amp;#34;List of Buckets: &amp;#34;)
for bucket in s3.buckets.all():
print(bucket.name)
def list_files():
print(&amp;#34;Buckets: The objects in the \&amp;#34;&amp;#34; + bucket + &amp;#34;\&amp;#34; buckets are ... &amp;#34;)
for files in mybucket.objects.all():
print(files.key)
def main():
#list_buckets()
list_files()
if __name__ == &amp;#34;__main__&amp;#34;:
main()
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Running command&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ python test.py bucket-name # with python
$ ./test.py bucket-name # without python
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Results&lt;/p&gt;</description></item><item><title>python virtual environment</title><link>http://uly.me/posts/python-virtual-environment/</link><pubDate>Sun, 27 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/python-virtual-environment/</guid><description>&lt;p&gt;How to create a Python virtual environment.&lt;/p&gt;
&lt;p&gt;On Windows&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ pip install venv
$ python3 -m venv ~/python-test
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;On Ubuntu&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo apt install python3.8-venv
$ python3 -m venv ~/python-test
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;On Mac OS&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ brew install virtualenv
$ virtualenv python-test
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Activate&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cd ~/python-test
$ source bin/activate
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Deactivate&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ deactivate
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp monitor service account</title><link>http://uly.me/posts/gcp-monitor-service-account/</link><pubDate>Thu, 24 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-monitor-service-account/</guid><description>&lt;p&gt;You can monitor the success or failure of a service account in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud policy-intelligence query-activity \
--activity-type=ACTIVITY_TYPE \
--project=PROJECT_ID \
--limit=LIMIT
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The two options you can use for ACTIVITY_TYPE are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;serviceAccountKeyLastAuthentication&lt;/li&gt;
&lt;li&gt;serviceAccountLastAuthentication&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>aws sdk load config</title><link>http://uly.me/posts/aws-sdk-load-config/</link><pubDate>Mon, 14 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-sdk-load-config/</guid><description>&lt;p&gt;Occasionally I was getting this random error when running Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;╷
│ Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.
│
│ Please see https://registry.terraform.io/providers/hashicorp/aws
│ for more information about providing credentials.
│
│ Error: RequestError: send request failed
│ caused by: Post &amp;#34;https://sts.amazonaws.com/&amp;#34;: read tcp xx.xx.xx.xx:59422-&amp;gt;xx.xx.xx.xx:443: read: connection reset by peer
│
│
│ with provider[&amp;#34;registry.terraform.io/hashicorp/aws&amp;#34;],
│ on main.tf line 10, in provider &amp;#34;aws&amp;#34;:
│ 10: provider &amp;#34;aws&amp;#34; {
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the fix. Place this in your ~/.bash_profile.&lt;/p&gt;</description></item><item><title>gcp windows password reset</title><link>http://uly.me/posts/gcp-windows-password-reset/</link><pubDate>Mon, 14 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-windows-password-reset/</guid><description>&lt;p&gt;Instead of the GCP Console, you can reset Windows Server password via gcloud.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute reset-windows-password server-name \
--zone us-central1-a \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Username and password will generated.&lt;/p&gt;</description></item><item><title>google sdk ssh mac terminal</title><link>http://uly.me/posts/google-sdk-ssh-mac-terminal/</link><pubDate>Mon, 14 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/google-sdk-ssh-mac-terminal/</guid><description>&lt;p&gt;I’m having trouble logging in using Google SDK Compute SSH on a Mac Terminal.&lt;/p&gt;
&lt;p&gt;Here’s the fix.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssh USERNAME@SERVER --zone ZONE --project PROJECTID --internal-ip 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There was an issue with a redirect to another shell.&lt;/p&gt;</description></item><item><title>saml2aws</title><link>http://uly.me/posts/saml2aws/</link><pubDate>Mon, 14 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/saml2aws/</guid><description>&lt;p&gt;Use Saml2Aws CLI as an alternative to SAML to AWS STS Key Conversion.&lt;/p&gt;
&lt;p&gt;Install on Mac.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;brew install saml2aws
saml2aws --version
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Configure. Provide information.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;saml2aws configure
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It will create a ~/.saml2aws config file. Set session to 8 hours.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws_session_duration = 28800
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Login.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;saml2aws login
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After authentication and/or MFA, your ~/.aws/credentials will be updated.&lt;/p&gt;</description></item><item><title>gcp compute startup script</title><link>http://uly.me/posts/gcp-compute-startup-script/</link><pubDate>Sat, 12 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-compute-startup-script/</guid><description>&lt;p&gt;How to add startup and shutdown scripts on GCP Compute Engine.&lt;/p&gt;
&lt;p&gt;Startup Script&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances add-metadata servername \
--project project-id \
--zone us-central1-c \
--metadata=startup-script=&amp;#39;#! /bin/bash
sudo -i
echo &amp;#34;Time: $(date)&amp;#34; &amp;gt;&amp;gt; /tmp/date.txt&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Shutdown Script&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances add-metadata servername \
--project project-id \
--zone us-central1-c \
--metadata=shutdown-script=&amp;#39;#! /bin/bash
# Shuts down Apache server
/etc/init.d/apache2 stop&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git reset hard</title><link>http://uly.me/posts/git-reset-hard/</link><pubDate>Sat, 12 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-reset-hard/</guid><description>&lt;p&gt;Reset uncommitted changes to both files and directories.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git reset --hard
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove untracked files and directories.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git clean -fd
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>linux prompt display current directory only</title><link>http://uly.me/posts/linux-prompt-display-current-directory-only/</link><pubDate>Fri, 11 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-prompt-display-current-directory-only/</guid><description>&lt;p&gt;Here’s the command to display only the current directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;export PROMPT_DIRTRIM=1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Place the command in your ~/.bashrc to make it permanent.&lt;/p&gt;</description></item><item><title>set terminal browser to firefox</title><link>http://uly.me/posts/set-terminal-browser-to-firefox/</link><pubDate>Mon, 07 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/set-terminal-browser-to-firefox/</guid><description>&lt;p&gt;Every time I log in to Google Cloud, it’s using the Chromium.&lt;/p&gt;
&lt;p&gt;Set BROWSER env to Firefox instead.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;export BROWSER=/usr/bin/firefox
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Login to GCP. It should open up Firefox browser instead of Chromium.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth login
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add it your .bashrc or .bashprofile if you want it to be permanent.&lt;/p&gt;</description></item><item><title>sftp command line</title><link>http://uly.me/posts/sftp-command-line/</link><pubDate>Sun, 06 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sftp-command-line/</guid><description>&lt;p&gt;Here are command lines you can within SFTP.&lt;/p&gt;
&lt;p&gt;Login.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sftp username@servername
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Commands available from the local client.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lls
lcd
lmkdir
lpwd
lumask
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Commands available on remote server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd
chmod
chown
exit
get
help
ln
ls
mkdir
put
pwd
rename
rm
rmdir
version
!
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>extend lvm logical volume</title><link>http://uly.me/posts/extend-lvm-logical-volume/</link><pubDate>Sat, 05 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/extend-lvm-logical-volume/</guid><description>&lt;p&gt;How to extend a LVM logical volume.&lt;/p&gt;
&lt;p&gt;Extend the physical drive.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks resize data-drive --size=40GB
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;SSH to a server and extend the physical volume.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ pvresize /dev/sdb
Physical volume &amp;#34;/dev/sdb&amp;#34; changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;$ pvs
PV VG Fmt Attr PSize PFree
/dev/sdb vg lvm2 a--
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;$ vgs
VG #PV #LV #SN Attr VSize VFree
vg 1 1 0 wz--n-
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;$ lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
data vg -wi-ao----
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Extend the logical volume.&lt;/p&gt;</description></item><item><title>setup lvm on a vm</title><link>http://uly.me/posts/setup-lvm-on-a-vm/</link><pubDate>Sat, 05 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/setup-lvm-on-a-vm/</guid><description>&lt;p&gt;How to setup Logical Volume Manager on a VM.&lt;/p&gt;
&lt;p&gt;Install LVM.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install lvm2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check the disks available. We are going to run LVM on /dev/sdb.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
└─sda2 8:2 0 19.8G 0 part /
sdb 8:16 0 20G 0 disk
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a physical volume on /dev/sdb.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ pvcreate /dev/sdb
Physical volume &amp;#34;/dev/sdb&amp;#34; successfully created.
$ pvs
PV VG Fmt Attr PSize PFree
/dev/sdb vg lvm2 a--
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a volume group called vg.&lt;/p&gt;</description></item><item><title>gcp reset windows password</title><link>http://uly.me/posts/gcp-reset-windows-password/</link><pubDate>Fri, 04 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-reset-windows-password/</guid><description>&lt;p&gt;How to reset password of a GCP Compute Engine running on Windows OS.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute reset-windows-password servername \
--zone us-central1-a \
--project your-project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;This command creates an account and sets an initial password for the
user [firstname_lastname] if the account does not already exist.
If the account already exists, resetting the password can cause the
LOSS OF ENCRYPTED DATA secured with the current password, including
files and stored passwords.
For more information, see:
https://cloud.google.com/compute/docs/operating-systems/windows#reset
Would you like to set or reset the password for [firstname_lastname]
(Y/n)? y
Resetting and retrieving password for [firstname_lastname] on [servername]
Updated [https://www.googleapis.com/compute/v1/projects/your-project-id/zones/us-central1-a/instances/servername].
WARNING: Instance [servername] does not appear to have an external IP
address, so it will not be able to accept external connections.
To add an external IP address to the instance, use
gcloud compute instances add-access-config.
password: xxxxxxxxxxxxxxx
username: firstname_lastname
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp terraform second drive</title><link>http://uly.me/posts/gcp-terraform-second-drive/</link><pubDate>Fri, 04 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-terraform-second-drive/</guid><description>&lt;p&gt;How to add a second drive on GCP Compute Engine using Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;provider &amp;#34;google&amp;#34; {
project = &amp;#34;your-project-id&amp;#34;
zone = &amp;#34;us-central1-c&amp;#34;
}
resource &amp;#34;google_compute_disk&amp;#34; &amp;#34;data-drive&amp;#34; {
name = &amp;#34;data-drive&amp;#34;
type = &amp;#34;pd-standard&amp;#34;
zone = &amp;#34;us-central1-c&amp;#34;
size = &amp;#34;20&amp;#34;
}
resource &amp;#34;google_compute_attached_disk&amp;#34; &amp;#34;attach-data-drive&amp;#34; {
count = 1
disk = google_compute_disk.data-drive.id
instance = google_compute_instance.test.id
}
resource &amp;#34;google_compute_instance&amp;#34; &amp;#34;test&amp;#34; {
name = &amp;#34;test&amp;#34;
machine_type = &amp;#34;e2-micro&amp;#34;
boot_disk {
initialize_params {
image = &amp;#34;rocky-linux-cloud/rocky-linux-8&amp;#34;
}
}
scheduling {
preemptible = true
automatic_restart = false
}
network_interface {
network = &amp;#34;default&amp;#34;
access_config {
}
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>yum cache corruption</title><link>http://uly.me/posts/yum-cache-corruption/</link><pubDate>Fri, 04 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yum-cache-corruption/</guid><description>&lt;p&gt;If you’re getting a “HTTP Error 404 – Not Found” error when trying to run yum update, it could be a corrupted cache. Clear the cache on the system by running the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum clean all
rm -rf /var/cache/yum/*
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run yum update again. The errors should be gone.&lt;/p&gt;</description></item><item><title>gcp compute add startup-script to metadata</title><link>http://uly.me/posts/gcp-compute-add-startup-script-to-metadata/</link><pubDate>Wed, 02 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-compute-add-startup-script-to-metadata/</guid><description>&lt;p&gt;How to add a startup-script to metadata. The script executes every time VM is started.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances add-metadata instance-name \
--project your-project-id \
--zone us-central1-c \
--metadata=startup-script=&amp;#39;#! /bin/bash
sudo -i
echo &amp;#34;Time: $(date)&amp;#34; &amp;gt;&amp;gt; /tmp/date.txt&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create scheduled snapshots</title><link>http://uly.me/posts/gcp-create-scheduled-snapshots/</link><pubDate>Wed, 02 Feb 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-scheduled-snapshots/</guid><description>&lt;p&gt;How to create scheduled snapshots in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute resource-policies create snapshot-schedule hourly \
--description &amp;#34;my hourly schedule&amp;#34; \
--max-retention-days 7 \
--start-time 00:00 \
--hourly-schedule 1 \
--region us-central1 \
--on-source-disk-delete keep-auto-snapshots \
--storage-location US
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add snapshot schedule to a disk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks add-resource-policies disk-name \
--resource-policies hourly \
--zone us-central1-a
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks create disk-name \
--resource-policies hourly \
--zone us-central1-a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List snapshot schedules.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute resource-policies list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Describe snapshot schedule.&lt;/p&gt;</description></item><item><title>aws elb ssl listener</title><link>http://uly.me/posts/aws-elb-ssl-listener/</link><pubDate>Mon, 31 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-elb-ssl-listener/</guid><description>&lt;p&gt;Here’s how to update SSL certificates to AWS ELB.&lt;/p&gt;
&lt;p&gt;Import SSL certificate&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm import-certificate \
--certificate fileb://example.crt \
--private-key fileb://example.key \
--certificate-chain fileb://example-bundle.crt \
--tags Key=Name,Value=mydomain.com_20220107 \
--profile default
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add SSL to a listener.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws elbv2 add-listener-certificates \
--listener-arn arn:aws:elasticloadbalancing:us-east-1:xxxxxxxxxxxxx:listener/app/elbname/xxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxx \
--certificates CertificateArn=arn:aws:acm:us-east-1:xxxxxxxxxxxx:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
--profile default
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Modify listener. Set SSL certificate as default.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws elbv2 modify-listener \
--listener-arn arn:aws:elasticloadbalancing:us-east-1:xxxxxxxxxxxxx:listener/app/elbname/xxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxx \
--certificates CertificateArn=arn:aws:acm:us-east-1:xxxxxxxxxxxx:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
--profile default
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove SSL from a listener.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws elbv2 remove-listener-certificates \
--listener-arn arn:aws:elasticloadbalancing:us-east-1:xxxxxxxxxxxxx:listener/app/elbname/xxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxx \
--certificates CertificateArn=arn:aws:acm:us-east-1:xxxxxxxxxxxx:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx \
--profile default
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp gcloud compute scp</title><link>http://uly.me/posts/gcp-gcloud-compute-scp/</link><pubDate>Mon, 31 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-gcloud-compute-scp/</guid><description>&lt;p&gt;Here’s how to download/upload files using gcloud compute scp.&lt;/p&gt;
&lt;p&gt;Make sure you are authenticated.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth login
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;How to download.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute scp --recurse your-server:/home/username/yaml.tar.gz . \
--project your-project-id \
--zone us-central1-a \
--internal-ip
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;How to upload.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute scp --recurse yaml.tar.gz your-server:/home/username/ \
--project your-project-id \
--zone us-central1-a \
--internal-ip
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>create local repo in rocky linux 8</title><link>http://uly.me/posts/create-local-repo-in-rocky-linux-8/</link><pubDate>Sun, 30 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-local-repo-in-rocky-linux-8/</guid><description>&lt;p&gt;How to create a local repo in Rocky Linux 8.&lt;/p&gt;
&lt;p&gt;Install nginx. Enable service.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dnf install nginx
systemctl enable nginx --now
systemctl status nginx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create repo.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dnf repolist
dnf install createrepo yum-utils
mkdir /usr/share/nginx/html/repos
mkdir -p /usr/share/nginx/html/repos/{baseos,appstream}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Sync repos.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dnf reposync -g --delete -p /usr/share/nginx/html/repos/ --repoid=baseos --newest-only --download-metadata
dnf reposync -g --delete -p /usr/share/nginx/html/repos/ --repoid=appstream --newest-only --download-metadata
createrepo /usr/share/nginx/html/repos/baseos/
createrepo /usr/share/nginx/html/repos/appstream/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create cron to sync repos daily. Create file called /etc/cron.daily/update-localrepos&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
/bin/dnf reposync -g --delete -p /usr/share/nginx/html/repos/ --repoid=baseos --newest-only --download-metadata
/bin/dnf reposync -g --delete -p /usr/share/nginx/html/repos/ --repoid=appstream --newest-only --download-metadata
/usr/bin/createrepo /usr/share/nginx/html/repos/baseos/
/usr/bin/createrepo /usr/share/nginx/html/repos/appstream/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a file called /etc/nginx/conf.d/repos.conf.&lt;/p&gt;</description></item><item><title>gcp cvs mount instructions</title><link>http://uly.me/posts/gcp-cvs-mount-instructions/</link><pubDate>Fri, 28 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-cvs-mount-instructions/</guid><description>&lt;p&gt;Here are the mount instructions for NFS and SMB drives for GCP Netapp CVS.&lt;/p&gt;
&lt;p&gt;NFS&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo yum install -y nfs-utils
sudo apt-get install nfs-common
sudo mkdir /condescending-sharp-hugle
sudo mount -t nfs -o rw,hard,rsize=65536,wsize=65536,vers=3,tcp 10.49.253.6:/condescending-sharp-hugle /condescending-sharp-hugle
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;SMB&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Mapping your network drive
1. Click the Start button and then click on Computer.
2. Click Map Network Drive.
3. In the Drive list, click any available drive letter.
4. In the folder box, type \\shared.mydomain.com\myshare.
To connect every time you log on to your computer, select the Reconnect at sign-in check box.
\\shared.mydomain.com\myshare
5. Click Finish.
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list keys of service account</title><link>http://uly.me/posts/gcp-list-keys-of-service-account/</link><pubDate>Wed, 26 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-keys-of-service-account/</guid><description>&lt;p&gt;How to list all the keys of a GCP service account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud iam service-accounts keys list \
--iam-account=your-service-account@your-project-id.iam.gserviceaccount.com \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result. Keys are redacted.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;KEY_ID CREATED_AT EXPIRES_AT DISABLED
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2022-01-10T19:21:18Z 2022-01-26T19:21:18Z
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2022-01-19T00:06:49Z 2022-02-04T00:06:49Z
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git switch from https to ssh</title><link>http://uly.me/posts/git-switch-from-https-to-ssh/</link><pubDate>Thu, 20 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-switch-from-https-to-ssh/</guid><description>&lt;p&gt;If you have trouble cloning a github repo using https, you can tell it to switch to SSH instead.&lt;/p&gt;
&lt;p&gt;Here’s the command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git config --global url.ssh://git@github.com/.insteadOf https://github.com/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I had to specify reconfigure when I ran terraform init.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform init --reconfigure
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>allow key access for user in ssh</title><link>http://uly.me/posts/allow-key-access-for-user-in-ssh/</link><pubDate>Sun, 16 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/allow-key-access-for-user-in-ssh/</guid><description>&lt;p&gt;Allow shared key access only for one user in SSH.&lt;/p&gt;
&lt;p&gt;Disable the password authentication for one user in your SSH config. Edit /etc/ssh/sshd_config.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Match User username
PasswordAuthentication no
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart the SSH service.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service ssh restart
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Copy user’s public key to the destination server’s authorized file in ~/.ssh/authorized_keys.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ssh-rsa AAAAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Back on your client, login via SSH. User will not be prompted for password since public key is already authorized on server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ssh username@server
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>metadata url</title><link>http://uly.me/posts/metadata-url/</link><pubDate>Sat, 15 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/metadata-url/</guid><description>&lt;p&gt;Here’s the metadata URLs for both AWS and GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;curl http://169.254.169.254/computeMetadata/v1/ -H &amp;#34;Metadata-Flavor: Google&amp;#34;
curl http://169.254.169.254/latest/meta-data/
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>json formatter</title><link>http://uly.me/posts/json-formatter/</link><pubDate>Wed, 12 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/json-formatter/</guid><description>&lt;p&gt;If you have a json file that needs formatting, you can use a built-in tool in Python.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;python -m json.tool sample.json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output will be printed on screen. You can also send the output to a file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;python -m json.tool sample.json &amp;gt; sample2.json
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>add alias in csh</title><link>http://uly.me/posts/add-alias-in-csh/</link><pubDate>Sat, 08 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-alias-in-csh/</guid><description>&lt;p&gt;How to add an alias in csh. Edit .cshrc file. Add an alias.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;alias hello ls -l
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Load.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;source .cshrc
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>adding path in csh</title><link>http://uly.me/posts/adding-path-in-csh/</link><pubDate>Sat, 08 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/adding-path-in-csh/</guid><description>&lt;p&gt;How to add path in csh. Open or create .cshrc file. Add to an existing path.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;set path = ( /home/ubuntu $path )
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Activate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;source .cshrc
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>lock a package in linux</title><link>http://uly.me/posts/lock-a-package-in-linux/</link><pubDate>Fri, 07 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lock-a-package-in-linux/</guid><description>&lt;p&gt;Here’s how to lockdown a package to a specific version.&lt;/p&gt;
&lt;p&gt;Search for the current package.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo rpm -qa | grep sdk
google-cloud-sdk-365.0.1-1.x86_64
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install versionlock.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install yum-plugin-versionlock
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Lock a package.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum versionlock google-cloud-sdk-365.0.1-1.x86_64
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display all locked versions.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum versionlock list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Unlock and clear.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum versionlock clear
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ssl pem expiration</title><link>http://uly.me/posts/ssl-pem-expiration/</link><pubDate>Thu, 06 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ssl-pem-expiration/</guid><description>&lt;p&gt;Find out when SSL expires from a PEM file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ openssl x509 -enddate -noout -in your.cert
notAfter=Jan 5 07:08:14 2032 GMT
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;notAfter date is returned.&lt;/p&gt;</description></item><item><title>aws acm list certificates</title><link>http://uly.me/posts/aws-acm-list-certificates/</link><pubDate>Tue, 04 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-acm-list-certificates/</guid><description>&lt;p&gt;How to list SSL certificates in AWS Certificate Manager.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm list-certificates
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;CertificateSummaryList&amp;#34;: [
{
&amp;#34;CertificateArn&amp;#34;: &amp;#34;arn:aws:acm:us-east-1:xxxxxxxxxxxx:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&amp;#34;,
&amp;#34;DomainName&amp;#34;: &amp;#34;mydomain.com&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Describe details about the certificate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm describe-certificate \
--certificate-arn arn:aws:acm:us-east-1:xxxxxxxxxxxx:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
--region us-east-1 \
--profile my-profile
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws terraform security group</title><link>http://uly.me/posts/aws-terraform-security-group/</link><pubDate>Tue, 04 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-terraform-security-group/</guid><description>&lt;p&gt;How to create AWS security groups using Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;resource &amp;#34;aws_security_group&amp;#34; &amp;#34;my-security-group&amp;#34; {
name = &amp;#34;my-security-group&amp;#34;
description = &amp;#34;allow ports&amp;#34;
vpc_id = aws_vpc.my-vpc.id
ingress {
description = &amp;#34;ping&amp;#34;
from_port = 0
to_port = 0
protocol = &amp;#34;-1&amp;#34;
cidr_blocks = [&amp;#34;0.0.0.0/0&amp;#34;]
}
ingress {
description = &amp;#34;http&amp;#34;
from_port = 80
to_port = 80
protocol = &amp;#34;tcp&amp;#34;
cidr_blocks = [&amp;#34;0.0.0.0/0&amp;#34;]
}
ingress {
description = &amp;#34;https&amp;#34;
from_port = 443
to_port = 443
protocol = &amp;#34;tcp&amp;#34;
cidr_blocks = [&amp;#34;0.0.0.0/0&amp;#34;]
}
egress {
from_port = 0
to_port = 0
protocol = &amp;#34;ALL&amp;#34;
cidr_blocks = [&amp;#34;0.0.0.0/0&amp;#34;]
}
tags = {
Name = &amp;#34;my-security-group&amp;#34;
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws search for rds</title><link>http://uly.me/posts/aws-search-for-rds/</link><pubDate>Mon, 03 Jan 2022 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-search-for-rds/</guid><description>&lt;p&gt;Here’s a simple way to search for a RDS instance in AWS via CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws rds describe-db-instances \
--db-instance-identifier rds-instance-name \
--region us-east-1 \
--profile my-account
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You may have to cycle through accounts and regions to find it.&lt;/p&gt;</description></item><item><title>install latest sublime text</title><link>http://uly.me/posts/install-latest-sublime-text/</link><pubDate>Fri, 31 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-latest-sublime-text/</guid><description>&lt;p&gt;How to install the latest version of the Sublime Text editor on Ubuntu or Mint.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo &amp;#34;deb https://download.sublimetext.com/ apt/stable/&amp;#34; | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It will add the sublime-text.list file in /etc/apt/sources.list.d directory.&lt;/p&gt;</description></item><item><title>zip multiple files into one zip</title><link>http://uly.me/posts/zip-multiple-files-into-one-zip/</link><pubDate>Fri, 31 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/zip-multiple-files-into-one-zip/</guid><description>&lt;p&gt;How to zip multiple files into one zip file.&lt;/p&gt;
&lt;p&gt;Using zip.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;zip test.zip *.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Using tar.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar cvzf test.tar.gz *.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Untar in current directory or specify another directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar xvzf test.tar.gz .
tar xvzf test.tar.gz -C /path/to/dir
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cloudformation security group</title><link>http://uly.me/posts/aws-cloudformation-security-group/</link><pubDate>Wed, 29 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cloudformation-security-group/</guid><description>&lt;p&gt;AWS CloudFormation to create security groups. Includes self-refencing ingress and egress rules.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;AWSTemplateFormatVersion: &amp;#39;2010-09-09&amp;#39;
Description: my-security-groups
######################################
Parameters:
EC2Vpc:
ConstraintDescription: Must be a valid VpcId
Description: Select the VPC to use
Type: AWS::EC2::VPC::Id
##############################################################################
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: VPC
Parameters:
- EC2Vpc
##############################################################################
Resources:
EC2InstanceSecurityGroup1:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId:
Ref: EC2Vpc
GroupDescription: my-security-group-1
GroupName: my-security-group-1
SecurityGroupIngress:
- {CidrIp: 10.0.0.0/8, IpProtocol: tcp, FromPort: &amp;#39;80&amp;#39;, ToPort: &amp;#39;80&amp;#39;, Description: &amp;#39;HTTP&amp;#39;}
SecurityGroupEgress:
- {CidrIp: 10.0.0.0/8, IpProtocol: udp, FromPort: &amp;#39;123&amp;#39;, ToPort: &amp;#39;123&amp;#39;, Description: &amp;#39;NTP&amp;#39;}
- {CidrIp: 10.0.0.0/8, IpProtocol: tcp, FromPort: &amp;#39;53&amp;#39;, ToPort: &amp;#39;53&amp;#39;, Description: &amp;#39;DNS&amp;#39;}
Tags:
- {Key: Name, Value: &amp;#39;my-security-group-1&amp;#39;}
EC2InstanceSecurityGroup2:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId:
Ref: EC2Vpc
GroupDescription: my-security-group-2
GroupName: my-security-group-2
SecurityGroupIngress:
- {CidrIp: 0.0.0.0/0, IpProtocol: tcp, FromPort: &amp;#39;443&amp;#39;, ToPort: &amp;#39;443&amp;#39;, Description: &amp;#39;HTTP&amp;#39;}
- {CidrIp: 0.0.0.0/0, IpProtocol: icmp, FromPort: &amp;#39;-1&amp;#39;, ToPort: &amp;#39;-1&amp;#39;, Description: &amp;#39;ICMP ping&amp;#39;}
SecurityGroupEgress:
- {CidrIp: 10.0.0.0/8, IpProtocol: udp, FromPort: &amp;#39;123&amp;#39;, ToPort: &amp;#39;123&amp;#39;, Description: &amp;#39;NTP&amp;#39;}
- {CidrIp: 10.0.0.0/8, IpProtocol: tcp, FromPort: &amp;#39;53&amp;#39;, ToPort: &amp;#39;53&amp;#39;, Description: &amp;#39;DNS&amp;#39;}
- {CidrIp: 0.0.0.0/0, IpProtocol: icmp, FromPort: &amp;#39;-1&amp;#39;, ToPort: &amp;#39;-1&amp;#39;, Description: &amp;#39;ICMP ping&amp;#39;}
Tags:
- {Key: Name, Value: &amp;#39;my-security-group-2&amp;#39;}
MyIngressSelfAll:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: !Ref EC2InstanceSecurityGroup2
SourceSecurityGroupId: !GetAtt EC2InstanceSecurityGroup2.GroupId
IpProtocol: -1
FromPort: 0
ToPort: 65535
MyEgressSelfAll:
Type: AWS::EC2::SecurityGroupEgress
Properties:
GroupId: !Ref EC2InstanceSecurityGroup2
DestinationSecurityGroupId: !GetAtt EC2InstanceSecurityGroup2.GroupId
IpProtocol: -1
FromPort: 0
ToPort: 65535
##############################################################################
Outputs:
SecurityGroupId:
Description: The Security Group that was created
Value: {Ref: EC2InstanceSecurityGroup1}
Value: {Ref: EC2InstanceSecurityGroup2}
StackName:
Description: Name of this stack for Fn::ImportValue use by children of top level stack
Value: {Ref: &amp;#39;AWS::StackName&amp;#39;}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws copy security group</title><link>http://uly.me/posts/aws-copy-security-group/</link><pubDate>Tue, 28 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-copy-security-group/</guid><description>&lt;p&gt;You can copy rules from a security group to a new security group created within the same Region.&lt;/p&gt;
&lt;p&gt;Open the Amazon Elastic Compute Cloud (Amazon EC2) console.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In the navigation pane, choose Security Groups.&lt;/li&gt;
&lt;li&gt;Select the security group you’d like to copy.&lt;/li&gt;
&lt;li&gt;For Actions, choose Copy to new.&lt;/li&gt;
&lt;li&gt;The Create Security Group dialog opens, and is populated with the rules from your existing security group.&lt;/li&gt;
&lt;li&gt;Specify a Security group name and Description for your new security group.&lt;/li&gt;
&lt;li&gt;For VPC, choose the ID of the VPC.&lt;/li&gt;
&lt;li&gt;Choose Create.&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>aws move instance to another zone</title><link>http://uly.me/posts/aws-move-instance-to-another-zone/</link><pubDate>Thu, 23 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-move-instance-to-another-zone/</guid><description>&lt;p&gt;Here’s how to move an AWS instance to another zone.&lt;/p&gt;
&lt;p&gt;Stop the instance first.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 stop-instances --instance-ids i-1234567890abcdef0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create an AMI image.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 create-image \
--instance-id i-1234567890abcdef0 \
--name &amp;#34;my-ami&amp;#34; \
--description &amp;#34;my-ami&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create EC2 instance using Terraform. The contents of main.tf.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform {
required_providers {
aws = {
source = &amp;#34;hashicorp/aws&amp;#34;
}
}
}
provider &amp;#34;aws&amp;#34; {
profile = &amp;#34;default&amp;#34;
region = &amp;#34;us-east-1&amp;#34;
}
resource &amp;#34;aws_instance&amp;#34; &amp;#34;ulysses&amp;#34; {
ami = &amp;#34;ami-1234567890abcdef0&amp;#34;
key_name = &amp;#34;servers&amp;#34;
iam_instance_profile = &amp;#34;machine-role&amp;#34;
instance_type = &amp;#34;t3.micro&amp;#34;
subnet_id = &amp;#34;subnet-1234567890abcdef0&amp;#34;
security_groups = [&amp;#34;sg-1234567890abcdef0&amp;#34;, &amp;#34;sg-1234567890abcdef1&amp;#34;]
tags = {
Name = &amp;#34;moving-instance&amp;#34;
tag1 = &amp;#34;test1&amp;#34;
tag2 = &amp;#34;test2&amp;#34;
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Launch it.&lt;/p&gt;</description></item><item><title>bash script on startup</title><link>http://uly.me/posts/bash-script-on-startup/</link><pubDate>Thu, 23 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-script-on-startup/</guid><description>&lt;p&gt;How to add bash scripts on startup.&lt;/p&gt;
&lt;p&gt;update-rc.d&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo cp /path/to/yourscript.sh /etc/init.d/yourscript.sh
sudo update-rc.d /etc/init.d/yourscript.sh defaults
chmod +x /etc/init.d/yourscript.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Root Crontab&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo crontab -e
@reboot /path/to/yourscript.sh
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list disk types</title><link>http://uly.me/posts/gcp-list-disk-types/</link><pubDate>Wed, 22 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-disk-types/</guid><description>&lt;p&gt;To list all disk types available in your project in all regions. Result is truncated.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ gcloud compute disk-types list
NAME ZONE VALID_DISK_SIZES
pd-balanced 10GB-65536GB
pd-ssd 10GB-65536GB
pd-standard 200GB-65536GB
pd-balanced 10GB-65536GB
...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To list a specific region, use the filter option.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ gcloud compute disk-types list --filter=&amp;#34;zone~&amp;#39;us-central1&amp;#39;&amp;#34;
NAME ZONE VALID_DISK_SIZES
pd-balanced us-central1-a 10GB-65536GB
pd-extreme us-central1-a 500GB-65536GB
pd-ssd us-central1-a 10GB-65536GB
pd-standard us-central1-a 10GB-65536GB
pd-balanced us-central1-b 10GB-65536GB
pd-extreme us-central1-b 500GB-65536GB
pd-ssd us-central1-b 10GB-65536GB
pd-standard us-central1-b 10GB-65536GB
pd-balanced us-central1-c 10GB-65536GB
pd-extreme us-central1-c 500GB-65536GB
pd-ssd us-central1-c 10GB-65536GB
pd-standard us-central1-c 10GB-65536GB
pd-balanced us-central1-f 10GB-65536GB
pd-extreme us-central1-f 500GB-65536GB
pd-ssd us-central1-f 10GB-65536GB
pd-standard us-central1-f 10GB-65536GB
pd-balanced us-central1-d 10GB-65536GB
pd-extreme us-central1-d 500GB-65536GB
pd-ssd us-central1-d 10GB-65536GB
pd-standard us-central1-d 10GB-65536GB
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To a list a specific region and local SSDs only.&lt;/p&gt;</description></item><item><title>create aws vpc using terraform</title><link>http://uly.me/posts/create-aws-vpc-using-terraform/</link><pubDate>Tue, 21 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-aws-vpc-using-terraform/</guid><description>&lt;p&gt;Creating a VPC in AWS using Terraform. The script will do the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a VPC&lt;/li&gt;
&lt;li&gt;Create a Subnet&lt;/li&gt;
&lt;li&gt;Create an Internet Gateway&lt;/li&gt;
&lt;li&gt;Create a route in the default route table using the Internet Gateway&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Contents of main.tf&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform {
required_providers {
aws = {
source = &amp;#34;hashicorp/aws&amp;#34;
}
}
}
provider &amp;#34;aws&amp;#34; {
profile = &amp;#34;tfc&amp;#34;
region = &amp;#34;us-west-1&amp;#34;
}
resource &amp;#34;aws_vpc&amp;#34; &amp;#34;my-vpc&amp;#34; {
cidr_block = &amp;#34;10.0.4.0/24&amp;#34;
instance_tenancy = &amp;#34;default&amp;#34;
tags = {
Name = &amp;#34;my-vpc&amp;#34;
}
}
resource &amp;#34;aws_subnet&amp;#34; &amp;#34;my-subnet&amp;#34; {
vpc_id = aws_vpc.my-vpc.id
cidr_block = &amp;#34;10.0.4.0/24&amp;#34;
availability_zone = &amp;#34;us-west-1a&amp;#34;
tags = {
Name = &amp;#34;my-subnet-us-west-1a&amp;#34;
}
}
resource &amp;#34;aws_internet_gateway&amp;#34; &amp;#34;my-igw&amp;#34; {
vpc_id = aws_vpc.my-vpc.id
tags = {
Name = &amp;#34;my-internet-gateway&amp;#34;
}
}
resource &amp;#34;aws_default_route_table&amp;#34; &amp;#34;my-rt&amp;#34; {
default_route_table_id = aws_vpc.my-vpc.default_route_table_id
route {
cidr_block = &amp;#34;0.0.0.0/0&amp;#34;
gateway_id = aws_internet_gateway.my-igw.id
}
tags = {
Name = &amp;#34;my-route-table&amp;#34;
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcs fuse</title><link>http://uly.me/posts/gcs-fuse/</link><pubDate>Tue, 21 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcs-fuse/</guid><description>&lt;p&gt;GCS Fuse allows you to mount a Google bucket as a file system. It’s similar to &lt;a href="https://uly.me/s3fs/"&gt;S3FS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Setup repo&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo tee /etc/yum.repos.d/gcsfuse.repo &amp;gt; /dev/null
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Yum install&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo yum install gcsfuse
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For Ubuntu or Linux Mint, download the deb package.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;curl -L -O https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v0.39.2/gcsfuse_0.39.2_amd64.deb
sudo dpkg --install gcsfuse_0.39.2_amd64.deb
rm gcsfuse_0.39.2_amd64.deb
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check if installed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcsfuse -v
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Login.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth login
gcloud auth application-default login
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Setup mount.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir -p /path/to/mount
chown username:username /path/to/mount
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcsfuse my-bucket /path/to/mount
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Alternative using service account key.&lt;/p&gt;</description></item><item><title>enable core dumps</title><link>http://uly.me/posts/enable-core-dumps/</link><pubDate>Mon, 13 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/enable-core-dumps/</guid><description>&lt;p&gt;Core dumps are triggered by kernel when a program crashses. It saves memory to a file.&lt;/p&gt;
&lt;p&gt;How to enable core dumps.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ulimit -S -c unlimited
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Enable core dumps permanently. Edit /etc/security/limits.conf. Add the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;* soft core unlimited
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disable core dumps.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ulimit -S -c 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disable core dumps permanently. Edit /etc/security/limits.conf. Add the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;* soft core 0
* hard core 0
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>uninstall ibm tivoli system automation</title><link>http://uly.me/posts/uninstall-ibm-tivoli-system-automation/</link><pubDate>Mon, 13 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/uninstall-ibm-tivoli-system-automation/</guid><description>&lt;p&gt;How to uninstall IBM Tivoli System Automation from Linux.&lt;/p&gt;
&lt;p&gt;Check if domain is online.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsrpdomain
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Stop the domain.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;stoprpdomain &amp;lt;domain&amp;gt;
&amp;lt;/domain&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Uninstall.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /opt/IBM/tsamp/sam/uninst/
./uninstallSAM
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check the logs.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/tmp/uninstallSAM..log
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>rebuild docker containers</title><link>http://uly.me/posts/rebuild-docker-containers/</link><pubDate>Sun, 12 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rebuild-docker-containers/</guid><description>&lt;p&gt;How to rebuild your application from scratch using Docker.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
docker-compose down -v
docker rmi $(docker images -a -q)
docker-compose up -d
docker-compose restart -t 10
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Steps&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Purge the containers.&lt;/li&gt;
&lt;li&gt;Delete docker images.&lt;/li&gt;
&lt;li&gt;Reinitiate docker.&lt;/li&gt;
&lt;li&gt;Restart docker.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>run mysql in a docker container</title><link>http://uly.me/posts/run-mysql-in-a-docker-container/</link><pubDate>Sun, 12 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-mysql-in-a-docker-container/</guid><description>&lt;p&gt;How to run MySQL commands in a Docker container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
set -a; source /dev/null
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;The first command loads the content of .env to environment variables.&lt;/li&gt;
&lt;li&gt;The MySQL password can then be used using the ${MYSQL_PASSWORD} variable.&lt;/li&gt;
&lt;li&gt;I’m using sed to get around the special characters in the password.&lt;/li&gt;
&lt;li&gt;The second command runs docker exec on wp_db container.&lt;/li&gt;
&lt;li&gt;The last 3 commands are the actual sql commands.&lt;/li&gt;
&lt;li&gt;We are selecting to use the db1 database.&lt;/li&gt;
&lt;li&gt;Then we run select statements from the wp_options table.&lt;/li&gt;
&lt;li&gt;Finally, 2&amp;gt;/dev/null suppresses errors and warning to null.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>install docker on amazon linux 2</title><link>http://uly.me/posts/install-docker-on-amazon-linux-2/</link><pubDate>Sat, 11 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-docker-on-amazon-linux-2/</guid><description>&lt;p&gt;Steps how to install Docker and Docker Compose on Amazon Linux 2.&lt;/p&gt;
&lt;p&gt;Install Docker&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo amazon-linux-extras install docker
$ sudo service docker start
$ sudo usermod -a -G docker ec2-user
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start at boot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo chkconfig docker on
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install git (optional).&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo yum install -y git
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install Docker Compose&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) \
-o /usr/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker --version
docker-compose --version
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>stop and remove all docker containers</title><link>http://uly.me/posts/stop-and-remove-all-docker-containers/</link><pubDate>Sat, 11 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/stop-and-remove-all-docker-containers/</guid><description>&lt;p&gt;How to stop and remove all Docker containers.&lt;/p&gt;
&lt;p&gt;Stop all containers&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ docker kill $(docker ps -q)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove all containers&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ docker rm $(docker ps -a -q)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete all docker images&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ docker rmi $(docker images -q)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>docker container logs</title><link>http://uly.me/posts/docker-container-logs/</link><pubDate>Fri, 10 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/docker-container-logs/</guid><description>&lt;p&gt;How to check Docker container logs. Look for the container ID.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ docker ps -a
3e2c1193915f
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To view the logs for the container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker logs 3e2c1193915f
# or
docker container logs 3e2c1193915f
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp activate service account</title><link>http://uly.me/posts/gcp-activate-service-account/</link><pubDate>Fri, 10 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-activate-service-account/</guid><description>&lt;p&gt;How to activate a GCP service account for other users in Linux.&lt;/p&gt;
&lt;p&gt;First generate a key for the service account. Save as key.json.&lt;/p&gt;
&lt;p&gt;Login to the server as that user and copy the key there. Activate the service account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ gcloud auth activate-service-account [ACCOUNT] --key-file=key.json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once authenticated, you should be able to check if service account is active.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ gcloud config list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A better option without needing a key.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud config set core/account service-account@project-id.iam.gserviceaccount.com
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>github generate a key</title><link>http://uly.me/posts/github-generate-a-key/</link><pubDate>Fri, 10 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/github-generate-a-key/</guid><description>&lt;p&gt;Generate a ssh key for Github&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ssh-keygen -t ed25519 -C &amp;#34;your_email@example.com&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Copy and paste the ‘id_ed25519.pub’ key to Github.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd .ssh
$ ls -l
-rw-r--r-- 1 ulysses ulysses 537 Jul 14 12:54 id_ed25519
-rw-r--r-- 1 ulysses ulysses 194 Jul 14 12:54 id_ed25519.pub
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Go to Settings &amp;gt; SSH and GPG keys. Add new SSH key and authorize.&lt;/p&gt;
&lt;p&gt;You can then clone using the SSH format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ git init
$ git clone git@github.com:acoount/repo.git
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>docker ps</title><link>http://uly.me/posts/docker-ps/</link><pubDate>Thu, 09 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/docker-ps/</guid><description>&lt;p&gt;Check Docker running processes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ docker ps -a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To see it in real time.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ watch docker ps
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp spot vm</title><link>http://uly.me/posts/gcp-spot-vm/</link><pubDate>Wed, 08 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-spot-vm/</guid><description>&lt;p&gt;Spot VMs are preemtible, they can be reclaimed by the Cloud provider.&lt;/p&gt;
&lt;p&gt;However you can get deep discounts using them.&lt;/p&gt;
&lt;p&gt;Launch a spot instance in GCP using Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;provider &amp;#34;google&amp;#34; {
project = &amp;#34;airy-totality-151318&amp;#34;
zone = &amp;#34;us-central1-c&amp;#34;
}
resource &amp;#34;google_compute_instance&amp;#34; &amp;#34;test&amp;#34; {
name = &amp;#34;test&amp;#34;
machine_type = &amp;#34;e2-micro&amp;#34;
boot_disk {
initialize_params {
image = &amp;#34;debian-cloud/debian-9&amp;#34;
}
}
scheduling {
preemptible = true
automatic_restart = false
}
network_interface {
network = &amp;#34;default&amp;#34;
access_config {
}
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp fix hosts</title><link>http://uly.me/posts/gcp-fix-hosts/</link><pubDate>Tue, 07 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-fix-hosts/</guid><description>&lt;p&gt;This is a script that fixes /etc/hosts in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# VARIABLES
FILE=&amp;#39;/etc/hosts&amp;#39;
#BACKUP /etc/hosts before changes
cp -ipHR $FILE $FILE_$(date +%Y-%m-%d_%H-%M-%S)
# GET IP ADDRESS
IP=$(/sbin/ifconfig | grep &amp;#39;inet&amp;#39; | grep -v &amp;#39;inet6&amp;#39; | grep -v &amp;#39;127.0&amp;#39; | cut -d: -f2 | awk &amp;#39;{print $2}&amp;#39; | head -1)
# GET HOSTNAME
HN=$(/bin/hostname)
# GET PROJECT ID
echo &amp;#34;169.254.169.254 metadata.google.internal # Added by Google&amp;#34; &amp;gt;&amp;gt; $FILE
PR=$(curl -f -s http://metadata.google.internal/computeMetadata/v1/project/project-id -H &amp;#34;Metadata-Flavor: Google&amp;#34;)
# ADD HOSTNAME ENTRY TO /etc/hosts
STRING=&amp;#34;$IP $HN.mydomain.com&amp;#34;
if grep -q &amp;#34;$STRING&amp;#34; &amp;#34;$FILE&amp;#34;
then
echo &amp;#34;Valid host entry.&amp;#34;
else
echo &amp;#34;Adding host entry.&amp;#34;
echo $STRING $HN &amp;gt;&amp;gt; $FILE
fi
# DELETE GOOGLE ENTRIES.
sed -i &amp;#39;/# Added by Google/d&amp;#39; $FILE
# ADD BACK GOOGLE ENTRIES.
echo $IP $HN&amp;#34;.c.&amp;#34;$PR&amp;#34;.internal&amp;#34; $HN&amp;#34; # Added by Google&amp;#34; &amp;gt;&amp;gt; $FILE
echo &amp;#34;169.254.169.254 metadata.google.internal # Added by Google&amp;#34; &amp;gt;&amp;gt; $FILE
# SET PERMISSIONS.
chmod 644 $FILE
# DISPLAY /etc/hosts
cat $FILE
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;</description></item><item><title>fibonacci sequence in python</title><link>http://uly.me/posts/fibonacci-sequence-in-python/</link><pubDate>Fri, 03 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fibonacci-sequence-in-python/</guid><description>&lt;p&gt;How to calculate Fibonacci sequence in Python.&lt;/p&gt;
&lt;p&gt;Create a file called fib.py.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;nterms = int(input(&amp;#34;How many terms? &amp;#34;))
n1, n2 = 0, 1
count = 0
if nterms
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ python fib.py
How many terms? 5
Fibonacci sequence:
0
1
1
2
3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Again.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ python fib.py
How many terms? 10
Fibonacci sequence:
0
1
1
2
3
5
8
13
21
34
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws display lightsail snapshots</title><link>http://uly.me/posts/aws-display-lightsail-snapshots/</link><pubDate>Wed, 01 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-display-lightsail-snapshots/</guid><description>&lt;p&gt;How to display Lightsail snapshots.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
displaysnapshots () {
echo &amp;#39;--------------------------------------------------------&amp;#39;
aws lightsail get-instance-snapshots --query &amp;#39;instanceSnapshots[].[name]&amp;#39; --output text | sort
echo &amp;#39;--------------------------------------------------------&amp;#39;
}
displaysnapshots
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;daily_ulyme_1637812801
daily_ulyme_1637899201
daily_ulyme_1637985601
daily_ulyme_1638072001
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Adding timestamp to the output.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail get-instance-snapshots --query &amp;#39;instanceSnapshots[].[name,createdAt]&amp;#39; --output text | sort
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;daily_ulyme_1637812801 1637812806.853
daily_ulyme_1637899201 1637899208.285
daily_ulyme_1637985601 1637985606.184
daily_ulyme_1638072001 1638072006.579
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Convert Unix timestamp to iso8601. Edit your ~/.aws/config file. Add this line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cli_timestamp_format = iso8601
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;daily_ulyme_1637812801 2021-11-25T04:00:06.853000+00:00
daily_ulyme_1637899201 2021-11-26T04:00:08.285000+00:00
daily_ulyme_1637985601 2021-11-27T04:00:06.184000+00:00
daily_ulyme_1638072001 2021-11-28T04:00:06.579000+00:00
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash input executes functions</title><link>http://uly.me/posts/bash-input-executes-functions/</link><pubDate>Wed, 01 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-input-executes-functions/</guid><description>&lt;p&gt;How to execute functions in Bash based on argument.&lt;/p&gt;
&lt;p&gt;There are 2 functions: build and terminate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
build () {
echo &amp;#39;Building services&amp;#39;
}
terminate () {
echo &amp;#39;Terminating services&amp;#39;
}
if [ $1 == &amp;#39;build&amp;#39; ]; then build
elif [ $1 == &amp;#39;terminate&amp;#39; ]; then terminate
else echo &amp;#39;Valid options are &amp;#34;build&amp;#34; or &amp;#34;terminate&amp;#34;&amp;#39;
fi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Execute a function based on argument.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ bash test.sh build
Building services
$ bash test.sh terminate
Terminating services
$ bash test.sh anyother
Valid options are &amp;#34;build&amp;#34; or &amp;#34;terminate&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash read file</title><link>http://uly.me/posts/bash-read-file/</link><pubDate>Wed, 01 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-read-file/</guid><description>&lt;p&gt;How to read a file line by line in Bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
file=test.txt
while IFS= read -r line; do
echo $line
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Contents of test.txt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;one
two
three
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Results when running test.sh.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ bash test.sh
one
two
three
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To read multiple strings line by line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
file=test.txt
while read -r a b; do
echo $b
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Modified contents of test.txt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;one 1
two 2
three 3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;New results.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ bash test.sh
1
2
3
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>delete lines using sed</title><link>http://uly.me/posts/delete-lines-using-sed/</link><pubDate>Wed, 01 Dec 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/delete-lines-using-sed/</guid><description>&lt;p&gt;How to delete a line containing a pattern using sed.&lt;/p&gt;
&lt;p&gt;Contents of test.txt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat test.txt
one
two
three
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete a line matching the string “one.”&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sed -i &amp;#39;/one/d&amp;#39; test.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display test.txt&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat test.txt
two
three
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>remove oracle java</title><link>http://uly.me/posts/remove-oracle-java/</link><pubDate>Tue, 30 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-oracle-java/</guid><description>&lt;p&gt;Here’s a script that removes Oracle Java on your system. Installs OpenJDK Hotspot as a replacement.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# set env
oracle_jre_version=&amp;#34;jdk1.8.0_172&amp;#34;
open_jre_version=&amp;#34;java-1.8.0-openjdk&amp;#34;
# REMOVE LINKS
deljdk () {
sudo update-alternatives --remove &amp;#34;java&amp;#34; &amp;#34;/usr/lib/jvm/$oracle_jre_version/bin/java&amp;#34;
sudo update-alternatives --remove &amp;#34;javac&amp;#34; &amp;#34;/usr/lib/jvm/$oracle_jre_version/bin/javac&amp;#34;
sudo update-alternatives --remove &amp;#34;javaws&amp;#34; &amp;#34;/usr/lib/jvm/$oracle_jre_version/bin/javaws&amp;#34;
}
# REMOVE RPM
delrpm () {
jdk=$(rpm -qa | grep jdk-1.7)
rpm -e $jdk
jdk=$(rpm -qa | grep jdk1.8)
rpm -e $jdk
sudo rm -rf /usr/java/jdk*
}
# REMOVE SYMBOLIC LINKS
delsym () {
rm /usr/java/default /usr/java/latest
rm /usr/lib/mozilla/plugins/libnpjp2.so
rm /usr/lib/mozilla/plugins/libnpjp2.so
}
# INSTALL OPENJDK
addjdk () {
cd /usr/java
rm -f /usr/java/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz
wget --no-check-certificate https://10.49.39.125/download/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz
tar xzf OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz
chown -R username:username /usr/java/jdk8u302-b08
}
# ADD PATH
addpath () {
sed -i &amp;#39;/jdk8u302-b08/d&amp;#39; /home/username/.zshrc
sed -i &amp;#39;/jdk8u302-b08/d&amp;#39; /home/username/.profile
echo &amp;#39;export PATH=/usr/java/jdk8u302-b08/bin:$PATH&amp;#39; | tee -a ~/.bashrc
echo &amp;#39;export PATH=/usr/java/jdk8u302-b08/bin:$PATH&amp;#39; | tee -a /home/username/.zshrc
echo &amp;#39;export PATH=/usr/java/jdk8u302-b08/bin:$PATH&amp;#39; | tee -a /home/username/.profile
chown username:username /home/username/.zshrc
chown username:username /home/username/.profile
}
deljdk
delrpm
delsym
addjdk
addpath
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git clone multiple accounts</title><link>http://uly.me/posts/git-clone-multiple-accounts/</link><pubDate>Sun, 28 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-clone-multiple-accounts/</guid><description>&lt;p&gt;How to clone repositories with multiple Github accounts.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git clone git@github.com-yourgitaccount:yourgitaccount/myrepo.git
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp spot instance</title><link>http://uly.me/posts/gcp-spot-instance/</link><pubDate>Thu, 25 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-spot-instance/</guid><description>&lt;p&gt;You can save anywhere from 60-91% using a spot instance. The downside is, the instance can be preempted anytime.&lt;/p&gt;
&lt;p&gt;Create a spot instance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud beta compute instances create spot-example \
--provisioning-model=SPOT \
--instance-termination-action=STOP \
--image-project=ubuntu-os-cloud \
--image-family=ubuntu-2004-lts \
--machine-type=e2-micro \
--project=your-project-id \
--zone=us-central1-a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete instance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances delete spot-example \
--project=your-project-id \
--zone=us-central1-a
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>terraform aws s3</title><link>http://uly.me/posts/terraform-aws-s3/</link><pubDate>Mon, 15 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-aws-s3/</guid><description>&lt;p&gt;How to create S3 bucket via Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform {
required_providers {
aws = {
source = &amp;#34;hashicorp/aws&amp;#34;
}
}
}
provider &amp;#34;aws&amp;#34; {
profile = &amp;#34;default&amp;#34;
region = &amp;#34;us-east-1&amp;#34;
}
resource &amp;#34;aws_s3_bucket&amp;#34; &amp;#34;bucket&amp;#34; {
bucket = &amp;#34;my-ulysses-bucket&amp;#34;
acl = &amp;#34;private&amp;#34;
tags = {
Name = &amp;#34;My Ulysses bucket&amp;#34;
Environment = &amp;#34;Dev&amp;#34;
}
}
resource &amp;#34;aws_s3_bucket_public_access_block&amp;#34; &amp;#34;example&amp;#34; {
bucket = aws_s3_bucket.bucket.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>terraform aws security group</title><link>http://uly.me/posts/terraform-aws-security-group/</link><pubDate>Mon, 15 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-aws-security-group/</guid><description>&lt;p&gt;How to create a security group in AWS via Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform {
required_providers {
aws = {
source = &amp;#34;hashicorp/aws&amp;#34;
}
}
}
provider &amp;#34;aws&amp;#34; {
profile = &amp;#34;default&amp;#34;
region = &amp;#34;us-east-1&amp;#34;
}
resource &amp;#34;aws_security_group&amp;#34; &amp;#34;my_sg&amp;#34; {
vpc_id = &amp;#34;vpc-xxxxxxxxxxxxxxxxx&amp;#34;
name = &amp;#34;My Security Group&amp;#34;
description = &amp;#34;My Security Group&amp;#34;
ingress {
from_port = 8088
to_port = 8088
protocol = &amp;#34;tcp&amp;#34;
cidr_blocks = [&amp;#34;0.0.0.0/0&amp;#34;]
}
egress {
from_port = 0
to_port = 0
protocol = &amp;#34;-1&amp;#34;
cidr_blocks = [&amp;#34;0.0.0.0/0&amp;#34;]
}
tags = {
Name = &amp;#34;My Security Group&amp;#34;
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wiki ssl certificate location</title><link>http://uly.me/posts/wiki-ssl-certificate-location/</link><pubDate>Fri, 12 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wiki-ssl-certificate-location/</guid><description>&lt;p&gt;Here’s where the Wiki keeps its SSL certificate keys.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/etc/pki/tls/certs/yourdomain.crt
/etc/pki/tls/private/yourdomain.key
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In some cases, SSL needs to be converted so it doesn’t prompt you for a password if you restart Apache.&lt;/p&gt;
&lt;p&gt;Conversion&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;openssl rsa -in /etc/pki/tls/private/yourdomain.key.new -out /etc/pki/tls/private/yourdomain.key.new_no_pass
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>github ssh keys setup</title><link>http://uly.me/posts/github-ssh-keys-setup/</link><pubDate>Thu, 11 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/github-ssh-keys-setup/</guid><description>&lt;p&gt;Here’s how to setup your SSH keys to work with Github.&lt;/p&gt;
&lt;p&gt;Generate a key using ed25519 public-key signature system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ssh-keygen -t ed25519
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It creates a id_ed25519.pub file.&lt;/p&gt;
&lt;p&gt;Go to Github.com and open up Settings &amp;gt; SSH &amp;amp; GPG keys.&lt;/p&gt;
&lt;p&gt;Click New SSH key. Give a title and paste your pub key. Authorize.&lt;/p&gt;</description></item><item><title>gcp list firewall rule by name</title><link>http://uly.me/posts/gcp-list-firewall-rule-by-name/</link><pubDate>Wed, 10 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-firewall-rule-by-name/</guid><description>&lt;p&gt;Here’s how to list a GCP firewall rule by name.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules list \
--filter=&amp;#34;name=(&amp;#39;wowza-rtmp&amp;#39;)&amp;#34; \
--format=json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can use different formats. Supported formats are:&lt;/p&gt;
&lt;p&gt;config, csv, default, diff, disable, flattened, get, json, list, multi, none, object, table, text, value, yaml&lt;/p&gt;</description></item><item><title>aws services that use security groups</title><link>http://uly.me/posts/aws-services-that-use-security-groups/</link><pubDate>Tue, 09 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-services-that-use-security-groups/</guid><description>&lt;p&gt;Services that user Security Groups&lt;/p&gt;
&lt;p&gt;EC2-Classic instance&lt;br&gt;
Amazon EC2 instances&lt;br&gt;
ElasticCache&lt;br&gt;
AWS Elastic Beanstalk&lt;br&gt;
Amazon Elastic MapReduce&lt;br&gt;
Amazon RDS (Relational Database Service)&lt;br&gt;
Amazon Redshift&lt;br&gt;
Amazon ElastiCache&lt;br&gt;
Amazon CloudSearch&lt;br&gt;
Elastic Load Balancing&lt;br&gt;
Lambda&lt;br&gt;
Fargate&lt;br&gt;
EFS&lt;/p&gt;</description></item><item><title>rpm updates the last month</title><link>http://uly.me/posts/rpm-updates-the-last-month/</link><pubDate>Tue, 09 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rpm-updates-the-last-month/</guid><description>&lt;p&gt;Here’s the software packages updated the last month.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -qa --last | grep -w &amp;#34;$(date --date=&amp;#39;1 month ago&amp;#39; +&amp;#39;%b %Y&amp;#39;)&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;python-perf-3.10.0-1160.42.2.el7.x86_64 Mon 04 Oct 2021 02:16:16 AM UTC
openldap-2.4.44-24.el7_9.x86_64 Mon 04 Oct 2021 02:16:12 AM UTC
kpartx-0.4.9-135.el7_9.x86_64 Mon 04 Oct 2021 02:16:09 AM UTC
kernel-tools-libs-3.10.0-1160.42.2.el7.x86_64 Mon 04 Oct 2021 02:16:05 AM UTC
kernel-tools-3.10.0-1160.42.2.el7.x86_64 Mon 04 Oct 2021 02:16:05 AM UTC
kernel-3.10.0-1160.42.2.el7.x86_64 Mon 04 Oct 2021 02:14:41 AM UTC
virt-what-1.18-4.el7_9.1.x86_64 Mon 04 Oct 2021 01:03:22 AM UTC
bind-export-libs-9.11.4-26.P2.el7_9.7.x86_64 Mon 04 Oct 2021 01:03:22 AM UTC
# ... truncated output
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws set profile</title><link>http://uly.me/posts/aws-set-profile/</link><pubDate>Sun, 07 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-set-profile/</guid><description>&lt;p&gt;If you find yourself using a named profile for every awscli command, you can set it temporarily.&lt;/p&gt;
&lt;p&gt;Listing a bucket with a named profile.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3 ls --profile=yourprofile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you set AWS_PROFILE, you can then list a bucket without a named profile.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;export AWS_PROFILE=yourprofile
aws s3 ls
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After you are done, you can reset it back to default.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;export AWS_PROFILE=default
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>create local yum repo</title><link>http://uly.me/posts/create-local-yum-repo/</link><pubDate>Sun, 07 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-local-yum-repo/</guid><description>&lt;p&gt;Here’s how to create a local yum repo.&lt;/p&gt;
&lt;p&gt;Install Apache.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo yum install httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install the repo packages.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo yum install createrepo yum-utils
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create repo directories.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo mkdir /var/www/html/{baseos,extras,appstream,epel}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Sync the repos.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo yum reposync -p=/var/www/html --repoid=baseos --download-metadata
sudo yum reposync -p=/var/www/html --repoid=extras --download-metadata
sudo yum reposync -p=/var/www/html --repoid=appstream --download-metadata
sudo yum reposync -p=/var/www/html --repoid=epel --download-metadata
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a new repo.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo createrepo /var/www/html/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Setup a local repo.&lt;/p&gt;</description></item><item><title>remove an environment variable</title><link>http://uly.me/posts/remove-an-environment-variable/</link><pubDate>Sun, 07 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-an-environment-variable/</guid><description>&lt;p&gt;How to remove an environment variable in Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;unset AWS_PROFILE
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can run env to validate if variable is still present.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;env
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>rocky linux in a container</title><link>http://uly.me/posts/rocky-linux-in-a-container/</link><pubDate>Sun, 07 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rocky-linux-in-a-container/</guid><description>&lt;p&gt;Here’s how to run Rocky Linux in a Docker container.&lt;/p&gt;
&lt;p&gt;Download the image.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker pull rockylinux/rockylinux
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a Rocky Linux container called bullwinkle.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker run -it --name bullwinkle -d rockylinux/rockylinux
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Login to the container using bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker exec -it --user root bullwinkle /bin/bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When done, stop and delete the container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker ps -a
docker stop container_ID
docker rm container_ID
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>add path to zsh</title><link>http://uly.me/posts/add-path-to-zsh/</link><pubDate>Sat, 06 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-path-to-zsh/</guid><description>&lt;p&gt;Here’s how to add a path to zsh permanently.&lt;/p&gt;
&lt;p&gt;Edit .zshrc file and add the path. Create .zshrc file if it’s missing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;export PATH=$PATH:/new/path
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Exit and relaunch shell. The new path should be in effect.&lt;/p&gt;
&lt;p&gt;Echo to display new path.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo $PATH
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>delete lines using awk</title><link>http://uly.me/posts/delete-lines-using-awk/</link><pubDate>Fri, 05 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/delete-lines-using-awk/</guid><description>&lt;p&gt;Here’s how to delete a line from a file using awk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;awk &amp;#39;!/Redhat/&amp;#39; sample.txt &amp;gt; sample.tmp &amp;amp;&amp;amp; mv sample.tmp sample.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The command above looks for ‘Redhat’ in a file and removes that line from the file.&lt;/p&gt;
&lt;p&gt;You can add the line in the crontab to run at reboot if you like.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;crontab -e
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;@reboot awk &amp;#39;!/Redhat/&amp;#39; sample.txt &amp;gt; sample.tmp &amp;amp;&amp;amp; mv sample.tmp sample.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>useradd with specific uid and guid</title><link>http://uly.me/posts/useradd-with-specific-uid-and-guid/</link><pubDate>Fri, 05 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/useradd-with-specific-uid-and-guid/</guid><description>&lt;p&gt;Here’s the command to create a Linux user with a specific user id and group id.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo groupadd -r -g 1234567 username
sudo useradd -r -u 1234567 -g 1234567 -m -d /home/username -s /bin/bash nexus -c &amp;#34;my new account&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>database clients on linux</title><link>http://uly.me/posts/database-clients-on-linux/</link><pubDate>Thu, 04 Nov 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/database-clients-on-linux/</guid><description>&lt;p&gt;You can run database clients on your Linux distro by installing them.&lt;/p&gt;
&lt;p&gt;MySQL&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ yum install mysql
$ apt install mysql
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Postgress&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ yum install postgresql postgresql-client
$ apt install postgresql postgresql-client
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;MSSQL&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ yum install mysql-tools
$ apt install mssql-tools
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>install adoptopenjdk</title><link>http://uly.me/posts/install-adoptopenjdk/</link><pubDate>Thu, 28 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-adoptopenjdk/</guid><description>&lt;p&gt;OpenJDK is an open-source implementation of the Java.&lt;/p&gt;
&lt;p&gt;How to install AdoptOpenJDK.&lt;/p&gt;
&lt;p&gt;TAR&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /usr/java
wget --no-check-certificate https://bit.ly/3jKm3KZ
tar xzf OpenJDK8U-jdk_x64_linux_hotspot_8u312b07.tar.gz
export PATH=$PWD/jdk8u312-b07/bin:$PATH
java -version
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;RPM&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cat /etc/yum.repos.d/adoptopenjdk.repo
[AdoptOpenJDK]
name=AdoptOpenJDK
baseurl=http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
EOF
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;yum install adoptopenjdk-8-openj9
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>terraform user data</title><link>http://uly.me/posts/terraform-user-data/</link><pubDate>Tue, 26 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-user-data/</guid><description>&lt;p&gt;Here’s how to add userdata in Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;user_data = filebase64(&amp;#34;${path.module}/example.sh&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cloudwatch alarms</title><link>http://uly.me/posts/aws-cloudwatch-alarms/</link><pubDate>Mon, 25 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cloudwatch-alarms/</guid><description>&lt;p&gt;How to enable and disable CloudWatch alarms&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ aws cloudwatch disable-alarm-actions --alarm-names myalarm --region us-east-1
$ aws cloudwatch enable-alarm-actions --alarm-names myalarm --region us-east-1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws suspend auto scaling group</title><link>http://uly.me/posts/aws-suspend-auto-scaling-group/</link><pubDate>Wed, 20 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-suspend-auto-scaling-group/</guid><description>&lt;p&gt;You can administratively suspend a process in AWS Auto Scaling group for troubleshooting purposes.&lt;/p&gt;
&lt;p&gt;Here are the available processes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Terminate
Launch
AddToLoadBalancer
AlarmNotification
AZRebalance
HealthCheck
ReplaceUnhealthy
ScheduledActions
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you have difficulty launching a VM, check if any of these processes are suspended.&lt;/p&gt;
&lt;p&gt;Removed them if applicable.&lt;/p&gt;</description></item><item><title>check certificate expiration</title><link>http://uly.me/posts/check-certificate-expiration/</link><pubDate>Wed, 20 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-certificate-expiration/</guid><description>&lt;p&gt;Here’s the openssl command to find out if a cert is expired.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ openssl s_client -connect yourdomain.com:443 -servername yourdomain.com 2&amp;gt; /dev/null | openssl x509 -noout -dates
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;notBefore=Apr 9 00:00:00 2020 GMT
notAfter=Apr 9 23:59:59 2022 GMT
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>run telnet on git bash</title><link>http://uly.me/posts/run-telnet-on-git-bash/</link><pubDate>Wed, 20 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-telnet-on-git-bash/</guid><description>&lt;p&gt;Although telnet is not used regularly since insecure, it’s a handy tool for testing ports.&lt;/p&gt;
&lt;p&gt;For example, to check if a port 80 is open, you run this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ telnet servername 80
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Git Bash does not come with telnet, but you can use the Windows version by using winpty.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ winpty telnet servername 457
Connecting To servername...Could not open connection to the host, on port 457: Connect failed
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If port is open, you get an empty reply, just like in Windows.&lt;/p&gt;</description></item><item><title>copy s3 to gcs</title><link>http://uly.me/posts/copy-s3-to-gcs/</link><pubDate>Wed, 13 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/copy-s3-to-gcs/</guid><description>&lt;p&gt;You can use gsutil to copy directly from a S3 bucket to a GCS bucket.&lt;/p&gt;
&lt;p&gt;gsutil can read/write to a S3 bucket as long as it has access to your AWS credentials.&lt;/p&gt;
&lt;p&gt;The -R option is recursive and -m is for multi-threaded or multi-processing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gsutil -m cp -R s3://bucket/ gs://bucket
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also use rsync instead of cp. Just be aware that rsync does not copy empty directory trees&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gsutil -m rsync -r s3://bucket/ gs://bucket
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you plan to use -d, Use it with caution since it deletes content.&lt;/p&gt;</description></item><item><title>git undo add</title><link>http://uly.me/posts/git-undo-add/</link><pubDate>Wed, 13 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-undo-add/</guid><description>&lt;p&gt;To undo a git add, run git reset file or get reset.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git reset filename
git reset
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run git status to check.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli search iam userid</title><link>http://uly.me/posts/aws-cli-search-iam-userid/</link><pubDate>Mon, 11 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-search-iam-userid/</guid><description>&lt;p&gt;Here’s how to search for an IAM user in AWS by filtering their access key.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam list-users --query &amp;#39;Users[?UserId==`AIDAxxxxxxxxxxxxxxxxx`]&amp;#39; \
--profile your-profile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The results only returns one user with that UserID.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[
{
&amp;#34;Path&amp;#34;: &amp;#34;/&amp;#34;,
&amp;#34;UserName&amp;#34;: &amp;#34;your-username&amp;#34;,
&amp;#34;UserId&amp;#34;: &amp;#34;AIDAxxxxxxxxxxxxxxxxx&amp;#34;,
&amp;#34;Arn&amp;#34;: &amp;#34;arn:aws:iam::xxxxxxxxxxxx:user/sa-lucidchart&amp;#34;,
&amp;#34;CreateDate&amp;#34;: &amp;#34;2019-04-15T15:53:18+00:00&amp;#34;
}
]
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp display roles on service account</title><link>http://uly.me/posts/gcp-display-roles-on-service-account/</link><pubDate>Wed, 06 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-display-roles-on-service-account/</guid><description>&lt;p&gt;How to display roles assigned to a GCP service account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud projects get-iam-policy your-project-id \
--flatten=&amp;#34;bindings[].members&amp;#34; \
--format=&amp;#39;table(bindings.role)&amp;#39; \
--filter=&amp;#34;bindings.members:your-service-account@your-project.iam.gserviceaccount.com&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ROLE
organizations/xxxxxxxxxxxxx/roles/role-name
roles/compute.instanceAdmin.v1
roles/compute.networkViewer
roles/logging.logWriter
roles/monitoring.metricWriter
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list service accounts in project</title><link>http://uly.me/posts/gcp-list-service-accounts-in-project/</link><pubDate>Wed, 06 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-service-accounts-in-project/</guid><description>&lt;p&gt;How to display a list service accounts in a GCP project.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud iam service-accounts list --project your-project
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>where in windows</title><link>http://uly.me/posts/where-in-windows/</link><pubDate>Wed, 06 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/where-in-windows/</guid><description>&lt;p&gt;How to find where the executable is located in Windows? Use the where command in CMD.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;where gcloud
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It will list multiple locations if you have several versions installed on your system.&lt;/p&gt;</description></item><item><title>where is php.ini?</title><link>http://uly.me/posts/wheres-php-ini/</link><pubDate>Tue, 05 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wheres-php-ini/</guid><description>&lt;p&gt;How to find where php.ini is being from the command line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ php -i | grep &amp;#39;grep &amp;#39;Configuration File&amp;#39;
Configuration File (php.ini) Path =&amp;gt; /etc
Loaded Configuration File =&amp;gt; /etc/php.ini
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>apt locked files</title><link>http://uly.me/posts/apt-locked-files/</link><pubDate>Sat, 02 Oct 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/apt-locked-files/</guid><description>&lt;p&gt;If you tried to run apt update and you get this error, try the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ apt update
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) [duplicate]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Kill the process.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo killall apt apt-get
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If that doesn’t work, remove the locked files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo rm /var/lib/apt/lists/lock
$ sudo rm /var/cache/apt/archives/lock
$ sudo rm /var/lib/dpkg/lock*
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run apt update again.&lt;/p&gt;</description></item><item><title>aws request domain renewal</title><link>http://uly.me/posts/aws-request-domain-renewal/</link><pubDate>Fri, 17 Sep 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-request-domain-renewal/</guid><description>&lt;p&gt;Occassionally, AWS requires validation of your domain via email message. Here’s the command to send a request.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm resend-validation-email \
--certificate-arn arn:aws:acm:us-east-1:xxxxxxxxxxxx:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
--domain yourdomain.com \
--validation-domain yourdomain.com
aws acm resend-validation-email \
--certificate-arn arn:aws:acm:us-east-1:xxxxxxxxxxxx:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
--domain www.yourdomain.com \
--validation-domain yourdomain.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You will need acm:ResendValidationEmail permission to run the command.&lt;/p&gt;</description></item><item><title>awscli permission denied</title><link>http://uly.me/posts/awscli-permission-denied/</link><pubDate>Wed, 15 Sep 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/awscli-permission-denied/</guid><description>&lt;p&gt;When running awscli as a user, I’m getting a permissioned denied.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[user@servername ~]$ aws s3 ls
Traceback (most recent call last):
File &amp;#34;/home/db2inst1/.local/bin/aws&amp;#34;, line 19, in &amp;lt;module&amp;gt;
import awscli.clidriver
File &amp;#34;/home/db2inst1/.local/lib/python2.7/site-packages/awscli/clidriver.py&amp;#34;, line 17, in &amp;lt;module&amp;gt;
import botocore.session
File &amp;#34;/home/db2inst1/.local/lib/python2.7/site-packages/botocore/session.py&amp;#34;, line 26, in &amp;lt;module&amp;gt;
import botocore.configloader
File &amp;#34;/home/db2inst1/.local/lib/python2.7/site-packages/botocore/configloader.py&amp;#34;, line 19, in &amp;lt;module&amp;gt;
from botocore.compat import six
File &amp;#34;/home/db2inst1/.local/lib/python2.7/site-packages/botocore/compat.py&amp;#34;, line 172, in &amp;lt;module&amp;gt;
import xml.etree.cElementTree
File &amp;#34;/usr/lib64/python2.7/xml/etree/cElementTree.py&amp;#34;, line 3, in &amp;lt;module&amp;gt;
from _elementtree import *
ImportError: PyCapsule_Import could not import module &amp;#34;pyexpat&amp;#34;
&amp;lt;/module&amp;gt;&amp;lt;/module&amp;gt;&amp;lt;/module&amp;gt;&amp;lt;/module&amp;gt;&amp;lt;/module&amp;gt;&amp;lt;/module&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is a permission error with the directory where the awscli is installed.&lt;/p&gt;</description></item><item><title>nmap scan top 1000 ports</title><link>http://uly.me/posts/nmap-scan-top-1000-ports/</link><pubDate>Mon, 13 Sep 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nmap-scan-top-1000-ports/</guid><description>&lt;p&gt;Use this option if you want to scan the top 1000 ports.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ nmap -F 10.10.10.10
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want a single specific port, then use -p option.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ nmap -p 80 10.10.10.10
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list firewall rules</title><link>http://uly.me/posts/gcp-list-firewall-rules/</link><pubDate>Fri, 10 Sep 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-firewall-rules/</guid><description>&lt;p&gt;Here’s how to list GCP firewall rules while filtering a service account. Output is exported as a CSV file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules list \
--project host-project \
--filter=service-account-name \
--format=&amp;#34;csv(
name,
network,
direction,
priority,
sourceRanges.list():label=SRC_RANGES,
destinationRanges.list():label=DEST_RANGES,
allowed[].map().firewall_rule().list():label=ALLOW,
denied[].map().firewall_rule().list():label=DENY,
sourceTags.list():label=SRC_TAGS,
sourceServiceAccounts.list():label=SRC_SVC_ACCT,
targetTags.list():label=TARGET_TAGS,
targetServiceAccounts.list():label=TARGET_SVC_ACCT,
disabled)&amp;#34; \
&amp;gt; export.csv
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>rpm hung</title><link>http://uly.me/posts/rpm-hung/</link><pubDate>Fri, 10 Sep 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rpm-hung/</guid><description>&lt;p&gt;Check if there’s a runaway rpm process. This returns number of processes that are running.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ps -ef | grep rpm | wc -l
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Kill it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;killall -9 rpm
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You should be able to run yum updates from this point on.&lt;/p&gt;</description></item><item><title>awscli cli_pager</title><link>http://uly.me/posts/awscli-cli_pager/</link><pubDate>Sun, 05 Sep 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/awscli-cli_pager/</guid><description>&lt;p&gt;In AWSCLI Version 2, it’s using “less” by default to send output to the screen. Less displays output one page at a time.&lt;/p&gt;
&lt;p&gt;If less interferes with your script, then you can set “cli_pager” in ~/.aws/config to use nothing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[default]
region = us-east-2
output = json
cli_pager =
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you have other profiles, add them as well.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[lightsail]
region = us-east-2
output = json
cli_pager =
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>convert ppk to pem</title><link>http://uly.me/posts/convert-ppk-to-pem/</link><pubDate>Thu, 02 Sep 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-ppk-to-pem/</guid><description>&lt;p&gt;Convert PPK to PEM format.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open Puttygen.&lt;/li&gt;
&lt;li&gt;Click Load in the Actions section.&lt;/li&gt;
&lt;li&gt;Select the PPK file you wish to convert.&lt;/li&gt;
&lt;li&gt;Go to the Conversions menu and select Export OpenSSH key.&lt;/li&gt;
&lt;li&gt;Click Yes to convert key without a password.&lt;/li&gt;
&lt;li&gt;Name your private key and save it with a .pem extension.&lt;/li&gt;
&lt;li&gt;Click Save.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Your pem file should begin with “—–BEGIN RSA PRIVATE KEY—–” and ends with “—–END RSA PRIVATE KEY—–.”&lt;/p&gt;
&lt;p&gt;You can also use puttygen in Linux. Install it first.&lt;/p&gt;</description></item><item><title>uninstall awscli v2 on linux</title><link>http://uly.me/posts/uninstall-awscli-v2-on-linux/</link><pubDate>Wed, 01 Sep 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/uninstall-awscli-v2-on-linux/</guid><description>&lt;p&gt;How to uninstall AWSCLI version 2 on Linux&lt;/p&gt;
&lt;p&gt;Locate aws.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ which aws
/usr/local/bin/aws
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete the symlinks.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ ls -l /usr/local/bin/aws
$ sudo rm /usr/local/bin/aws
$ sudo rm /usr/local/bin/aws_completer
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete the install directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo rm -rf /usr/local/aws-cli
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once deleted, you can reinstall awscli.&lt;/p&gt;</description></item><item><title>gcp display device names on os</title><link>http://uly.me/posts/gcp-display-device-names-on-os/</link><pubDate>Wed, 18 Aug 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-display-device-names-on-os/</guid><description>&lt;p&gt;In GCP console you can see the VM’s Device Names. In this case, it’s boot and persistent-disk-1.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Name Device name
server-boot boot
server-data persistent-disk-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To display the volume names on the OS, run this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ ls -l /dev/disk/by-id
total 0
lrwxrwxrwx. 1 root root 9 Aug 2 01:12 google-boot -&amp;gt; ../../sda
lrwxrwxrwx. 1 root root 10 Aug 2 01:12 google-boot-part1 -&amp;gt; ../../sda1
lrwxrwxrwx. 1 root root 9 Aug 18 18:48 google-persistent-disk-1 -&amp;gt; ../../sdb
lrwxrwxrwx. 1 root root 9 Aug 2 01:12 scsi-0Google_PersistentDisk_boot -&amp;gt; ../../sda
lrwxrwxrwx. 1 root root 10 Aug 2 01:12 scsi-0Google_PersistentDisk_boot-part1 -&amp;gt; ../../sda1
lrwxrwxrwx. 1 root root 9 Aug 18 18:48 scsi-0Google_PersistentDisk_persistent-disk-1 -&amp;gt; ../../sdb
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;As you can see, boot and persistent-disk-1 are displayed along with its device names /dev/sda and /dev/sdb.&lt;/p&gt;</description></item><item><title>check open ports remotely</title><link>http://uly.me/posts/check-open-ports-remotely/</link><pubDate>Tue, 17 Aug 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-open-ports-remotely/</guid><description>&lt;p&gt;Here are a few tools to check if ports are open from a remote host.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;nc -zvw10 192.168.0.1 22
nmap 192.168.0.1 -p 22
telnet 192.168.0.1 22
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You may have to install netcat and nmap if missing in your distro.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install nc
yum install nmap
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>terraform gcloud vm image family</title><link>http://uly.me/posts/terraform-gcloud-vm-image-family/</link><pubDate>Tue, 10 Aug 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-gcloud-vm-image-family/</guid><description>&lt;p&gt;How to implement image family with Terraform in GCP.&lt;/p&gt;
&lt;p&gt;Declare the machine image in terraform.tfvars.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;image-family = &amp;#34;centos-7&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Declare data type for the machine image in maint.tf.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;data &amp;#34;google_compute_image&amp;#34; &amp;#34;my_image&amp;#34; {
family = var.image-family
project = &amp;#34;your-project-id&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In main.tf use “google_compute_instance” under boot disk section in main.tf.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;boot_disk {
initialize_params {
image = data.google_compute_image.my_image.self_link
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash variable empty</title><link>http://uly.me/posts/bash-variable-empty/</link><pubDate>Fri, 06 Aug 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-variable-empty/</guid><description>&lt;p&gt;Here’s how to check in Bash if a variable is empty or unset.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if [ -z &amp;#34;${VAR}&amp;#34; ];
then
echo &amp;#39;do something&amp;#39;
else
echo &amp;#39;do another&amp;#39;
fi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;One liner&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if [ -z &amp;#34;${VAR}&amp;#34; ]; then echo &amp;#39;do something&amp;#39;; else echo &amp;#39;do another&amp;#39;; fi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The inverse&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if [ ! -z &amp;#34;${VAR}&amp;#34; ];
then
echo &amp;#39;do something&amp;#39;
else
echo &amp;#39;do another&amp;#39;
fi
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;if [ ! -z &amp;#34;${VAR}&amp;#34; ]; then echo &amp;#39;do something&amp;#39;; else echo &amp;#39;do another&amp;#39;; fi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>corosync settings</title><link>http://uly.me/posts/corosync-settings/</link><pubDate>Thu, 05 Aug 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/corosync-settings/</guid><description>&lt;p&gt;Here are the SAP Corosync settings.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[root@server ~]corosync-cmapctl | grep fail_recv_const
runtime.config.totem.fail_recv_const (u32) = 500
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>markdown language</title><link>http://uly.me/posts/markdown-language/</link><pubDate>Thu, 05 Aug 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/markdown-language/</guid><description>&lt;p&gt;Style your text using markdown. If you use GitHub, markdown will come in handy.&lt;/p&gt;
&lt;p&gt;Examples:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# This is an &amp;lt;h1&amp;gt; tag
## This is an &amp;lt;h2&amp;gt; tag
###### This is an &amp;lt;h6&amp;gt; tag
&amp;lt;/h6&amp;gt;&amp;lt;/h2&amp;gt;&amp;lt;/h1&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here are more &lt;a href="https://guides.github.com/features/mastering-markdown/#examples"&gt;markdown examples&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>sublime text terraform syntax</title><link>http://uly.me/posts/sublime-text-terraform-syntax/</link><pubDate>Wed, 04 Aug 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sublime-text-terraform-syntax/</guid><description>&lt;p&gt;If you use Terraform and Sublime Text, add Terraform Syntax Highlighter using Package Control.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Press Ctrl+Shift+P or Cmd+Shift+P.
Select “Package Control: Install package”
Select “Terraform”
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It should install in a few seconds.&lt;/p&gt;</description></item><item><title>sssd override shell</title><link>http://uly.me/posts/sssd-override-shell/</link><pubDate>Sun, 25 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sssd-override-shell/</guid><description>&lt;p&gt;If you have SSSD running and the default shell is ksh even with the default shell set to bash.&lt;/p&gt;
&lt;p&gt;Here’s the fix to override the default shell in /etc/sssd/sssd.conf. Add override_shell.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;default_shell = /bin/bash
override_shell = /bin/bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To check which shell you are using.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo $SHELL
/bin/bash
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp ssh issues</title><link>http://uly.me/posts/gcp-ssh-issues/</link><pubDate>Tue, 20 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-ssh-issues/</guid><description>&lt;p&gt;There are a few issues that prop up every once in a while with gcloud compute ssh. gcloud compute ssh creates local user at first login. The account password has a default expiration of 90 days. If unable to login, you can try logging in as a different name (even a fictitious name) e.g. superheroes, etc. something unique.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssh username@servername --zone us-central1-c --project project-id --internal-ip
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once logged in, you can delete local users with expired passwords or perform other admin tasks.&lt;/p&gt;</description></item><item><title>migrate vm to other network</title><link>http://uly.me/posts/migrate-vm-to-other-network/</link><pubDate>Tue, 20 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/migrate-vm-to-other-network/</guid><description>&lt;p&gt;Here’s how to move a VM to another network.&lt;/p&gt;
&lt;p&gt;Stop the VM.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances stop server-name \
--zone=us-central1-c \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Migrate the VM. Use self link for network and subnetwork.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances network-interfaces update server-name \
--zone=us-central1-c \
--network-interface=nic0 \
--network=your-network \
--subnetwork=your-sub-network \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start the VM.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances start server-name \
--zone=us-central1-c \
--project project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>awscli in docker container</title><link>http://uly.me/posts/awscli-in-docker-container/</link><pubDate>Sat, 17 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/awscli-in-docker-container/</guid><description>&lt;p&gt;This will download the latest awscli and run it in a container.&lt;/p&gt;
&lt;p&gt;A new container will be built every time the command is run.&lt;/p&gt;
&lt;p&gt;Your current credentials in ~/.aws will be used.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker run --rm -it -v ~/.aws:/root/.aws amazon/aws-cli:latest
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create an alias for convenience.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;alias aws=&amp;#39;docker run --rm -ti -v ~/.aws:/root/.aws -v $(pwd):/aws amazon/aws-cli&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can now run any aws cli after.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws --version
aws-cli/2.2.20 Python/3.8.8 Linux/5.4.0-66-generic docker/x86_64.amzn.2 prompt/off
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash aliases</title><link>http://uly.me/posts/bash-aliases/</link><pubDate>Sat, 17 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-aliases/</guid><description>&lt;p&gt;Create an alias.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;alias gcloud=&amp;#39;docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk:latest gcloud&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove an alias.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;unalias gcloud
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>downgrade redhat kernel</title><link>http://uly.me/posts/downgrade-redhat-kernel/</link><pubDate>Sat, 17 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/downgrade-redhat-kernel/</guid><description>&lt;p&gt;How to downgrade a Redhat kernel within the same release.&lt;/p&gt;
&lt;p&gt;List kernel.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum list kernel-3.10.0-862*
yum list kernel-3.10*
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install previous kernel if missing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install kernel-3.10.0-862.el7
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Downgrade to next minor release.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum downgrade redhat-release
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcloud in a docker container</title><link>http://uly.me/posts/gcloud-in-a-docker-container/</link><pubDate>Sat, 17 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcloud-in-a-docker-container/</guid><description>&lt;p&gt;You can run a gcloud commands in a Docker container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker run -ti --name gcloud-config google/cloud-sdk gcloud auth login
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create an alias.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;alias gcloud=&amp;#39;docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk:latest gcloud&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run the command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud --version
Google Cloud SDK 348.0.0
alpha 2021.07.09
app-engine-go 1.9.71
app-engine-java 1.9.90
app-engine-python 1.9.93
app-engine-python-extras 1.9.93
beta 2021.07.09
bigtable
bq 2.0.70
cbt 0.10.0
cloud-datastore-emulator 2.1.0
cloud-firestore-emulator 1.13.0
cloud-spanner-emulator 1.2.0
core 2021.07.09
datalab 20190610
gsutil 4.65
kpt 0.39.3
local-extract 1.2.0
pubsub-emulator 0.4.1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create one for gsutil.&lt;/p&gt;</description></item><item><title>terraform in a docker container</title><link>http://uly.me/posts/terraform-in-a-docker-container/</link><pubDate>Sat, 17 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-in-a-docker-container/</guid><description>&lt;p&gt;Run Terraform in a Docker container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create an alias.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;alias terraform=&amp;#39;docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run the command&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform --version
Terraform v1.0.2
on linux_amd64
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ubuntu check reboot required</title><link>http://uly.me/posts/ubuntu-check-reboot-required/</link><pubDate>Sat, 17 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ubuntu-check-reboot-required/</guid><description>&lt;p&gt;Check if reboot is required in Ubuntu.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;at /var/run/reboot-required
*** System restart required ***
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>check reboot after updates</title><link>http://uly.me/posts/check-reboot-after-updates/</link><pubDate>Fri, 16 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-reboot-after-updates/</guid><description>&lt;p&gt;Here’s the command to check if the system needs a reboot after running yum update.&lt;/p&gt;
&lt;p&gt;Must be root or run it sudo.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ needs-restarting -r ; echo $?
Core libraries or services have been updated:
openssl-libs -&amp;gt; 1:1.0.2k-21.el7_9
kernel -&amp;gt; 3.10.0-1160.31.1.el7
dbus -&amp;gt; 1:1.10.24-15.el7
linux-firmware -&amp;gt; 20200421-80.git78c0348.el7_9
glibc -&amp;gt; 2.17-324.el7_9
systemd -&amp;gt; 219-78.el7_9.3
Reboot is required to ensure that your system benefits from these updates.
More information:
https://access.redhat.com/solutions/27943
1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this instance, it requires a reboot due to a new kernel.&lt;/p&gt;</description></item><item><title>gcp rename vm</title><link>http://uly.me/posts/gcp-rename-vm/</link><pubDate>Fri, 16 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-rename-vm/</guid><description>&lt;p&gt;There’s a new beta command to rename a GCP VM.&lt;/p&gt;
&lt;p&gt;You must stop instance first.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances stop server-name \
--zone us-central1-c \
--project your-project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Rename the instance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud beta compute instances set-name old-server-name \
--new-name=new-server-name \
--zone us-central1-c \
--project your-project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start the instance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances start server-name \
--zone us-central1-c \
--project your-project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Login.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssh server-name \
--zone us-central1-c \
--project your-project-id \
--internal-ip &amp;amp;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp ssh issues return code [1]</title><link>http://uly.me/posts/gcp-ssh-issues-return-code-1/</link><pubDate>Fri, 16 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-ssh-issues-return-code-1/</guid><description>&lt;p&gt;If you are getting this return code [1] error, check if enable-oslogin metadata is set to TRUE in your VM.&lt;/p&gt;
&lt;p&gt;Here’s the error when logging in.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssh your-server-name \
--zone us-central1-a \
--project your-project-id \
--internal-ip &amp;amp;
ERROR: (gcloud.compute.ssh) [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\sdk\plink.exe] exited with return code [1].
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove metadata.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances remove-metadata your-server-name \
--keys=enable-oslogin \
--zone us-central1-a \
--project your-project-id
Updated [https://www.googleapis.com/compute/v1/projects/your-project-id/zones/us-central1-a/instances/your-server-name].
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run gcloud ssh again.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssh your-server-name \
--zone us-central1-a \
--project your-project-id \
--internal-ip &amp;amp;
[1] 1257
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This time it opens up a Putty session and you’re able to login.&lt;/p&gt;</description></item><item><title>resizing xfs root partition in gcp</title><link>http://uly.me/posts/resizing-xfs-root-partition-in-gcp/</link><pubDate>Fri, 16 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/resizing-xfs-root-partition-in-gcp/</guid><description>&lt;p&gt;How to resize a root partition in GCP.&lt;/p&gt;
&lt;p&gt;Increase disk size.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks resize server-boot-disk-name \
--size=50GB \
--zone us-central1-c \
--project your-project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run growpart.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;growpart /dev/sda 1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run xfs_growfs.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;xfs_growfs /dev/sda1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To verify, run these.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsblk
df -Th
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>yum check update</title><link>http://uly.me/posts/yum-check-update/</link><pubDate>Fri, 09 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yum-check-update/</guid><description>&lt;p&gt;To check which packages are available for an update.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum check-update
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>jq on gitbash</title><link>http://uly.me/posts/jq-on-gitbash/</link><pubDate>Wed, 07 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/jq-on-gitbash/</guid><description>&lt;p&gt;JQ is a json processor. It’s for slicing and dicing data.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://stedolan.github.io/jq/"&gt;Download&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To install on GitBash, unzip the file and copy the executable to /usr/bin.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mv jq-win64.exe to /usr/bin/jq.exe
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create an alias. Edit ~/.bashrc.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;alias jq=&amp;#39;/usr/bin/jq.exe&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Using JQ.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;jq --version
jq &amp;#39;.selfLink&amp;#39; vm.json
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>dos2unix alternative</title><link>http://uly.me/posts/dos2unix-alternative/</link><pubDate>Fri, 02 Jul 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/dos2unix-alternative/</guid><description>&lt;p&gt;If you create scripts in Windows, editors sometimes add a carriage return in addition to the line feed.&lt;/p&gt;
&lt;p&gt;You can use dos2unix to remove the extra characters. Or you can use sed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sed -i -e &amp;#39;s/\r$//&amp;#39; script.sh
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sudoers file explained</title><link>http://uly.me/posts/sudoers-file-explained/</link><pubDate>Wed, 30 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sudoers-file-explained/</guid><description>&lt;p&gt;You are probably wondering how the sudoers file works. Here’s a simple explanation.&lt;/p&gt;
&lt;p&gt;Command&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;username host=(user:group) tag:commands
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Explanation&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;username – the specified user allowed to run commands.
&lt;ul&gt;
&lt;li&gt;host – the specified host the command is allowed to run.&lt;/li&gt;
&lt;li&gt;user – specifies which users can use the command.&lt;/li&gt;
&lt;li&gt;group – specifies which groups can run the command.&lt;/li&gt;
&lt;li&gt;tag – the option allowed. NOPASSWD&lt;/li&gt;
&lt;li&gt;command – the command allowed to run.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Examples&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;root ALL=(ALL) ALL
username ALL=(ALL) ALL
john test=(ALL) NOPASSWD: /bin/useradd
jane ALL=(sales) NOPASSWD: /bin/sh
%sudo ALL=(ALL) ALL
%adgroup ALL=(ALL) ALL
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>copy s3 to another region</title><link>http://uly.me/posts/copy-s3-to-another-region/</link><pubDate>Tue, 22 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/copy-s3-to-another-region/</guid><description>&lt;p&gt;Buckets are regional. Your source and destination buckets should be in different regions.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3 sync s3://DOC-EXAMPLE-BUCKET-SOURCE s3://DOC-EXAMPLE-BUCKET-TARGET
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use the sync command. It will copy new or modified files.&lt;/p&gt;</description></item><item><title>gcp create ssl certificate</title><link>http://uly.me/posts/gcp-create-ssl-certificate/</link><pubDate>Sun, 13 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-ssl-certificate/</guid><description>&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssl-certificates create certificate-name \
--description=&amp;#34;ssl cert for domain-name.com&amp;#34; \
--domains=domain-name.com \
--certificate=certificate-file \
--private-key=private-key \
--region=us-central1-c \
--global
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp reserve alias ip</title><link>http://uly.me/posts/gcp-reserve-alias-ip/</link><pubDate>Sun, 13 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-reserve-alias-ip/</guid><description>&lt;p&gt;Make an IP alias reservation.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances network-interfaces update instance-name \
--zone us-central1-c \
--aliases default:/32 \
--project project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp update instance metadata</title><link>http://uly.me/posts/gcp-update-instance-metadata/</link><pubDate>Sun, 13 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-update-instance-metadata/</guid><description>&lt;p&gt;How to update an instance metadata in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances add-metadata instance-name \
--metadata key-name=value \
--project your-project-id \
--zone us-central1-a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this example, we are adding enable-oslogin=TRUE.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances add-metadata instance-name \
--metadata enable-oslogin=TRUE \
--project your-project-id \
--zone us-central1-a
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>change wordpress url</title><link>http://uly.me/posts/change-wordpress-url/</link><pubDate>Sun, 06 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-wordpress-url/</guid><description>&lt;p&gt;There are multiple ways to change URL in WordPress.&lt;/p&gt;
&lt;p&gt;Here’s one via wp-config.php.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;define( &amp;#39;WP_HOME&amp;#39;, &amp;#39;http://example.com&amp;#39; );
define( &amp;#39;WP_SITEURL&amp;#39;, &amp;#39;http://example.com&amp;#39; );
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you have a redirect in Apache, comment it out.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#Redirect permanent / https://yourdomain.com/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is by far the easiest way to change URL in WordPress.&lt;/p&gt;</description></item><item><title>terraform gcp firewall</title><link>http://uly.me/posts/terraform-gcp-firewall/</link><pubDate>Sun, 06 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-gcp-firewall/</guid><description>&lt;p&gt;How to create GCP firewall via Terraform.&lt;/p&gt;
&lt;p&gt;Ingress&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;provider &amp;#34;google&amp;#34; {
project = &amp;#34;project-id&amp;#34;
}
resource &amp;#34;google_compute_firewall&amp;#34; &amp;#34;default&amp;#34; {
name = &amp;#34;test-firewall&amp;#34;
description = &amp;#34;this is a test firewall&amp;#34;
priority = &amp;#34;1000&amp;#34;
direction = &amp;#34;INGRESS&amp;#34;
network = &amp;#34;projects/project-id/regions/us-east1/subnetworks/default&amp;#34;
target_service_accounts = [&amp;#34;service-account-compute@developer.gserviceaccount.com&amp;#34;]
source_ranges = [&amp;#34;10.128.0.0/20&amp;#34;]
allow {
protocol = &amp;#34;tcp&amp;#34;
ports = [&amp;#34;80&amp;#34;, &amp;#34;8080&amp;#34;, &amp;#34;1000-2000&amp;#34;]
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Egress&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;provider &amp;#34;google&amp;#34; {
project = &amp;#34;project-id&amp;#34;
}
resource &amp;#34;google_compute_firewall&amp;#34; &amp;#34;default&amp;#34; {
name = &amp;#34;test-firewall&amp;#34;
description = &amp;#34;this is a test firewall&amp;#34;
priority = &amp;#34;1000&amp;#34;
direction = &amp;#34;EGRESS&amp;#34;
network = &amp;#34;projects/project-id/regions/us-east1/subnetworks/default&amp;#34;
target_service_accounts = [&amp;#34;service-account-compute@developer.gserviceaccount.com&amp;#34;]
destination_ranges = [&amp;#34;10.128.0.0/20&amp;#34;]
allow {
protocol = &amp;#34;tcp&amp;#34;
ports = [&amp;#34;80&amp;#34;, &amp;#34;8080&amp;#34;, &amp;#34;1000-2000&amp;#34;]
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Service account to Service account.&lt;/p&gt;</description></item><item><title>tomcat install</title><link>http://uly.me/posts/tomcat-install/</link><pubDate>Fri, 04 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tomcat-install/</guid><description>&lt;p&gt;Tomcat requires JRE.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;wget jre-8uversion-linux-x64.tar.gz
# or
apt-get install default-jdk
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install Tomcat 8 on Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;wget https://mirrors.gigenet.com/apache/tomcat/tomcat-8/v8.5.66/bin/apache-tomcat-8.5.66.tar.gz
tar zxpvf apache-tomcat-8.5.66.tar.gz
cd /opt/tomcat/apache-tomcat-8.5.66/bin/
./startup.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Status|Start|Stop|Restart Tomcat.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl status tomcat8
systemctl start tomcat8
systemctl stop tomcat8
systemctl restart tomcat8
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>install syslog</title><link>http://uly.me/posts/install-syslog/</link><pubDate>Wed, 02 Jun 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-syslog/</guid><description>&lt;p&gt;How to install syslog-np on Centos 7.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /tmp
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y reinstall ./epel-release-latest-7.noarch.rpm
chattr +i /etc/yum.repos.d/epel*
yum -y install syslog-ng
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Enable syslog-np. Disable rsyslog.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl enable syslog-ng
systemctl start syslog-ng
yum -y erase rsyslog
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp instance scheduler</title><link>http://uly.me/posts/gcp-instance-scheduler/</link><pubDate>Fri, 28 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-instance-scheduler/</guid><description>&lt;p&gt;GCP recently added Instance Schedule to its console.&lt;/p&gt;
&lt;p&gt;To configure, perform the following.&lt;/p&gt;
&lt;p&gt;– Create an instance schedule.&lt;br&gt;
– Add instance(s) to a schedule.&lt;br&gt;
– If no errors, the service account has the correct permissions.&lt;/p&gt;
&lt;p&gt;The service account used by Instance Schedule is owned by GCP and is not visible in the GCP console.&lt;/p&gt;
&lt;p&gt;If service account has no permissions, the you must perform the following.&lt;/p&gt;
&lt;p&gt;– Create a custom role with compute.instances.start and compute.instances.stop permissions.&lt;br&gt;
– Add custom role to the service account.&lt;/p&gt;</description></item><item><title>gcp compute enable os login</title><link>http://uly.me/posts/gcp-compute-enable-os-login/</link><pubDate>Thu, 27 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-compute-enable-os-login/</guid><description>&lt;p&gt;If you have trouble logging in (SSH) to your GCP instance, you may have to enable OS Login.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances add-metadata server-name \
--metadata enable-oslogin=TRUE \
--zone us-central1-c \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When done, you can set it back to FALSE.&lt;/p&gt;</description></item><item><title>generated by networkmanager</title><link>http://uly.me/posts/generated-by-networkmanager/</link><pubDate>Thu, 27 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/generated-by-networkmanager/</guid><description>&lt;p&gt;If your /etc/resolv.conf keeps getting overwritten, take a look at /etc/NetworkManager/NetworkManager.conf. Set DNS to none.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[main]
dns=none
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp display serial port in shell</title><link>http://uly.me/posts/gcp-display-serial-port-in-shell/</link><pubDate>Wed, 26 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-display-serial-port-in-shell/</guid><description>&lt;p&gt;How to display serial port in GCP Cloud Shell.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances get-serial-port-output instance-name \
--zone=us-central1-a \
--project=your-project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>remove sssd package</title><link>http://uly.me/posts/remove-sssd-package/</link><pubDate>Mon, 24 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-sssd-package/</guid><description>&lt;p&gt;How to remove SSSD package.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
service sssd stop
chkconfig sssd off
rm -rf /var/lib/sss/db/*
rm -f /etc/sssd/sssd.conf
rm -f /etc/krb5.conf
rm -f /etc/krb5.keytab
yum remove -y adcli sssd authconfig pam_krb5 samba4-common realmd
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sssd report</title><link>http://uly.me/posts/sssd-report/</link><pubDate>Mon, 24 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sssd-report/</guid><description>&lt;p&gt;Generate a SSSD report.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
log=&amp;#34;log&amp;#34;
&amp;gt; $log
sep () { echo &amp;#34;--------------------------------&amp;#34; &amp;gt;&amp;gt; $log; }
sep
echo &amp;#34;SSSD Status&amp;#34; &amp;gt;&amp;gt; $log
sep
systemctl status sssd &amp;gt;&amp;gt; $log
sep
echo &amp;#34;Contents of /etc/resolv.conf&amp;#34; &amp;gt;&amp;gt; $log
sep
cat /etc/resolv.conf &amp;gt;&amp;gt; $log
sep
echo &amp;#34;Contents of /etc/sssd/sssd.conf&amp;#34; &amp;gt;&amp;gt; $log
sep
cat /etc/sssd/sssd.conf &amp;gt;&amp;gt; $log
sep
echo &amp;#34;Versions of /etc/resolv.conf&amp;#34; &amp;gt;&amp;gt; $log
sep
ls -l /etc/resolv.conf* &amp;gt;&amp;gt; $log
sep
echo &amp;#34;Versions of /etc/sssd/sssd.conf&amp;#34; &amp;gt;&amp;gt; $log
sep
ls -l /etc/sssd/sssd.conf* &amp;gt;&amp;gt; $log
sep
echo &amp;#34;Contents of /var/log/sssd-rollout.log&amp;#34; &amp;gt;&amp;gt; $log
sep
cat /var/log/sssd-rollout.log &amp;gt;&amp;gt; $log
sep
echo &amp;#34;Contents of /var/log/sssd-rollout3.log&amp;#34; &amp;gt;&amp;gt; $log
sep
cat /var/log/sssd-rollout3.log &amp;gt;&amp;gt; $log
sep
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>winbind fix</title><link>http://uly.me/posts/winbind-fix/</link><pubDate>Mon, 24 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/winbind-fix/</guid><description>&lt;p&gt;Here’s the process to restore Winbind.&lt;/p&gt;
&lt;p&gt;Restore old config.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cp /etc/sssd/sssd.conf-xxxxxxx /etc/sssd/sssd.conf
cp /etc/krb5.conf-xxxxxxx /etc/krb5.conf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disable SSSD. Authconfig creates /etc/nswitch.conf.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;authconfig --disablesssd --disablesssdauth --updateall
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start Winbind.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service winbind start; service smb start; service nmb start
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>rpmdb open failed</title><link>http://uly.me/posts/rpmdb-open-failed/</link><pubDate>Sat, 22 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rpmdb-open-failed/</guid><description>&lt;p&gt;If you get this error, something happened to the rpm database. To fix.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rm -f /var/lib/rpm/__db*
db_verify /var/lib/rpm/Packages
rpm --rebuilddb
yum clean all
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run yum again.&lt;/p&gt;</description></item><item><title>gcp login service account</title><link>http://uly.me/posts/gcp-login-service-account/</link><pubDate>Thu, 13 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-login-service-account/</guid><description>&lt;p&gt;Here’s the command to authenticate as a service account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth activate-service-account --key-file=key.json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To log out.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth revoke
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>modify a line using sed</title><link>http://uly.me/posts/modify-a-line-using-sed/</link><pubDate>Tue, 11 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/modify-a-line-using-sed/</guid><description>&lt;p&gt;Here’s how to modify a line in a file using sed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sed -i &amp;#39;s/replace me.*/with this text/&amp;#39; /path/to/a/file.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws ec2 ena support</title><link>http://uly.me/posts/aws-ec2-ena-support/</link><pubDate>Fri, 07 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-ec2-ena-support/</guid><description>&lt;p&gt;AWS has machine types that require ENA Support. You can run AWS CLI to find out if instance is ENA enabled.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-instances \
--instance-id i-xxxxxxxxxxxxxxxxx \
--profile default \
--region us-east-1 \
--query &amp;#39;Reservations[].Instances[].EnaSupport&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Login to the instance and verify.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo lspci | grep -i Amazon
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List driver details.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;modinfo nvme
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Verify modules loaded at startup.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsmod | grep nvme
lsmod | grep ena
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If ENA drivers are missing, install them.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install pciutils
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp keep disk</title><link>http://uly.me/posts/gcp-keep-disk/</link><pubDate>Thu, 06 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-keep-disk/</guid><description>&lt;p&gt;Keep your disks when a VM is deleted.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances set-disk-auto-delete server --no-auto-delete --disk=server-disk-1
gcloud compute instances set-disk-auto-delete server --no-auto-delete --disk=server-disk-2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To delete.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances set-disk-auto-delete server --auto-delete --disk=server-disk-1
gcloud compute instances set-disk-auto-delete server --auto-delete --disk=server-disk-2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>s3fs</title><link>http://uly.me/posts/s3fs/</link><pubDate>Thu, 06 May 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/s3fs/</guid><description>&lt;p&gt;s3fs allows Linux to mount S3 buckets as a file system.&lt;/p&gt;
&lt;p&gt;Install s3fs.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt install s3fs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Setup credentials.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo ACCESS_KEY_ID:SECRET_ACCESS_KEY &amp;gt; /etc/.passwd-s3fs
chmod 400 ${HOME}/.passwd-s3fs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Setup mount directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir -p /mountpoint
chown username:username /mountpoint
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;s3fs bucketname /mountpoint -o passwd_file=/etc/.passwd-s3fs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount it automatically.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;bucketname /mountpoint fuse.s3fs _netdev,allow_other,passwd_file=/etc/.passwd-s3fs,rw,uid=1000,gid=1000,umask=022 0 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Alternative.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;s3fs#bucketname /mountpoint fuse _netdev,allow_other,use_cache=/root/cache,uid=1000,gid=1000,umask=022 0 0
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ipinfo.io map</title><link>http://uly.me/posts/ipinfo-io-map/</link><pubDate>Sat, 24 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ipinfo-io-map/</guid><description>&lt;p&gt;Generate a map of your live streaming viewers by placing of your viewer’s IP into a file and then using IPInfo’s map tool.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim ipList
54.0.0.1
54.0.0.2
54.0.0.3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To plot the IPs on a map, pipe them to IPinfo.io.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cat ipList | curl -XPOST --data-binary @- &amp;#34;ipinfo.io/map?cli=1&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is a URL of the map.&lt;/p&gt;</description></item><item><title>ubuntu speedtest</title><link>http://uly.me/posts/ubuntu-speedtest/</link><pubDate>Sun, 18 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ubuntu-speedtest/</guid><description>&lt;p&gt;Install Speedtest CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get install gnupg1 apt-transport-https dirmngr
export INSTALL_KEY=379CE192D401AB61
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
echo &amp;#34;deb https://ookla.bintray.com/debian generic main&amp;#34; | sudo tee /etc/apt/sources.list.d/speedtest.list
sudo apt-get update
sudo apt-get install speedtest
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To run.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;speedtest
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ speedtest
Speedtest by Ookla
Server: City of Columbus - Columbus, OH (id = 40410)
ISP: Spectrum
Latency: 9.39 ms (0.63 ms jitter)
Download: 117.74 Mbps (data used: 60.3 MB)
Upload: 11.81 Mbps (data used: 5.6 MB)
Packet Loss: 0.0%
Result URL: https://www.speedtest.net/result/c/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx (redacted)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>invalid credentials with gsutil</title><link>http://uly.me/posts/invalid-credentials-with-gsutil/</link><pubDate>Fri, 16 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/invalid-credentials-with-gsutil/</guid><description>&lt;p&gt;If you’re trying to access GCS (Google Cloud Storage) and you’re getting “Your credentials are invalid. Please run gcloud auth login”, you most likely have a previous key stored in the ~/.boto file. This happens if you previously configured gsutil with your own credentials, then switched over to Google SDK mode. To fix the invalid credentials, edit the ~/.boto file and comment out the auth key.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim ~/.boto
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Comment out.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#gs_oauth2_refresh_token = &amp;lt;token redacted=&amp;#34;&amp;#34;&amp;gt;
&amp;lt;/token&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Rerun the gsutil ls command. It should work.&lt;/p&gt;</description></item><item><title>sosreport</title><link>http://uly.me/posts/sosreport/</link><pubDate>Fri, 16 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sosreport/</guid><description>&lt;p&gt;Install&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install sos
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run sosreport&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sosreport
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Case number will be part of exported report located in /var/tmp.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /var/tmp
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wordpress critical error</title><link>http://uly.me/posts/wordpress-critical-error/</link><pubDate>Sun, 11 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-critical-error/</guid><description>&lt;p&gt;If you get a WordPress “There has been a critical error on your website” error, you probably have an issue with a theme or plugin. The quickest way to troubleshoot is to rename the plugins directory since there’s no way to login. This technically disables all plugins. Rename it back to plugins and enable each plugin one by one.&lt;/p&gt;
&lt;p&gt;Disable all plugins.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mv plugins plugins-backup
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Login and restore the plugins directory.&lt;/p&gt;</description></item><item><title>docker exec</title><link>http://uly.me/posts/docker-exec/</link><pubDate>Fri, 09 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/docker-exec/</guid><description>&lt;p&gt;If you want to SSH to a Docker container, use the Docker exec command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker exec -it container_name bash
docker exec -it --user root container_name /bin/bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I’m using a Git Bash terminal, so I have to prefix the docker command with winpty.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;winpty docker exec -it container_name bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;root@681bbe3f65f1:/var/www/html#
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Ctrl-D to exit.&lt;/p&gt;</description></item><item><title>troubleshoot nameservers with dig</title><link>http://uly.me/posts/troubleshoot-nameservers-with-dig/</link><pubDate>Thu, 08 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/troubleshoot-nameservers-with-dig/</guid><description>&lt;p&gt;Here’s how to troubleshoot nameservers with dig.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dig hostname
dig domain.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To test a specific nameserver.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dig @nameserver hostname
dig @nameserver ip-address
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Other options.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dig hostname.domain.com +short
dig hostname.domain.com +noall +answer
dig @nameserver MX domain.com
dig @nameserver AAAA domain.com
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>startup script</title><link>http://uly.me/posts/startup-script/</link><pubDate>Tue, 06 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/startup-script/</guid><description>&lt;p&gt;Here’s how to run a script on bootup on Rhel 7 that’s running systemd.&lt;/p&gt;
&lt;p&gt;First create a script. It this case, it will create a file called test.txt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
&amp;gt; /root/test.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Make the script executable.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;chmod /root/test.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now create a service in /etc/systemd/system/test.service&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# vi /etc/systemd/system/test.service
[Unit]
Description=A test service
After=network.target
[Service]
Type=simple
ExecStart=/root/test.sh
TimeoutStartSec=0
[Install]
WantedBy=default.target
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reload systemd.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl daemon-reload
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Enable the service.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl enable test.service
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start the service.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl start test.service
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot and test.&lt;/p&gt;</description></item><item><title>gitbash path</title><link>http://uly.me/posts/gitbash-path/</link><pubDate>Sun, 04 Apr 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gitbash-path/</guid><description>&lt;p&gt;Open Git Bash. Change to the root directory of Git Bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd ~
echo $PATH
/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Edit .bash_profile or .bashrc. It was .bash_profile in my case. Showing a truncated path.&lt;/p&gt;
&lt;p&gt;Add your custom path to the PATH variable. Save file. Exit Git Bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;PATH=&amp;#34;/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/custom/path&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Open Git Bash again and check your updated Path.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo $PATH
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/bin:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/custom/path
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>set timezone permanently</title><link>http://uly.me/posts/set-timezone-permanently/</link><pubDate>Thu, 18 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/set-timezone-permanently/</guid><description>&lt;p&gt;It’s recommended to set the clock to UTC. In rare occasions, local time may be needed.&lt;/p&gt;
&lt;p&gt;Here’s how to set your server’s timezone permanently.&lt;/p&gt;
&lt;p&gt;Check the date first.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;date
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Backup localtime. Set it to US Eastern Time.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mv /etc/localtime /etc/localtime.backup
ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Backup clock. Set it to US Eastern Time.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cp -p /etc/sysconfig/clock /etc/sysconfig/clock.backup
&amp;gt; /etc/sysconfig/clock
echo ZONE=\&amp;#34;America/New_York\&amp;#34; &amp;gt; /etc/sysconfig/clock
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run the date again to validate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;date
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp 400 bad request</title><link>http://uly.me/posts/gcp-400-bad-request/</link><pubDate>Mon, 15 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-400-bad-request/</guid><description>&lt;p&gt;After logging in, I tried to run Terraform in GCP and received this error:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;oauth2: cannot fetch token: 400 Bad Request
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the fix. Login using application-default.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth application-default login
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can then Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform apply
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bitwarden</title><link>http://uly.me/posts/bitwarden/</link><pubDate>Thu, 11 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bitwarden/</guid><description>&lt;p&gt;I changed password managers from LastPass to &lt;a href="http://bitwarden.com"&gt;BitWarden&lt;/a&gt; the other day. Migrating your credentials requires exporting and importing a CSV file from one program to another. It was an easy transition. Everything seems to work. As you may be aware, LastPass decided to make their free account limited to just one device. Customers will need to choose which device to use, whether desktop or mobile. Not both. If you want it on multiple devices, you’ll need to fork up $3 per month. It is not that expensive, but there are other alternatives. A few recommend BitWarden. It will let you sync to all devices for free. It was an easy choice.&lt;/p&gt;</description></item><item><title>gcp cloud shell vim settings</title><link>http://uly.me/posts/gcp-cloud-shell-vim-settings/</link><pubDate>Wed, 10 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-cloud-shell-vim-settings/</guid><description>&lt;p&gt;I had an issue with using the backspace in Vim in GCP’s Cloud Shell. Every time I’m in the insert mode and I want to edit using backspace, it doesn’t delete the characters. It shows these characters “^?” instead. Well, it turned out to be a backspace setting that you can set within .vimrc. So, here’s my working setup.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;colo desert
syntax on
set backspace=indent,eol,start
set nocompatible
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;The first line uses the desert theme.&lt;/li&gt;
&lt;li&gt;The second line turns on syntax highlighting. It’s on by default.&lt;/li&gt;
&lt;li&gt;The third line fixes the backspace issue I mentioned above.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>aws backup setup</title><link>http://uly.me/posts/aws-backup-setup/</link><pubDate>Sat, 06 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-backup-setup/</guid><description>&lt;p&gt;This script creates an AWS backup vault, adds a backup plan and a backup selection.&lt;/p&gt;
&lt;p&gt;Set up profile, region and Account ID first.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
profile=&amp;#34;default&amp;#34;
region=&amp;#34;us-east-1&amp;#34;
id=$(aws sts get-caller-identity --query Account --output text)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a vault.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws backup create-backup-vault \
--backup-vault-name my-vault \
--profile $profile \
--region $region
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a backup plan.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws backup create-backup-plan \
--backup-plan file://back-plan.json \
--profile $profile \
--region $region
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;backup-plan.json&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;BackupPlan&amp;#34;: {
&amp;#34;BackupPlanName&amp;#34;: &amp;#34;efs-0000&amp;#34;,
&amp;#34;Rules&amp;#34;: [
{
&amp;#34;RuleName&amp;#34;: &amp;#34;efs-0000&amp;#34;,
&amp;#34;TargetBackupVaultName&amp;#34;: &amp;#34;my-vault&amp;#34;,
&amp;#34;ScheduleExpression&amp;#34;: &amp;#34;cron(0 0 ? * * *)&amp;#34;,
&amp;#34;StartWindowMinutes&amp;#34;: 60,
&amp;#34;CompletionWindowMinutes&amp;#34;: 10080,
&amp;#34;Lifecycle&amp;#34;: {
&amp;#34;DeleteAfterDays&amp;#34;: 7
}
}
]
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Get the backup plan ID.&lt;/p&gt;</description></item><item><title>aws get account id</title><link>http://uly.me/posts/aws-get-account-id/</link><pubDate>Sat, 06 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-get-account-id/</guid><description>&lt;p&gt;Here’s a quick way to find the AWS Account ID via AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws sts get-caller-identity --query Account --output text
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output is a 12 digit number (redacted)&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;xxxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;AWS Account ID is a 12 digit number unique to each AWS account. Occasionally, there are scripts and policies that need the ID of the account. The command above is one way of querying the account ID so they can be used for policies that need them.&lt;/p&gt;</description></item><item><title>aws backup vaults</title><link>http://uly.me/posts/aws-backup-vaults/</link><pubDate>Fri, 05 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-backup-vaults/</guid><description>&lt;p&gt;Here’s how to list AWS Backup vaults and plans. You can filter the output by specifying a vault.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws backup list-backup-vaults --query &amp;#34;BackupVaultList[?BackupVaultName==&amp;#39;my-vault&amp;#39;]&amp;#34; --output json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output: (outputs are redacted for security reasons)&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[
{
&amp;#34;BackupVaultName&amp;#34;: &amp;#34;my-vault&amp;#34;,
&amp;#34;BackupVaultArn&amp;#34;: &amp;#34;arn:aws:backup:us-east-1:xxxxxxxxxxxx:backup-vault:my-vault&amp;#34;,
&amp;#34;CreationDate&amp;#34;: &amp;#34;2019-02-10T11:38:42.556000-05:00&amp;#34;,
&amp;#34;EncryptionKeyArn&amp;#34;: &amp;#34;arn:aws:kms:us-east-1:xxxxxxxxxxxx:key/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&amp;#34;,
&amp;#34;CreatorRequestId&amp;#34;: &amp;#34;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&amp;#34;,
&amp;#34;NumberOfRecoveryPoints&amp;#34;: 3
}
]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display the BackupPlanId of a specific backup plan.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws backup list-backup-plans --query &amp;#34;BackupPlansList[?BackupPlanName==&amp;#39;my-backup-plan&amp;#39;].BackupPlanId&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output: (outputs are redacted for security reasons)&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[
&amp;#34;xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&amp;#34;
]
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>count string characters</title><link>http://uly.me/posts/count-string-characters/</link><pubDate>Wed, 03 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/count-string-characters/</guid><description>&lt;p&gt;Here’s a simple little script that displays the number of characters in a string.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [[ $# -eq 0 ]] ; then echo &amp;#39;Missing arguments&amp;#39;; exit 0; fi
var=$1
size=${#var}
echo $size
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Command:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;./length.sh abcdefghijklmnopqrstuvwxyz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;26
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws copy ami to another region</title><link>http://uly.me/posts/aws-copy-ami-to-another-region/</link><pubDate>Tue, 02 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-copy-ami-to-another-region/</guid><description>&lt;p&gt;Here’s how to copy an AMI to another region.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 copy-image \
--source-image-id ami-xxxxxxxxxxx \
--source-region us-east-1 \
--region us-east-2 \
--name &amp;#34;My DR server&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;ImageId&amp;#34;: &amp;#34;ami-xxxxxxxxxxx&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws copy snapshot to another region</title><link>http://uly.me/posts/aws-copy-snapshot-to-another-region/</link><pubDate>Tue, 02 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-copy-snapshot-to-another-region/</guid><description>&lt;p&gt;If you need to copy a snapshot from one region to another, here’s the AWS CLI command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 copy-snapshot \
--region us-east-1 \
--source-region us-east-2 \
--source-snapshot-id snap-xxxxxxxxxxxxxxxxx \
--description &amp;#34;This is the DR snapshot copy&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;SnapshotId&amp;#34;: &amp;#34;snap-xxxxxxxxxxxxxxxxx&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp add new route</title><link>http://uly.me/posts/gcp-add-new-route/</link><pubDate>Tue, 02 Mar 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-add-new-route/</guid><description>&lt;p&gt;Here’s how to add a new route in Google Cloud Platform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute routes create name-of-new-route \
--destination-range=200.20.0.0/15 \
--next-hop-gateway=default-internet-gateway \
--project=host-project \
--network=&amp;#34;default&amp;#34; \
--priority=900
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list of projects</title><link>http://uly.me/posts/gcp-list-of-projects/</link><pubDate>Sun, 28 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-of-projects/</guid><description>&lt;p&gt;Here’s another way to list projects in a shared VPC.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute shared-vpc list-associated-resources your-shared-host
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;project1 PROJECT
project2 PROJECT
project3 PROJECT
...
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list of sql instances</title><link>http://uly.me/posts/gcp-list-of-sql-instances/</link><pubDate>Sun, 28 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-of-sql-instances/</guid><description>&lt;p&gt;Here’s how to list SQL instances within your GCP project.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud sql instances list --project your-project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;NAME DATABASE_VERSION LOCATION TIER PRIMARY_ADDRESS PRIVATE_ADDRESS STATUS
database1 SQLSERVER_2017_STANDARD us-central1-a db-n1-standard-1 - 10.10.10.11 RUNNABLE
database2 SQLSERVER_2017_STANDARD us-central1-c db-n1-standard-1 - 10.10.10.12 RUNNABLE
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws list machine images</title><link>http://uly.me/posts/aws-list-machine-images/</link><pubDate>Sat, 27 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-list-machine-images/</guid><description>&lt;p&gt;Here’s how to list AWS AMI (machine images) owned by yourself.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-images \
--query &amp;#34;Images[*].[Name,PlatformDetails]&amp;#34; \
--owners self \
--profile default \
--region us-east-1 \
--output text
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;icecast-0.1 Linux/UNIX
jekyll-0.3 Linux/UNIX
docker-0.1 Linux/UNIX
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Specifying owners as self only display images owned by you.&lt;/p&gt;</description></item><item><title>disable gutenberg</title><link>http://uly.me/posts/disable-gutenberg/</link><pubDate>Sat, 27 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/disable-gutenberg/</guid><description>&lt;p&gt;Two years ago, WordPress introduced Gutenberg block editor together with the release of WordPress version 5.0. Gutenberg essentially became the default editor starting with WordPress version 5.0. While many people love the Gutenberg editor, some people hate it. If you’re one of the many people who hate the Gutenberg editor, you can simply disable it by installing a plugin called Disable Gutenberg. This plugin will revert back to the classic editor.&lt;/p&gt;</description></item><item><title>logging commands</title><link>http://uly.me/posts/logging-commands/</link><pubDate>Mon, 22 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/logging-commands/</guid><description>&lt;p&gt;I decided to log my commands for good record keeping. Here’s my script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [[ $# -eq 0 ]] ; then echo &amp;#39;No arguments. Format: ./go.sh script.sh&amp;#39;; exit 0; fi
log=log.txt
echo &amp;#39;-------------------------------&amp;#39; &amp;gt;&amp;gt; $log
date &amp;gt;&amp;gt; $log
echo &amp;#39;---&amp;#39; &amp;gt;&amp;gt; $log
cat $1 &amp;gt;&amp;gt; $log
echo &amp;#39;---&amp;#39; &amp;gt;&amp;gt; $log
/bin/bash $1 2&amp;gt;&amp;amp;1 | tee -a $log
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To run.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;./go.sh script.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Line by line explanation.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Checks for script to run. Exits if there’s no argument.&lt;/li&gt;
&lt;li&gt;Sets the log file.&lt;/li&gt;
&lt;li&gt;Prints dashes.&lt;/li&gt;
&lt;li&gt;Prints the date.&lt;/li&gt;
&lt;li&gt;Print 3 dashes.&lt;/li&gt;
&lt;li&gt;Prints the commands to the log file.&lt;/li&gt;
&lt;li&gt;Print 3 dashes.&lt;/li&gt;
&lt;li&gt;Run the command. Send error and standard out to log file.&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>aws s3 bucket permission</title><link>http://uly.me/posts/aws-s3-bucket-permission/</link><pubDate>Tue, 16 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-bucket-permission/</guid><description>&lt;p&gt;I was getting this error when downloading a file from a S3 bucket.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Turns out to be a permission issue. Use –acl bucket-owner-full-control.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# UPLOAD
aws s3 cp file.txt s3://bucket-name/dir/ --acl bucket-owner-full-control
upload: .\file.txt to s3://bucket-name/dir/fw.sh
# DOWNLOAD
aws s3 cp s3://bucket-name/dir/file.txt . --acl bucket-owner-full-control
download: s3://bucket-name/dir/file.txt to .\file.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You need to do for both upload and download.&lt;/p&gt;</description></item><item><title>create a swap file</title><link>http://uly.me/posts/create-a-swap-file/</link><pubDate>Tue, 16 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-a-swap-file/</guid><description>&lt;p&gt;How to create a swap file.&lt;/p&gt;
&lt;p&gt;A 2GB swap file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dd if=/dev/zero of=/swapfile bs=1k count=2048k
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Activate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkswap /swapfile
chmod 0600 /swapfile
systemctl daemon-reload
swapon /swapfile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To make swap permanent, add to /etc/fstab.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/swapfile swap swap defaults 0 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check if swap is working.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cat /proc/swaps
free -h
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp firewall source service account</title><link>http://uly.me/posts/gcp-firewall-source-service-account/</link><pubDate>Tue, 16 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-firewall-source-service-account/</guid><description>&lt;p&gt;Here’s how to create a firewall from service account to service account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules create &amp;#34;firewall-name&amp;#34; \
--description=&amp;#34;firewall-description&amp;#34; \
--priority &amp;#34;1000&amp;#34; \
--direction INGRESS \
--action allow \
--network &amp;#34;network-name&amp;#34; \
--source-service-accounts=&amp;#34;service@account.net&amp;#34; \
--target-service-accounts=&amp;#34;service@account.net&amp;#34; \
--rules tcp:9001
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Instead of source-range, it’s using source-service-accounts.&lt;/p&gt;</description></item><item><title>aws spot instances running docker</title><link>http://uly.me/posts/aws-spot-instances-running-docker/</link><pubDate>Sun, 14 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-spot-instances-running-docker/</guid><description>&lt;p&gt;I have an AMI with docker installed. Here’s how I launch a spot instance using Terraform.&lt;/p&gt;
&lt;p&gt;Here’s my Terraform script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform {
required_providers {
aws = {
source = &amp;#34;hashicorp/aws&amp;#34;
}
}
}
provider &amp;#34;aws&amp;#34; {
profile = &amp;#34;default&amp;#34;
region = &amp;#34;us-east-1&amp;#34;
}
resource &amp;#34;aws_spot_instance_request&amp;#34; &amp;#34;docker&amp;#34; {
ami = &amp;#34;ami-xxxxxxxxxxxxxxxx&amp;#34;
spot_price = &amp;#34;0.0031&amp;#34;
wait_for_fulfillment = &amp;#34;true&amp;#34;
key_name = &amp;#34;servers&amp;#34;
instance_type = &amp;#34;t3.micro&amp;#34;
subnet_id = &amp;#34;subnet-xxxxxxxxxxxxxxxx&amp;#34;
security_groups = [&amp;#34;sg-xxxxxxxxxxxxxxxxxx&amp;#34;]
associate_public_ip_address = &amp;#34;true&amp;#34;
user_data =
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I use &amp;ldquo;aws_ec2_tag&amp;rdquo; resource to tag the instance properly.&lt;/p&gt;</description></item><item><title>reinstall kernel</title><link>http://uly.me/posts/reinstall-kernel/</link><pubDate>Tue, 09 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/reinstall-kernel/</guid><description>&lt;p&gt;How to reinstall the latest kernel and rebuild initramfs.&lt;/p&gt;
&lt;p&gt;Find the latest kernel.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -qa kernel
kernel-3.10.0-1160.6.1.el7.x86_64
kernel-3.10.0-1160.11.1.el7.x86_64
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remove the kernel first, then reinstall.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum remove kernel-3.10.0-1160.6.1.el7.x86_64
yum install kernel-3.10.0-1160.6.1.el7.x86_64
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>monitor disk performance</title><link>http://uly.me/posts/monitor-disk-performance/</link><pubDate>Thu, 04 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/monitor-disk-performance/</guid><description>&lt;p&gt;Here are a few utilities that monitor disk I/O performance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;iostat -d 5
pidstat -dl 20
iotop --only
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The alternative is atop, which you can set to run every 10 seconds for 3 hours. The output can be viewed later.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;atop -a -w logfile.atop 10 10800 &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use atop to read the log file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;atop -r /path/to/logfile.atop
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>terraform gcp instance</title><link>http://uly.me/posts/terraform-gcp-instance/</link><pubDate>Wed, 03 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-gcp-instance/</guid><description>&lt;p&gt;Here’s a Terraform script for launching an instance in Google Cloud Platform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;provider &amp;#34;google&amp;#34; {
project = &amp;#34;project-id&amp;#34;
region = &amp;#34;us-central1&amp;#34;
zone = &amp;#34;us-central1-a&amp;#34;
}
resource &amp;#34;google_compute_instance&amp;#34; &amp;#34;wiki&amp;#34; {
name = &amp;#34;wiki&amp;#34;
machine_type = &amp;#34;n2-standard-1&amp;#34;
zone = &amp;#34;us-central1-a&amp;#34;
tags = [&amp;#34;web-server&amp;#34;]
labels = {
name = &amp;#34;wiki&amp;#34;
environment = &amp;#34;development&amp;#34;
}
boot_disk {
initialize_params {
image = &amp;#34;centos-7-v20210122&amp;#34;
}
}
network_interface {
network = &amp;#34;default&amp;#34;
access_config {
}
}
service_account {
email = &amp;#34;service-account@email.com&amp;#34;
scopes = [&amp;#34;cloud-platform&amp;#34;]
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s a few Terraform commands.&lt;/p&gt;</description></item><item><title>cross account kms keys</title><link>http://uly.me/posts/cross-account-kms-keys/</link><pubDate>Tue, 02 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cross-account-kms-keys/</guid><description>&lt;p&gt;If you have multiple AWS accounts, you can setup a customer-managed KMS (key management service) in the AWS Key Management Service, to secure requests or services between the two AWS accounts. The customer-managed KMS key is tied to an identity such as an IAM user or role. In addition to users and roles, other AWS accounts can be added to grant access. KMS can be symmetric or asymmetric. It’s symmetric be default. To grant access to the other account, you need to add the AWS Account Id to the key. It’s 12 digit number unique to each AWS account.&lt;/p&gt;</description></item><item><title>install jekyll on amazon linux 2</title><link>http://uly.me/posts/install-jekyll-on-amazon-linux-2/</link><pubDate>Tue, 02 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-jekyll-on-amazon-linux-2/</guid><description>&lt;p&gt;Here’s the script to install Jekyll on Amazon Linux 2.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
sudo hostnamectl set-hostname jekyll
sudo yum update -y
sudo amazon-linux-extras install ruby2.4 -y
sudo yum install ruby ruby-devel -y
sudo yum groupinstall &amp;#34;Development Tools&amp;#34; -y
sudo gem install bundler
sudo gem install rdoc
sudo gem update --system
sudo gem install jekyll
jekyll new myblog
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To start the Jekyll server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd mysite
jekyll build
jekyll serve --host 0.0.0.0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Open your browser and point it to the external IP of your instance on port 4000.&lt;/p&gt;</description></item><item><title>checking yum transaction logs</title><link>http://uly.me/posts/checking-yum-transaction-logs/</link><pubDate>Mon, 01 Feb 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/checking-yum-transaction-logs/</guid><description>&lt;p&gt;Check if package is on the system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -q httpd
httpd-2.4.6-97.el7.centos.x86_64
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check the history logs.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum history list
Loaded plugins: fastestmirror
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
115 | System &amp;lt;unset&amp;gt; | 2021-02-01 03:40 | Update | 1
114 | System &amp;lt;unset&amp;gt; | 2021-02-01 02:03 | I, U | 10
113 | System &amp;lt;unset&amp;gt; | 2021-01-29 19:54 | Update | 1
112 | System &amp;lt;unset&amp;gt; | 2021-01-21 14:41 | Update | 1
&amp;lt;/unset&amp;gt;&amp;lt;/unset&amp;gt;&amp;lt;/unset&amp;gt;&amp;lt;/unset&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check detail transaction id.&lt;/p&gt;</description></item><item><title>install openjdk 8</title><link>http://uly.me/posts/install-openjdk-8/</link><pubDate>Sun, 31 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-openjdk-8/</guid><description>&lt;p&gt;Here’s the installation instructions for OpenJDK 8.&lt;/p&gt;
&lt;p&gt;For Fedora, Redhat and Oracle Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install java-1.8.0-openjdk
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For Debian and Ubuntu.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt-get install openjdk-8-jre
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To see if the packages (symbolic links) are there, they can be found in /etc/alternatives/, at least in Redhat 7.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ls -l /etc/alternatives/
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>restart rpc gssd service</title><link>http://uly.me/posts/restart-rpc-gssd-service/</link><pubDate>Sun, 31 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/restart-rpc-gssd-service/</guid><description>&lt;p&gt;If a Linux user is having an access problem with a NFS share, and particularly with key expiration, then check if the RPC GSSD service is up and running. NFS clients uses the RPCSEC_GSS protocol to establish security credentials with a NFS server using Kerberos authentication.&lt;/p&gt;
&lt;p&gt;Here’s an example of a key expire error due to a NFS client not authenticated properly.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;df -h
df: &amp;#39;/data/dir1&amp;#39;: Key has expired
df: &amp;#39;/data/dir2&amp;#39;: Key has expired
df: &amp;#39;/data/dir3&amp;#39;: Key has expired
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check if RPC GSSD service is healthy. Restart the service if there are credential errors.&lt;/p&gt;</description></item><item><title>aws ec2 list firewall rules</title><link>http://uly.me/posts/aws-ec2-list-firewall-rules/</link><pubDate>Tue, 26 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-ec2-list-firewall-rules/</guid><description>&lt;p&gt;AWS EC2 Firewall rules are defined within security groups. Security groups are attached to an instance. An instance can have up to 5 security groups. Essentially, this script gathers all the security groups associated with an instance, loops through them, and then outputs the ingress and egress rules of each security group to a file in a text format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# set variables
instanceid=&amp;#39;i-xxxxxxxxxxxxxxxx&amp;#39;
region=&amp;#39;us-east-1&amp;#39;
profile=&amp;#39;sample&amp;#39;
# log and temp files
output=&amp;#34;ec2-sg.log&amp;#34;
tmpfil=&amp;#34;ec2-sg.tmp&amp;#34;
# empty log at start
&amp;gt; $output
# get sg ids
aws ec2 describe-instances \
--instance-ids $instanceid \
--region $region \
--profile $profile \
--query &amp;#39;Reservations[*].Instances[*].SecurityGroups[*].[GroupId]&amp;#39; --output text &amp;gt; $tmpfil
while read -r id; do
echo &amp;#39;============================================&amp;#39; &amp;gt;&amp;gt; $output
echo $id &amp;gt;&amp;gt; $output
echo &amp;#39;============================================&amp;#39; &amp;gt;&amp;gt; $output
echo &amp;#39;---------------- INGRESS -------------------&amp;#39; &amp;gt;&amp;gt; $output
aws ec2 describe-security-groups \
--group-ids $id \
--profile $profile \
--region $region \
--output text \
--query &amp;#39;SecurityGroups[].IpPermissions[].[FromPort,ToPort,IpProtocol,IpRanges[].CidrIp[]|[0]]&amp;#39; &amp;gt;&amp;gt; $output
echo &amp;#39;---------------- EGRESS --------------------&amp;#39; &amp;gt;&amp;gt; $output
aws ec2 describe-security-groups \
--group-ids $id \
--profile $profile \
--region $region \
--output text \
--query &amp;#39;SecurityGroups[].IpPermissionsEgress[].[FromPort,ToPort,IpProtocol,IpRanges[].CidrIp[]|[0]]&amp;#39; &amp;gt;&amp;gt; $output
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here&amp;rsquo;s a sample output.&lt;/p&gt;</description></item><item><title>adding domains in certbot</title><link>http://uly.me/posts/adding-domains-in-certbot/</link><pubDate>Mon, 25 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/adding-domains-in-certbot/</guid><description>&lt;p&gt;You can register multiple domains to a single SSL certificate. This is particularly useful if you are hosting multiple domains on one server. This command adds more domains to your existing certificate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;certbot --expand -d existing.com -d newdomain1.com -d newdomain2.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check if the domains were added.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;certbot certificates
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Certbot certificates are valid for 90 days, but they automatically renew themselves if expiration is less than 30 days. If you need to renew manually for some odd reason, you can run this command. You can also perform a dry-run before renewing.&lt;/p&gt;</description></item><item><title>using or on regular expressions</title><link>http://uly.me/posts/using-or-on-regular-expressions/</link><pubDate>Thu, 21 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/using-or-on-regular-expressions/</guid><description>&lt;p&gt;Here’s a regex using the pipe symbol as OR to allow only 6 possible values.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;regex=&amp;#34;efs-(00|04|08|12|16|20)00&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Matches:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;efs-0000
efs-0400
efs-0800
efs-1200
efs-1600
efs-2000
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;No matches:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;efs-0100
efs-2200
efs-0600
efs-1400
efs-1800
efs-1110
111022
asdb023
2330asd
1200-efs
1205
abc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;$var is compared with $regex to find a match. $var is any of the variables above.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if [[ $var != $regex ]]; then
echo &amp;#34;Not a match&amp;#34;
else
echo &amp;#34;It&amp;#39;s a match&amp;#34;
fi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws efs create terraform</title><link>http://uly.me/posts/aws-efs-create-terraform/</link><pubDate>Mon, 18 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-efs-create-terraform/</guid><description>&lt;p&gt;Here’s how to build an EFS file system using Terraform. Create a main.tf file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform {
required_providers {
aws = {
version = &amp;#34;&amp;gt;= 3.22.0&amp;#34;
source = &amp;#34;hashicorp/aws&amp;#34;
}
}
}
provider &amp;#34;aws&amp;#34; {
profile = &amp;#34;default&amp;#34;
region = &amp;#34;us-east-1&amp;#34;
}
resource &amp;#34;aws_efs_file_system&amp;#34; &amp;#34;efs-test&amp;#34; {
creation_token = &amp;#34;efs-test&amp;#34;
performance_mode = &amp;#34;generalPurpose&amp;#34;
throughput_mode = &amp;#34;bursting&amp;#34;
encrypted = &amp;#34;true&amp;#34;
tags = {
Name = &amp;#34;efs-test&amp;#34;
}
}
resource &amp;#34;aws_efs_mount_target&amp;#34; &amp;#34;efs-mt-example&amp;#34; {
file_system_id = aws_efs_file_system.efs-test.id
subnet_id = &amp;#34;subnet-xxxxxxxxxxxxxxxxx&amp;#34;
security_groups = [&amp;#34;sg-xxxxxxxxxxxxxxxxxx&amp;#34;]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To launch, run terraform.&lt;/p&gt;</description></item><item><title>aws lightsail create terraform</title><link>http://uly.me/posts/aws-lightsail-create-terraform/</link><pubDate>Mon, 18 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-lightsail-create-terraform/</guid><description>&lt;p&gt;Here’s how to launch a LightSail instance using Terraform. Create a main.tf file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform {
required_providers {
aws = {
version = &amp;gt;= 3.22.0&amp;#34;
source = &amp;#34;hashicorp/aws&amp;#34;
}
}
}
provider &amp;#34;aws&amp;#34; {
profile = &amp;#34;default&amp;#34;
region = &amp;#34;us-east-1&amp;#34;
}
resource &amp;#34;aws_lightsail_instance&amp;#34; &amp;#34;yourinstance&amp;#34; {
name = &amp;#34;yourinstance&amp;#34;
availability_zone = &amp;#34;us-east-1a&amp;#34;
blueprint_id = &amp;#34;amazon_linux_2&amp;#34;
bundle_id = &amp;#34;nano_2_0&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To launch, run the following Terraform commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;terraform init
terraform apply
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>install docker on ubuntu 20.04 lts</title><link>http://uly.me/posts/install-docker-on-ubuntu-20-04-lts/</link><pubDate>Mon, 18 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-docker-on-ubuntu-20-04-lts/</guid><description>&lt;p&gt;Here’s the script how to install Docker on Ubuntu 20.04 LTS.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
sudo apt-get update
# install dependencies
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# add the gpg key for docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add the repository in the Linux mint 20
sudo add-apt-repository &amp;#34;deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo &amp;#34;$UBUNTU_CODENAME&amp;#34;) stable&amp;#34;
sudo apt-get update
# install docker e docker-compose
sudo add-apt-repository &amp;#34;deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo &amp;#34;$UBUNTU_CODENAME&amp;#34;) stable&amp;#34;
sudo apt-get -y install docker-ce docker-compose
# add the user system to sudo group, no sudo command
sudo usermod -aG docker $USER
# prints docker version =)
docker --version
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>efs tags auto assign backup tags</title><link>http://uly.me/posts/efs-tags-auto-assign-backup-tags/</link><pubDate>Sun, 17 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/efs-tags-auto-assign-backup-tags/</guid><description>&lt;p&gt;Here’s a script that scans all EFS systems in several AWS accounts and regions and randomly assigns backup tags to EFS systems that are missing backup tags. This is assuming EFS is using AWS Backup service using tags to apply backup policies. If there are no backup tags, an EFS gets assigned a randomly picked backup policy.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# log file
output=&amp;#34;test.log&amp;#34;
tmpfil=&amp;#34;temp.txt&amp;#34;
# empty file
&amp;gt; $output
# set random array
arr[0]=&amp;#34;efs-0000&amp;#34;
arr[1]=&amp;#34;efs-0400&amp;#34;
arr[2]=&amp;#34;efs-0800&amp;#34;
arr[3]=&amp;#34;efs-1200&amp;#34;
arr[4]=&amp;#34;efs-1600&amp;#34;
arr[5]=&amp;#34;efs-2000&amp;#34;
rand=$[ $RANDOM %6 ]
backup=${arr[$rand]}
# set accounts and regions
declare -a account=(&amp;#34;default&amp;#34; &amp;#34;one&amp;#34; &amp;#34;two&amp;#34; &amp;#34;three&amp;#34; &amp;#34;four&amp;#34; &amp;#34;five&amp;#34;)
declare -a region=(&amp;#34;us-east-1&amp;#34; &amp;#34;us-east-2&amp;#34; &amp;#34;us-west-1&amp;#34; &amp;#34;us-west-2&amp;#34;)
for i in &amp;#34;${account[@]}&amp;#34;; do
echo &amp;#34;===================&amp;#34; &amp;gt;&amp;gt; $output
echo $i &amp;gt;&amp;gt; $output
echo &amp;#34;===================&amp;#34; &amp;gt;&amp;gt; $output
for j in &amp;#34;${region[@]}&amp;#34;; do
echo $j &amp;gt;&amp;gt; $output
aws efs describe-file-systems \
--query &amp;#34;FileSystems[*].[FileSystemId,Tags[?Key==&amp;#39;aws-backup&amp;#39;]|[0].Value]&amp;#34; \
--profile $i \
--region $j \
--output text &amp;gt; $tmpfil
while read -r id tag; do
if [[ $tag == &amp;#34;&amp;#34; ]]; then
aws efs tag-resource \
--resource-id $id \
--tags Key=&amp;#34;aws-backup&amp;#34;,Value=${arr[$rand]} \
--profile $i \
--region $j &amp;gt;&amp;gt; $output
echo &amp;#34;Added backup tag $backup to $id&amp;#34; &amp;gt;&amp;gt; $output
elif [[ $tag == &amp;#34;no-backup&amp;#34; ]]; then
echo &amp;#34;Backup tag is already set to no-backup on $id.&amp;#34; &amp;gt;&amp;gt; $output
else
echo &amp;#34;No backup tag changes applied to $id.&amp;#34; &amp;gt;&amp;gt; $output
fi
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli contains</title><link>http://uly.me/posts/aws-cli-contains/</link><pubDate>Sat, 16 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-contains/</guid><description>&lt;p&gt;The AWS CLI has a not so well-known comparison operator called “contains” which can be used to filter or query the output of your results. In this example, we want to show only instances that were not terminated.&lt;/p&gt;
&lt;p&gt;Here’s a query containing “?!contains().”&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-instances \
--query &amp;#39;Reservations[*].Instances[?!contains(State.Name, `terminated`)].{Instance:InstanceId}&amp;#39;
--output text
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>setup log rotation</title><link>http://uly.me/posts/setup-log-rotation/</link><pubDate>Sat, 16 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/setup-log-rotation/</guid><description>&lt;p&gt;Logrotation is available in most Linux distros. If they are missing, you can easily install them. The logrotation main configuration file is located in /etc/logrotate.conf which is the default setting. The config file contains an include statement that pulls in other log configurations located in the /etc/logrotate.d/ directory. When setting up a log rotation, it’s best to add your log rotation configuration in this directory.&lt;/p&gt;
&lt;p&gt;Here’s a simple configuration in a file called webmon.&lt;/p&gt;</description></item><item><title>cloudformation userdata</title><link>http://uly.me/posts/cloudformation-userdata/</link><pubDate>Fri, 15 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cloudformation-userdata/</guid><description>&lt;p&gt;Here’s another way to add startup scripts to your instance during creation.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; UserData:
Fn::Base64: !Sub |
#cloud-config
repo_upgrade: none
runcmd:
# Cloud init startup script
- &amp;#34;bash /root/setup.sh&amp;#34;
write_files:
# Cloud init startup script
- owner: root:root
permissions: &amp;#39;0644&amp;#39;
path: /root/setup.sh
content: |
#! /bin/bash -x
write_files:
# Cloud init startup script
- owner: root:root
permissions: &amp;#39;0644&amp;#39;
path: /root/setup.sh
content: |
#! /bin/bash -x
# run your bash commands here
date &amp;gt; log.txt
uptime &amp;gt;&amp;gt; log.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The above script creates a file setup.sh and executes it during instance creation. The output is dumped to log.txt file.&lt;/p&gt;</description></item><item><title>create instance with alias ip</title><link>http://uly.me/posts/create-instance-with-alias-ip/</link><pubDate>Thu, 14 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-instance-with-alias-ip/</guid><description>&lt;p&gt;How to create an instance from a snapshot with alias IP and reserved IPs.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
gcloud beta compute instances create jump-server \
--network-interface=aliases=10.128.1.0/24,private-network-ip=jump-server,subnet=default \
--machine-type=n1-standard-1 \``
--network-tier=PREMIUM \
--maintenance-policy=MIGRATE \
--service-account=xxxxxxxxxxxxx-compute@developer.gserviceaccount.com \
--tags=int-webserver \
--image=debian-10-buster-v20201216 \
--image-project=debian-cloud \
--boot-disk-size=20GB \
--boot-disk-type=pd-standard \
--boot-disk-device-name=jump-server-1 \
--no-shielded-secure-boot \
--shielded-vtpm \
--shielded-integrity-monitoring \
--labels=name=jump-server \
--reservation-affinity=any \
--zone=us-central1-a \
--project=airy-totality-151318
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The default command uses –private-network-ip and –subnet options separately.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;--private-network-ip 10.0.0.24 \
--subnet=default \
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But when dealing with aliases, reserved IPs and subnets, use a single –network-interface option instead.&lt;/p&gt;</description></item><item><title>mounting duplicate uuids</title><link>http://uly.me/posts/mounting-duplicate-uuids/</link><pubDate>Tue, 12 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mounting-duplicate-uuids/</guid><description>&lt;p&gt;While trying to recover a directory from backup, I ran into an issue with duplicate uuids when trying to mount a recovered volume. The problem was the recovered volume had the same uuid as boot.&lt;/p&gt;
&lt;p&gt;Here’s the original mount command I ran, but I was getting a wrong fs type error.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir
mount -t xfs /dev/nvme3n1p2 /recover
mount: wrong fs type, bad option, bad superblock on /dev/nvme3n1p2,
missing codepage or helper program, or other error
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It turned out to be a duplicated uuid. To get around this problem, I ran -o nouuid.&lt;/p&gt;</description></item><item><title>gcp manually move instance</title><link>http://uly.me/posts/gcp-manually-move-instance/</link><pubDate>Sun, 10 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-manually-move-instance/</guid><description>&lt;p&gt;Here’s how to move a VM instance from one zone to another. Moving an instance will involve destroying the instance from the source zone, and then recreating a replacement instance in the destination zone. To make the move easier, we will use a machine image to recreate the instance. We will also take advantage of the compute and IP address reservations to guarantee that we use the same IP address machine type. Some large machine types are hard to come by.&lt;/p&gt;</description></item><item><title>top shift i</title><link>http://uly.me/posts/top-shift-i/</link><pubDate>Fri, 08 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/top-shift-i/</guid><description>&lt;p&gt;When you run top on Linux with multiple processors, you can have processes with percentages higher than 100%. On a 4 core system, you can have a process that can run as high as 400%. To view it differently, press “shift i” while top is running. This will toggle the Irix mode to off. Pressing it again will turn it on. When the Irix mode is off, it will only show percentages divided by a total number of CPUs. This way, you get a true percentage of a process in a multiple core system.&lt;/p&gt;</description></item><item><title>aws create backup plan</title><link>http://uly.me/posts/aws-create-backup-plan/</link><pubDate>Wed, 06 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-create-backup-plan/</guid><description>&lt;p&gt;After you created a backup vault, it’s time to create a backup plan. Here are a few examples.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws backup create-backup-plan \
--cli-input-json file://backup-plan.json \
--profile default \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;File: backup-plan.json&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;BackupPlan&amp;#34;: {
&amp;#34;BackupPlanName&amp;#34;: &amp;#34;efs-0123&amp;#34;,
&amp;#34;Rules&amp;#34;: [
{
&amp;#34;RuleName&amp;#34;: &amp;#34;efs-0123&amp;#34;,
&amp;#34;TargetBackupVaultName&amp;#34;: &amp;#34;efs-vault&amp;#34;,
&amp;#34;ScheduleExpression&amp;#34;: &amp;#34;cron(0 0 ? * * *)&amp;#34;,
&amp;#34;StartWindowMinutes&amp;#34;: 60,
&amp;#34;CompletionWindowMinutes&amp;#34;: 10080,
&amp;#34;Lifecycle&amp;#34;: {
&amp;#34;DeleteAfterDays&amp;#34;: 7
}
}
]
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Finally, create a backup selection.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws backup create-backup-selection \
--backup-plan-id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx \
--cli-input-json file://backup-selection.json \
--profile poc \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;File: backup-selection.json&lt;/p&gt;</description></item><item><title>aws create backup vault</title><link>http://uly.me/posts/aws-create-backup-vault/</link><pubDate>Wed, 06 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-create-backup-vault/</guid><description>&lt;p&gt;Here’s how to create a backup vault in AWS Backup.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws backup create-backup-vault --backup-vault-name my-efs-vault --profile default --region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To delete a vault, run this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws backup delete-backup-vault --backup-vault-name my-efs-vault --profile default --region us-east-1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>linux delete user</title><link>http://uly.me/posts/linux-delete-user/</link><pubDate>Wed, 06 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-delete-user/</guid><description>&lt;p&gt;Here’s how to delete a Linux user.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;userdel username
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete user and the home directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;userdel -f username
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>vintela troubleshooting</title><link>http://uly.me/posts/vintela-troubleshooting/</link><pubDate>Wed, 06 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vintela-troubleshooting/</guid><description>&lt;p&gt;Vintela is a utility for allowing AD users to login to Linux. Here are some basic troubleshooting tips.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#check version
vastool -v
# check status
vastool status
# start stop script
/etc/init.d/vasd start/stop/restart
# check user access
vastool user checkaccess username
# list users
vastool list users
# flush cache
vastool flush
# unjoin domain
vastool unjoin -f -l
# join domain
vastool -u username@domain.com -w password join -f -c OU=Linux,OU=linux,OU=Servers,DC=domain.com,DC=net domain.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Important files.&lt;/p&gt;</description></item><item><title>aws efs tags</title><link>http://uly.me/posts/aws-efs-tags/</link><pubDate>Mon, 04 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-efs-tags/</guid><description>&lt;p&gt;This script add new tags if they are missing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
log=&amp;#34;log.txt&amp;#34;
id=$(aws efs describe-file-systems --query &amp;#34;FileSystems[*].[FileSystemId]&amp;#34; --output text --region us-east-1)
tag=$(aws efs describe-file-systems --query &amp;#34;FileSystems[*].Tags[?Key==&amp;#39;aws-backup&amp;#39;].Value&amp;#34; --output text --region us-east-1 )
arr[0]=&amp;#34;efs-0000&amp;#34;
arr[1]=&amp;#34;efs-0400&amp;#34;
arr[2]=&amp;#34;efs-0800&amp;#34;
arr[3]=&amp;#34;efs-1200&amp;#34;
arr[4]=&amp;#34;efs-1600&amp;#34;
arr[5]=&amp;#34;efs-2000&amp;#34;
rand=$[ $RANDOM %6 ]
backup=${arr[$rand]}
if [[ $tag == &amp;#34;&amp;#34; ]]; then
aws efs tag-resource --resource-id $id --tags Key=&amp;#34;aws-backup&amp;#34;,Value=${arr[$rand]} --profile default --region us-east-1
echo &amp;#34;Added backup tag $backup to $id&amp;#34;
elif [[ $tag == &amp;#34;no-backup&amp;#34; ]]; then
echo &amp;#34;No backup on $id.&amp;#34;
else
echo &amp;#34;No changes done to $id.&amp;#34;
fi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli display tags</title><link>http://uly.me/posts/aws-cli-display-tags/</link><pubDate>Sat, 02 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-display-tags/</guid><description>&lt;p&gt;This command lists the EC2 instance id and the tag name using query.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-instances \
--query &amp;#39;Reservations[].Instances[].[InstanceId,Tags[?Key==Name]|[0].Value]&amp;#39; \
--profile tfc \
--region us-east-2 \
--output text
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;i-xxxxxxxxxxxxxxxxx server-one
i-xxxxxxxxxxxxxxxxx server-two
i-xxxxxxxxxxxxxxxxx server-three
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;|[0].Value insures output is one instance record per line.&lt;/p&gt;</description></item><item><title>aws lightsail blueprints</title><link>http://uly.me/posts/aws-lightsail-blueprints/</link><pubDate>Fri, 01 Jan 2021 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-lightsail-blueprints/</guid><description>&lt;p&gt;&lt;a href="https://aws.amazon.com/lightsail/"&gt;Amazon Lightsail&lt;/a&gt; offers a variety of OS blueprints, starting from Amazon Linux 2, Ubuntu 20, Windows Server 2019 to Debian 10 to name just a few. Blueprints are a curated selection of operating systems and software that are preinstalled for the creation of instances. For brevity, only a subset of blueprints are displayed below. The description and licenseUrl portions are truncated. To display an entire list of LightSail blueprints, run this command.&lt;/p&gt;</description></item><item><title>mysql select like</title><link>http://uly.me/posts/mysql-select-like/</link><pubDate>Sun, 27 Dec 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mysql-select-like/</guid><description>&lt;p&gt;Here’s how to perform SQL searches using the like operator.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Format
SELECT column1, column2 FROM table_name WHERE column LIKE pattern;
# Search for an entry starting with a &amp;#39;joe.&amp;#39;
SELECT id,username,address FROM users WHERE username LIKE &amp;#39;joe%&amp;#39;;
# Search for an entry ending with a &amp;#39;joe.&amp;#39;
SELECT id,username,address FROM users WHERE username LIKE &amp;#39;%joe&amp;#39;;
# Search for any entry with &amp;#39;joe&amp;#39; from any position.
SELECT id,username,address FROM users WHERE username LIKE &amp;#39;%joe%&amp;#39;;
# Finally, using &amp;#34;_&amp;#34; as wildcards. Find any field with &amp;#34;j&amp;#34; in the second position.
SELECT id,username,address FROM users WHERE username LIKE &amp;#39;_j&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cloudshell</title><link>http://uly.me/posts/aws-cloudshell/</link><pubDate>Thu, 24 Dec 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cloudshell/</guid><description>&lt;p&gt;AWS just added a new feature called CloudShell. It will give users who are logged in to the AWS console access to a VM where users can run AWS CLI commands. Permissions to AWS resources is based on the user’s permissions which are managed via IAM. CloudShell is similar to the cloud shells that Azure and GCP already offer. Here’s a snapshot of AWS CloudShell.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://uly.me/wp-content/uploads/2020/12/cloudshell.png"&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2020/12/cloudshell.png"&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>yum localinstall</title><link>http://uly.me/posts/yum-localinstall/</link><pubDate>Thu, 24 Dec 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yum-localinstall/</guid><description>&lt;p&gt;Here’s how to install a RPM locally. Download the RPM first.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;wget https://domain.com/path/to/file/rpmfile1.rpm
wget https://domain.com/path/to/file/rpmfile2.rpm
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then install RPM from a local file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum localinstall /path/to/rpmfile1.rpm
yum localinstall /path/to/rpmfile2.rpm
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>adding new users in powershell</title><link>http://uly.me/posts/adding-new-users-in-powershell/</link><pubDate>Wed, 23 Dec 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/adding-new-users-in-powershell/</guid><description>&lt;p&gt;Here’s an easy way to add Windows users in Powershell.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;net user username &amp;#39;password&amp;#39; /add
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Passwords must meet &lt;a href="https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/password-must-meet-complexity-requirements"&gt;requirements&lt;/a&gt;. While you are at it, give it Admin rights.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;net localgroup Administrators username /add
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>reboot instance script</title><link>http://uly.me/posts/reboot-instance-script/</link><pubDate>Mon, 21 Dec 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/reboot-instance-script/</guid><description>&lt;p&gt;Here’s a new script to reboot a Lightsail instance based on input.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
echo &amp;#39;Choose a server to reboot ...&amp;#39;
echo &amp;#39;1) server-one&amp;#39;
echo &amp;#39;2) server-two&amp;#39;
echo &amp;#39;3) server-three&amp;#39;
echo &amp;#39;4) server-four&amp;#39;
echo &amp;#39;5) sever-five&amp;#39;
echo &amp;#39;q) Quit&amp;#39;
read -p &amp;#39;Choose a server to reboot: &amp;#39; server
case $server in
1)
echo &amp;#39;Rebooting server-one ...&amp;#39;
aws lightsail reboot-instance --instance-name server-one
echo &amp;#39;Done&amp;#39;
;;
2)
echo &amp;#39;Rebooting server-two ...&amp;#39;
aws lightsail reboot-instance --instance-name server-two
echo &amp;#39;Done&amp;#39;
;;
3)
echo &amp;#39;Rebooting server-three ...&amp;#39;
aws lightsail reboot-instance --instance-name server-three
echo &amp;#39;Done&amp;#39;
;;
4)
echo &amp;#39;Rebooting server-four ...&amp;#39;
aws lightsail reboot-instance --instance-name server-four
echo &amp;#39;Done&amp;#39;
;;
5)
echo &amp;#39;Rebooting server-five ...&amp;#39;
aws lightsail reboot-instance --instance-name server-five
echo &amp;#39;Done&amp;#39;
;;
q)
echo &amp;#39;Quit&amp;#39;
;;
*)
echo &amp;#39;Invalid option&amp;#39; $server
;;
esac
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Assuming awscli is working and correct permission is granted to user.&lt;/p&gt;</description></item><item><title>httpd on redhat and centos</title><link>http://uly.me/posts/httpd-on-redhat-centos/</link><pubDate>Fri, 04 Dec 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/httpd-on-redhat-centos/</guid><description>&lt;p&gt;Here are the commands to start, stop, enable and get the status of Apache on RHEL and CentOS.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl enable httpd # enable on bootup
systemctl status httpd # get status
systemctl start httpd # start
systemctl stop httpd # stop
systemctl restart httpd # restart
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>add existing user to a group</title><link>http://uly.me/posts/add-existing-user-to-a-group/</link><pubDate>Thu, 03 Dec 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-existing-user-to-a-group/</guid><description>&lt;p&gt;Here’s how to add an existing user to a user group in Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;usermod -a -G groupname username
usermod -a -G www-data john
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List all users belonging to a group.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lid -g www-data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List all the groups the user belongs to.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;groups john
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>efs encryption</title><link>http://uly.me/posts/efs-encryption/</link><pubDate>Thu, 03 Dec 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/efs-encryption/</guid><description>&lt;p&gt;If you have an existing EFS that’s unencrypted, you can encrypt it be creating a snapshot using AWS Backup, and then restoring the file system to a new EFS with encryption. If you choose to restore in a directory in the same file system, it will not be encrypted. It has to be a new EFS. In addition, you’ll be asked to select which encryption key to use. The default key will work, unless you have your own.&lt;/p&gt;</description></item><item><title>mysql read only</title><link>http://uly.me/posts/mysql-read-only-2/</link><pubDate>Mon, 30 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mysql-read-only-2/</guid><description>&lt;p&gt;If you need to perform backup or replicate a database, you can lock up the database by doing a global read block to make it read-only.&lt;/p&gt;
&lt;p&gt;The process is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make the server read-only, so that it processes only retrievals and blocks updates.&lt;/li&gt;
&lt;li&gt;You can then perform the backup.&lt;/li&gt;
&lt;li&gt;Change the server back to its normal read/write state.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Read only.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;FLUSH TABLES WITH READ LOCK;
SET GLOBAL read_only = ON;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Back to normal mode.&lt;/p&gt;</description></item><item><title>change mysql user password</title><link>http://uly.me/posts/change-mysql-user-password/</link><pubDate>Sun, 29 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-mysql-user-password/</guid><description>&lt;p&gt;This is a very simple command to run. Login to MySQL first and run the following the command line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ALTER USER username IDENTIFIED BY &amp;#39;password&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Flush privileges for changes to take effect.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;flush privileges;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>running mysql commands from the terminal</title><link>http://uly.me/posts/test-2/</link><pubDate>Sun, 29 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/test-2/</guid><description>&lt;p&gt;You can run MySQL commands from the terminal by using -e switch. Here are a few examples.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql -u username -p -e &amp;#34;create database mydb&amp;#34;
mysql -u username -p -e &amp;#34;use mydb&amp;#34;
mysql -u username -p database -e &amp;#34;select * from mytable&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you have .mycnf configured, you can omit the username and password.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql -e &amp;#34;create database mydb&amp;#34;
mysql -e &amp;#34;use mydb&amp;#34;
mysql -e &amp;#34;select * from mytable&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To run multiple commands from a single line, separate the commands using a semicolon.&lt;/p&gt;</description></item><item><title>wordpress read only</title><link>http://uly.me/posts/test/</link><pubDate>Sun, 29 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/test/</guid><description>&lt;p&gt;Here’s how to create a WordPress site that’s read only. You will not be able to create, update and delete posts.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Login to MySQL or MariaDB.&lt;/li&gt;
&lt;li&gt;Choose mysql database.&lt;/li&gt;
&lt;li&gt;Create a new user called ‘wpro’ for WordPress read only.&lt;/li&gt;
&lt;li&gt;Grant select permissions to all tables in ‘wordpress’ database.&lt;/li&gt;
&lt;li&gt;Flush privileges to commit your changes.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mariadb -u root -p
use mysql;
create user &amp;#39;wpro&amp;#39;@&amp;#39;localhost&amp;#39; identified by &amp;#39;yourpassword&amp;#39;;
grant select on wordpress.* to &amp;#39;wpro&amp;#39;@&amp;#39;localhost&amp;#39;;
flush privileges;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In MySQL or MariaDB, you have to terminate all commands with a semicolon.&lt;/p&gt;</description></item><item><title>copy a symbolic link</title><link>http://uly.me/posts/copy-a-symbolic-link/</link><pubDate>Fri, 27 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/copy-a-symbolic-link/</guid><description>&lt;p&gt;Here’s how to copy a symbolic link which is also known as a soft link from one directory to another. A regular copy command will not work. You will need to use the -P option to copy the symbolic link from one directory to another. If omitted, the symbolic links will not be copied.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cp -P /directory1/* /directory2/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;How to create a symbolic link.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ln -s sourcefile myfile
ln -s /path/to/file myfile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here are the man pages for &lt;a href="https://man7.org/linux/man-pages/man1/ln.1.html"&gt;ln&lt;/a&gt; and for &lt;a href="https://linux.die.net/man/1/cp"&gt;cp&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>check network promiscuous mode</title><link>http://uly.me/posts/check-network-promiscuous-mode/</link><pubDate>Mon, 23 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-network-promiscuous-mode/</guid><description>&lt;p&gt;Promiscuous mode is a mode for a network interface where the controller to passes all traffic it receives to the CPU instead of passing the frames to the controller. This is helpful if you want to capture all traffic as part of troubleshooting. The question is, how can you tell if your network interface is in a promiscuous mode? Here’s a couple of commands.&lt;/p&gt;
&lt;p&gt;Here’s the default mode.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo ip link show eth0
2: eth0: &amp;lt;broadcast&amp;gt; mtu 1460 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
&amp;lt;/broadcast&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s promiscuous mode. Look for PROMISC.&lt;/p&gt;</description></item><item><title>iotop</title><link>http://uly.me/posts/iotop/</link><pubDate>Sun, 22 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/iotop/</guid><description>&lt;p&gt;iotop is a Linux command similar to top but instead of CPU and memory it will display and monitor your disk IO usage.&lt;/p&gt;
&lt;p&gt;To install, run the following command based on your Linux ditro.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install iotop
apt install iotop
dnf install iotop
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To use.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;iotop
iotop -o
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2020/11/iotop.png"&gt;&lt;/p&gt;</description></item><item><title>mysql read only</title><link>http://uly.me/posts/mysql-read-only/</link><pubDate>Sun, 22 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mysql-read-only/</guid><description>&lt;p&gt;Here’s how to make a MySQL database read only.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql&amp;gt; FLUSH TABLES WITH READ LOCK;
mysql&amp;gt; SET GLOBAL read_only = ON;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It’s very useful if creating a replica database.&lt;/p&gt;</description></item><item><title>filter output of lsblk</title><link>http://uly.me/posts/filter-output-of-lsblk/</link><pubDate>Fri, 20 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/filter-output-of-lsblk/</guid><description>&lt;p&gt;Here’s one way to display block devices, mountpoints and size using lsblk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsblk -a -p -n -d -e 230 -o NAME,MOUNTPOINT,SIZE
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here are the options.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;-a = list all empty devices&lt;/li&gt;
&lt;li&gt;-p = print full device paths&lt;/li&gt;
&lt;li&gt;-d = do not print holder devices or slaves&lt;/li&gt;
&lt;li&gt;-e = exclude devices as by a comma-separate list&lt;/li&gt;
&lt;li&gt;-o = specify which columns to print, e.g. NAME,MOUNTPOINT,SIZE&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The output.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/dev/sda 30G
/dev/sdb /data 50G
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the &lt;a href="https://linux.die.net/man/8/lsblk"&gt;man page&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>sendgrid with wordpress</title><link>http://uly.me/posts/sendgrid-with-wordpress/</link><pubDate>Wed, 18 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sendgrid-with-wordpress/</guid><description>&lt;p&gt;If your instance is not configured to send out email, you have several options to choose from. One option is to use a service called SendGrid. You can sign up on their site and obtain an API key. To start using with WordPress, you simply install a plugin called WP Mail SMTP and supply the API key on the plugin and off you go. I use Contact Form 7 to send out email from a form. There are no issues using Contact Form 7 and SendGrid. In addition to SendGrid, the plugin also works with other email providers such as AWS, Gmail, Outlook, Zoho, Mailgun to name just a few.&lt;/p&gt;</description></item><item><title>encrypt samba share</title><link>http://uly.me/posts/encrypt-samba-share/</link><pubDate>Mon, 16 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/encrypt-samba-share/</guid><description>&lt;p&gt;Here’s how to turn on Samba encryption on a share.&lt;/p&gt;
&lt;p&gt;Edit /etc/samba/smb.conf on the Samba server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[global]
server max protocol = SMB3
smb encrypt = required
lanman auth = no
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Edit /etc/samba/smb.conf on the Samba clients.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[global]
smb encrypt = required
client min protocol = SMB2
client max protocol = SMB3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To connect.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;smbclient -e -m SMB3 //xxx.xxx.xxx.xxx/share-name -U username
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ebs volume stuck in cloudformation</title><link>http://uly.me/posts/ebs-volume-stuck-in-cloudformation/</link><pubDate>Thu, 12 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ebs-volume-stuck-in-cloudformation/</guid><description>&lt;p&gt;When running CloudFormation, all the resources are being created with no problem. However it seems to be getting stuck at creating or mounting a volume. The CloudFormation fails and initiates a rollback. This is the error I am getting.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Volume attachment between volume-id vol-xxxxxxxx and instance-id i-xxxxxxx at device /dev/xvda is attaching
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This turned out to be a conflict on HVM EC2 instances because /dev/sda1 is being remapped to /dev/xvda. My second drive is also mapped to /dev/xvda. The fix was to simply to map it slightly different to avoid mapping conflict.&lt;/p&gt;</description></item><item><title>aws cli using query</title><link>http://uly.me/posts/aws-cli-using-query/</link><pubDate>Wed, 11 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-using-query/</guid><description>&lt;p&gt;Instead of using AWS and JQ to get the snapshot names, you can do it with a single command using –query.&lt;/p&gt;
&lt;p&gt;Here are the previous commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/usr/bin/aws lightsail get-instance-snapshots --region us-east-1 --profile default &amp;gt; $snaps
cat $snaps | jq -r &amp;#39;.instanceSnapshots[] | .name&amp;#39; &amp;gt; $names
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Using query.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail get-instance-snapshots \
--query &amp;#39;instanceSnapshots[*].[name]&amp;#39; \
--region us-east-1 \
--profile default \
--output text &amp;gt; $names
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sensor checks for crowdstrike</title><link>http://uly.me/posts/sensor-checks-for-crowdstrike/</link><pubDate>Wed, 11 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sensor-checks-for-crowdstrike/</guid><description>&lt;p&gt;Here’s the Crowdstrike Falcon Sensor checks.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [ -e /etc/redhat-release ] ; then
if egrep -q &amp;#39;Ootpa|CentOS Linux release 8&amp;#39; /etc/redhat-release ; then
OSver=&amp;#34;el8&amp;#34;
elif egrep -q &amp;#39;Maipo|CentOS Linux release 7&amp;#39; /etc/redhat-release ; then
OSver=&amp;#34;el7&amp;#34;
elif egrep -q &amp;#39;Santiago|CentOS release 6&amp;#39; /etc/redhat-release ; then
OSver=&amp;#34;el6&amp;#34;
fi
fi
if [ -e /etc/os-release ] ; then
if grep VERSION /etc/os-release | grep -q 15 ; then
OSver=&amp;#34;suse15&amp;#34;
elif grep VERSION /etc/os-release | grep -q 12 ; then
OSver=&amp;#34;suse12&amp;#34;
elif grep VERSION /etc/os-release | grep -q 11 ; then
OSver=&amp;#34;suse11&amp;#34;
elif grep -q &amp;#39;Linux 2&amp;#39; /etc/os-release ; then
OSver=&amp;#34;amzn2&amp;#34;
elif grep -q &amp;#39;AMI&amp;#39; /etc/os-release ; then
OSver=&amp;#34;amzn1&amp;#34;
fi
fi
if [[ -f &amp;#34;/opt/CrowdStrike/falconctl&amp;#34; ]]; then
case $OSver in
suse15)
if [ -z &amp;#34;$(ss -tapn | grep falcon)&amp;#34; ]; then message=&amp;#34;Not Connected&amp;#34;; else message=&amp;#34;Connected&amp;#34;; fi
if systemctl is-active --quiet falcon-sensor; then status=&amp;#34;Running&amp;#34;; else status=&amp;#34;Stopped&amp;#34;; fi
;;
suse12)
if [ -z &amp;#34;$(ss -tapn | grep falcon)&amp;#34; ]; then message=&amp;#34;Not Connected&amp;#34;; else message=&amp;#34;Connected&amp;#34;; fi
if systemctl is-active --quiet falcon-sensor; then status=&amp;#34;Running&amp;#34;; else status=&amp;#34;Stopped&amp;#34;; fi
;;
suse11)
if [ -z &amp;#34;$(ss -tapn | grep falcon)&amp;#34; ]; then message=&amp;#34;Not Connected&amp;#34;; else message=&amp;#34;Connected&amp;#34;; fi
if (( $(ps -ef | grep -v grep | grep falcon-sensor | wc -l) &amp;gt; 0 )); then status=&amp;#34;Running&amp;#34;; else status=&amp;#34;Stopped&amp;#34;; fi
;;
el8)
if [ -z &amp;#34;$(netstat -tapn | grep falcon)&amp;#34; ]; then message=&amp;#34;Not Connected&amp;#34;; else message=&amp;#34;Connected&amp;#34;; fi
if systemctl is-active --quiet falcon-sensor; then status=&amp;#34;Running&amp;#34;; else status=&amp;#34;Stopped&amp;#34;; fi
;;
el7)
if [ -z &amp;#34;$(netstat -tapn | grep falcon)&amp;#34; ]; then message=&amp;#34;Not Connected&amp;#34;; else message=&amp;#34;Connected&amp;#34;; fi
if systemctl is-active --quiet falcon-sensor; then status=&amp;#34;Running&amp;#34;; else status=&amp;#34;Stopped&amp;#34;; fi
;;
el6)
if [ -z &amp;#34;$(netstat -tapn | grep falcon)&amp;#34; ]; then message=&amp;#34;Not Connected&amp;#34;; else message=&amp;#34;Connected&amp;#34;; fi
if (( $(ps -ef | grep -v grep | grep falcon-sensor | wc -l) &amp;gt; 0 )); then status=&amp;#34;Running&amp;#34;; else status=&amp;#34;Stopped&amp;#34;; fi
;;
amzn2)
if [ -z &amp;#34;$(netstat -tapn | grep falcon)&amp;#34; ]; then message=&amp;#34;Not Connected&amp;#34;; else message=&amp;#34;Connected&amp;#34;; fi
if systemctl is-active --quiet falcon-sensor; then status=&amp;#34;Running&amp;#34;; else status=&amp;#34;Stopped&amp;#34;; fi
;;
amzn1)
if [ -z &amp;#34;$(netstat -tapn | grep falcon)&amp;#34; ]; then message=&amp;#34;Not Connected&amp;#34;; else message=&amp;#34;Connected&amp;#34;; fi
if (( $(ps -ef | grep -v grep | grep falcon-sensor | wc -l) &amp;gt; 0 )); then status=&amp;#34;Running&amp;#34;; else status=&amp;#34;Stopped&amp;#34;; fi
;;
*)
;;
esac
else
message=&amp;#34;Not installed&amp;#34;
fi
if [[ -f &amp;#34;/opt/CrowdStrike/falconctl&amp;#34; ]]; then
version=$(/opt/CrowdStrike/falconctl -g --version | awk &amp;#39;{print $3}&amp;#39;)
else
version=&amp;#34;Not installed&amp;#34;
fi
if [ &amp;#34;$version&amp;#34; == &amp;#34;Not installed&amp;#34; ]; then status=&amp;#34;Not installed&amp;#34;; fi
echo $version &amp;#39;|&amp;#39; $status &amp;#39;|&amp;#39; $message
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>audit log files</title><link>http://uly.me/posts/audit-log-files/</link><pubDate>Tue, 10 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/audit-log-files/</guid><description>&lt;p&gt;The /var/log/audit/audit.log files were not being rotated. The files in the directory grew so large that it created disk space issues on /. Here’s the fix. In the /etc/audit/auditd.conf file, change max_log_file_action from “ignore” to “rotate.” Instead of hundreds of files being kept, it will be rotated up to 5 files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;max_log_file_action = rotate
num_logs = 5
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart service to take effect. The old files will be deleted.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service auditd stop
service auditd start
service auditd status
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disk space went from 82% down to 25%.&lt;/p&gt;</description></item><item><title>ubuntu 20.04 lts lamp server</title><link>http://uly.me/posts/ubuntu-20-04-lts-lamp-server/</link><pubDate>Tue, 10 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ubuntu-20-04-lts-lamp-server/</guid><description>&lt;p&gt;Here’s how to install a LAMP server on the latest Ubuntu 20.04 LTS.&lt;/p&gt;
&lt;p&gt;Install Apache.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install apache2
systemctl status apache2
systemctl is-enabled apache2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install MariaDB.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install mariadb-server mariadb-client
systemctl status mariadb
systemctl is-enabled mariadb
mysql_secure_installation
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install PHP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install php libapache2-mod-php php-mysql
systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Enable ssl and mod_rewrite.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;a2enmod ssl
a2enmod rewrite
systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>tar list of files</title><link>http://uly.me/posts/tar-list-of-files/</link><pubDate>Sun, 08 Nov 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tar-list-of-files/</guid><description>&lt;p&gt;Here’s another way of creating a tar ball from a list of files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar -cvf backup.tar.gz a.txt b.txt c.txt d.txt e.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s how to view files in a tarball.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar -tvf backup.tar.gz
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp ssl certificates</title><link>http://uly.me/posts/gcp-ssl-certificates/</link><pubDate>Thu, 29 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-ssl-certificates/</guid><description>&lt;p&gt;Here’s how to create a regional SSL Certificate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssl-certificates create my-ssl-cert \
--description &amp;#34;describe ssl certificate&amp;#34; \
--domains=domain1.com,domain2.com \
--certificate=cert.pem \
--private-key=private.key \
--region=us-central1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List the SSL certificates.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssl-certificates list --project=project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Describe the SSL certificate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssl-certificates describe my-ssl-cert \
--region=us-central1 \
--project=project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete SSL certificate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute ssl-certificates delete my-ssl-cert \
--region=us-central1 \
--project=project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>check if domain joined</title><link>http://uly.me/posts/check-if-domain-joined/</link><pubDate>Wed, 28 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-if-domain-joined/</guid><description>&lt;p&gt;Here’s the command to check if instance is domain joined.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;realm discover domain.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To check if AD user is working.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;id user@ad.example.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To check if AD group is working.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;getent group ad-group
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>scp with a key</title><link>http://uly.me/posts/scp-with-a-key/</link><pubDate>Thu, 22 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/scp-with-a-key/</guid><description>&lt;p&gt;SCP is a secure copy utility in Linux. You’ll need access to your system. In this example, a pem key is used to authenticate to a host. SCP copies filename.ext to the home directory of ec2-user. It’s important to add the target directory, otherwise it will not work.&lt;/p&gt;
&lt;p&gt;Here’s how to use SCP with a key from local to server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;scp -i key.pem filename.ext user@server:/home/user
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;From server to local. Run the command from local machine.&lt;/p&gt;</description></item><item><title>aws s3 make object public</title><link>http://uly.me/posts/aws-s3-make-object-public/</link><pubDate>Wed, 21 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-make-object-public/</guid><description>&lt;p&gt;Copy object or file to S3 bucket.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3 cp filename.ext s3://bucketname/ --profile your-profile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To make it publicly available, run this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3api put-object-acl \
--bucket bucket-name \
--key filename.ext \
--acl public-read \
--profile your-profile
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>openssl upgrade</title><link>http://uly.me/posts/openssl-upgrade/</link><pubDate>Mon, 19 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/openssl-upgrade/</guid><description>&lt;p&gt;Here’s how to upgrade to OpenSSL 1.1 on Redhat/Centos.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# check
openssl version
yum info openssl
# download and install
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz
tar -zxf openssl-1.0.2-latest.tar.gz
# compile
cd openssl-1.0.2a
./config
make
make test
make install
# update softlink
mv /usr/bin/openssl /root/
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
# verify new version
openssl version
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ssh script</title><link>http://uly.me/posts/ssh-script/</link><pubDate>Thu, 15 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ssh-script/</guid><description>&lt;p&gt;Here’s my custom ssh script named login.sh using multiple arguments.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [ $# -eq 0 ]
then
echo &amp;#39;no server supplied&amp;#39;
exit 1
fi
INPUT=$2
case &amp;#34;$INPUT&amp;#34; in
abc)
ssh user1@$1
;;
def)
ssh user2@$1
;;
*)
ssh user3@$1
;;
esac
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;How to use with expected outputs.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;./login.sh
no server supplied
./login.sh server3 abc
ssh user1@server3
./login.sh server2 def
ssh user2@server2
./login.sh server1
ssh user3@server1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws enable enhance network support</title><link>http://uly.me/posts/aws-enable-enhance-network-support/</link><pubDate>Tue, 13 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-enable-enhance-network-support/</guid><description>&lt;p&gt;When changing machine types, you may be asked to enable the latest ENA driver for Enhanced Network Support on an Amazon EC2 instance. There are several instructions depending on the Linux OS flavor. Here are the instructions to &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html#enhanced-networking-ena-linux"&gt;enable&lt;/a&gt;. In some cases, you may need to &lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/install-ena-driver-rhel-ec2/"&gt;rebuild the kernel module&lt;/a&gt;. To verify that the ena module is installed, use the modinfo command as shown in the following example.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;modinfo ena
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You also may have to enable the enhanced networking attribute on the instance.&lt;/p&gt;</description></item><item><title>aws s3 acceleration cli</title><link>http://uly.me/posts/aws-s3-acceleration-cli/</link><pubDate>Sun, 04 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-acceleration-cli/</guid><description>&lt;p&gt;Here is how to enable Amazon S3 Transfer Acceleration on a S3 bucket.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3api put-bucket-accelerate-configuration \
--bucket bucketname \
--accelerate-configuration Status=Enabled \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use an accelerate endpoint.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws configure set default.s3.use_accelerate_endpoint true
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To copy files to S3 you can use the default copy.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3 cp file.txt s3://bucketname/keyname \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or use the acceleration endpoint.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws configure set s3.addressing_style virtual
aws s3 cp file.txt s3://bucketname/keyname \
--endpoint-url http://s3-accelerate.amazonaws.com \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws update acm certs</title><link>http://uly.me/posts/aws-update-acm-certs/</link><pubDate>Sun, 04 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-update-acm-certs/</guid><description>&lt;p&gt;Here’s how to update AWS Certificate Manager SSL Cert.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
cd /etc/letsencrypt/live/domain.com/
arn=&amp;#39;arn:aws:acm:us-east-1:xxxxxxxxxxxx:certificate/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&amp;#39;
aws acm import-certificate \
--certificate fileb://cert.pem \
--certificate-chain fileb://chain.pem \
--private-key fileb://privkey.pem \
--certificate-arn $arn \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can run this every time certbot updates your certificate. Or you can schedule it in crontab.&lt;/p&gt;</description></item><item><title>efs infrequent access</title><link>http://uly.me/posts/efs-infrequent-access/</link><pubDate>Sun, 04 Oct 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/efs-infrequent-access/</guid><description>&lt;p&gt;Just like in S3, you can have to up to 92% in savings if you use Infrequent Access or IA with AWS EFS (Elastic File Storage). You can create a lifecycle policy to move data from standard storage to infrequent access. Files that are not being used after x number of days are then moved to Infrequent Access. The downside is, the data in IA do not count towards gaining burst credits. You will need to keep a certain amount of standard storage to prevent depleting your burst credits.&lt;/p&gt;</description></item><item><title>gcp create internal ip reservation</title><link>http://uly.me/posts/gcp-create-internal-ip-reservation/</link><pubDate>Tue, 29 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-internal-ip-reservation/</guid><description>&lt;p&gt;Here’s how to create an internal IP reservation in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute addresses create my-private-ip-reservation \
--addresses 10.128.0.15 \
--region us-central1 \
--subnet default \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To list your reserved IPs.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute addresses list \
--project project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp list instances with service account</title><link>http://uly.me/posts/gcp-list-instances-with-service-account/</link><pubDate>Wed, 23 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-instances-with-service-account/</guid><description>&lt;p&gt;Here’s how to list GCP instances with a specific service account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances list \
--project your-project-id \
--format=&amp;#34;value(name,serviceAccounts[].email)&amp;#34; \
--filter=&amp;#34;serviceAccounts.email=your-service-account@email.com AND name~\bwp&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I’m using filters to look for a specific service account, and any instance starting with ‘wp.’ \b means begins with.&lt;/p&gt;</description></item><item><title>logitech k811 page up and down</title><link>http://uly.me/posts/logitech-k811-page-up-and-down/</link><pubDate>Wed, 23 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/logitech-k811-page-up-and-down/</guid><description>&lt;p&gt;I’ve been using this keyboard for a few years, but never knew how to use page and page down. It’s …&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fn + up arrow = page up
fn + down arrow = page down
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp listing reservations</title><link>http://uly.me/posts/gcp-listing-reservations/</link><pubDate>Mon, 21 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-listing-reservations/</guid><description>&lt;p&gt;Here’s how to list reservations in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute reservations list --project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Specify a zone.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute reservations list \
--filter=&amp;#34;zone:(&amp;#39;us-central1-a&amp;#39;)&amp;#34; \
--project project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>dos2unix</title><link>http://uly.me/posts/dos2unix/</link><pubDate>Fri, 18 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/dos2unix/</guid><description>&lt;p&gt;In Windows a new line, is a CR (carriage return) followed by LF (line feed). In Linux, it’s just LF. If you bring over a text file from Windows to Linux, sometimes you’ll end up with a file with a bunch of ^M at the end of each line, which will breaks a lot of things. To fix, just run dos2unix.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;dos2unix file.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp identify your disks</title><link>http://uly.me/posts/gcp-identify-your-disks/</link><pubDate>Wed, 16 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-identify-your-disks/</guid><description>&lt;p&gt;Here’s how to identify your disks on the system to cross check with GCP Dashboard.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ls -l /dev/disk/by-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[root@servername ~]# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx. 1 root root 9 Sep 15 05:30 google-boot -&amp;gt; ../../sda
lrwxrwxrwx. 1 root root 10 Sep 15 05:30 google-boot-part1 -&amp;gt; ../../sda1
lrwxrwxrwx. 1 root root 9 Sep 15 05:30 google-persistent-disk-1 -&amp;gt; ../../sdb
lrwxrwxrwx. 1 root root 9 Sep 15 05:30 scsi-0Google_PersistentDisk_boot -&amp;gt; ../../sda
lrwxrwxrwx. 1 root root 10 Sep 15 05:30 scsi-0Google_PersistentDisk_boot-part1 -&amp;gt; ../../sda1
lrwxrwxrwx. 1 root root 9 Sep 15 05:30 scsi-0Google_PersistentDisk_persistent-disk-1 -&amp;gt; ../../sdb
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp disks attach to an instance</title><link>http://uly.me/posts/gcp-disks-attach-to-an-instance/</link><pubDate>Tue, 15 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-disks-attach-to-an-instance/</guid><description>&lt;p&gt;Here’s how to display a list the disks attached to an instance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances describe instance-name \
--project project-id \
--zone us-central1-c \
--format=&amp;#39;yaml(disks[].source)&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create instance with reservations</title><link>http://uly.me/posts/gcp-create-instance-with-reservations/</link><pubDate>Mon, 14 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-instance-with-reservations/</guid><description>&lt;p&gt;Here’s how to create an instance with CUD (committed used discounts) reservations.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances create instance-name \
--no-address \
--private-network-ip 10.0.0.24 \
--source-machine-image=projects/project-id/global/machineImages/image-name \
--subnet=https://www.googleapis.com/compute/v1/projects/your-project/regions/us-central1/subnetworks/your-sub-network \
--machine-type=n1-standard-4 \
--reservation-affinity=specific \
--reservation=your-reservation-name \
--zone=us-central1-a \
--project=your-project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>custom breadcrumbs</title><link>http://uly.me/posts/custom-breadcrumbs/</link><pubDate>Sun, 13 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/custom-breadcrumbs/</guid><description>&lt;p&gt;I’ve customized my breadcrumbs. Add code to functions.php.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;add_filter(&amp;#39;genesis_breadcrumb_args&amp;#39;, &amp;#39;customize_breadcrumbs&amp;#39;);
function customize_breadcrumbs($args) {
$args[&amp;#39;labels&amp;#39;][&amp;#39;prefix&amp;#39;] = &amp;#39;Home&amp;#39;;
$args[&amp;#39;home&amp;#39;] = &amp;#39;&amp;#39;;
$args[&amp;#39;sep&amp;#39;] = &amp;#39;/&amp;#39;;
return $args;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now it doesn’t say Home/Home on the front page.&lt;/p&gt;</description></item><item><title>disable post title in genesis</title><link>http://uly.me/posts/disable-post-title-in-genesis/</link><pubDate>Sun, 13 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/disable-post-title-in-genesis/</guid><description>&lt;p&gt;Here’s how to disable the post title in Genesis WordPress themes. Add code in themes.php.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;add_filter( &amp;#39;genesis_link_post_title&amp;#39;, &amp;#39;__return_false&amp;#39; );
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create cud reservations</title><link>http://uly.me/posts/gcp-create-cud-reservations/</link><pubDate>Sun, 13 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-cud-reservations/</guid><description>&lt;p&gt;This will create a CUD (Committed Used Discounts) Reservation in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute reservations create reservation-name-us-central1-a \
--machine-type=n1-standard-4 \
--vm-count=1 \
--zone=us-central1-a \
--require-specific-reservation
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This creates a specific reservation instead of an open reservation.&lt;/p&gt;</description></item><item><title>extend regional persistent disks</title><link>http://uly.me/posts/extend-regional-persistent-disks/</link><pubDate>Sat, 12 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/extend-regional-persistent-disks/</guid><description>&lt;p&gt;Here’s the command to extend your regional persistent disks.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks resize disk-name \
--size 100 \
--project project-id \
--region us-central1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or you can specify by zone.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks resize disk-name \
--size 100 \
--project project-id \
--zone us-central1-c
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display the updated disk details.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks list \
--filter=&amp;#34;name=disk-name&amp;#34; \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Although you’ve increased disk size, the file system doesn’t know the extra space. Run this (for XFS).&lt;/p&gt;</description></item><item><title>compare files with comm</title><link>http://uly.me/posts/compare-files-with-comm/</link><pubDate>Sun, 06 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/compare-files-with-comm/</guid><description>&lt;p&gt;Here’s a command that will compare two files and display the only entries in the first file that are missing in the second file. To do this, there’s a compare command in Linux Bash called comm that comes with several options. The option we are interested in is the comm -23 which exactly does that. Let me demonstrate.&lt;/p&gt;
&lt;p&gt;Let’s say file a.txt contains:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;one
two
three
four
five
six
seven
eight
nine
ten
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And file b.txt contains:&lt;/p&gt;</description></item><item><title>gcp set scopes</title><link>http://uly.me/posts/gcp-set-scopes/</link><pubDate>Fri, 04 Sep 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-set-scopes/</guid><description>&lt;p&gt;Here’s how to set the instance scope in GCP. Stop the server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances stop server-name
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Default scopes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud beta compute instances set-scopes server-name \
--service-account=your-service-account@gserviceaccount.com \
--scopes=default \
--project your-project-id \
--zone=us-central1-a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change scopes by adding storage-rw to default.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud alpha compute instances set-scopes servername \
--service-account=your-service-account@gserviceaccount.com \
--scopes=default,storage-rw \
--project your-project-id \
--zone=us-central1-c
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Start the server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances start server-name
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Possible scope values.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;default&lt;/li&gt;
&lt;li&gt;cloud-platform&lt;/li&gt;
&lt;li&gt;storage-rw&lt;/li&gt;
&lt;li&gt;and &lt;a href="https://cloud.google.com/sdk/gcloud/reference/alpha/compute/instances/set-scopes"&gt;more&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>increase ssh timeout</title><link>http://uly.me/posts/increase-ssh-timeout/</link><pubDate>Tue, 25 Aug 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/increase-ssh-timeout/</guid><description>&lt;p&gt;Here’s how to keep your SSH timeout alive for a longer period.&lt;/p&gt;
&lt;p&gt;Edit /etc/ssh/sshd_config. Adjust interval and count max.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ClientAliveInterval 1200
ClientAliveCountMax 3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ClientAliveInterval is set to 1200 and ClientAliveCountMax is set to the default which is 3. This means unresponsive SSH clients will be disconnected after approximately 3600 seconds or 1 hour.&lt;/p&gt;</description></item><item><title>git bash path</title><link>http://uly.me/posts/git-bash-path/</link><pubDate>Wed, 19 Aug 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-bash-path/</guid><description>&lt;p&gt;Here’s how to add or edit the PATH in Git Bash. Edit your bash_profile.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vi ~/.bash_profile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Set your path by adding the new path at the end.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;PATH=&amp;#34;/c/WINDOWS/system32:/c/Users/firstname.lastname/google-cloud-sdk/bin&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The example path listed above is truncated for brevity.&lt;/p&gt;</description></item><item><title>aws list of application lb</title><link>http://uly.me/posts/aws-list-of-application-lb/</link><pubDate>Mon, 17 Aug 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-list-of-application-lb/</guid><description>&lt;p&gt;Here’s how to display a list of application load balancers.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws elbv2 describe-load-balancers --profile --region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s how to display classic load balancers.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws elb describe-load-balancers --profile --region us-east-1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>audacity copy</title><link>http://uly.me/posts/audacity-copy/</link><pubDate>Sat, 08 Aug 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/audacity-copy/</guid><description>&lt;p&gt;I was getting an error when launching Audacity.&lt;/p&gt;
&lt;p&gt;The error was:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“The system has detected that another copy of Audacity is running.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;However, Audacity wasn’t running at all. Not one process. It turned out to be just a locked file located in /var/tmp/audacity-[your-username].&lt;/p&gt;
&lt;p&gt;All you have to do is delete the entire directory and rerun Audacity.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rm -rf /var/tmp/audacity=[your-username]/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once deleted, Audacity starts right up with no issues.&lt;/p&gt;</description></item><item><title>linux fuser</title><link>http://uly.me/posts/linux-fuser/</link><pubDate>Thu, 06 Aug 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-fuser/</guid><description>&lt;p&gt;Who is accessing a particular directory? There’s a Linux command called fuser which will tell you who’s running processes in that directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fuser /etc/apache/
fuser /home/john/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Verbose.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fuser /data/exports/ -v
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check out the &lt;a href="https://www.man7.org/linux/man-pages/man1/fuser.1.html"&gt;fuser&lt;/a&gt; man page.&lt;/p&gt;</description></item><item><title>ansible run commands</title><link>http://uly.me/posts/ansible-run-commands/</link><pubDate>Sun, 02 Aug 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ansible-run-commands/</guid><description>&lt;p&gt;Typically you will run Ansible using playbooks, just like the playbook that I ran from the previous post to patch a bunch of servers all at once. In addition to running playbooks, you can also run single ad hoc commands to a server or to a group of servers. Below are a few examples of that.&lt;/p&gt;
&lt;p&gt;First, here’s my /etc/ansible/hosts file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[servers]
server1
server2
[webservers]
server3
server4
[appservers]
server5
server6
[dbservers]
server7
server8
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here are the commands.&lt;/p&gt;</description></item><item><title>ansible update playbook</title><link>http://uly.me/posts/ansible-update-playbook/</link><pubDate>Sat, 01 Aug 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ansible-update-playbook/</guid><description>&lt;p&gt;I have an Ansible playbook that will patch all Ansible clients defined in the Ansible hosts file. The following are contents of my hosts file, and the update playbook.&lt;/p&gt;
&lt;p&gt;File: /etc/ansible/hosts&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[all:vars]
ansible_user=&amp;#39;ubuntu&amp;#39;
ansible_become=yes
ansible_become_method=sudo
ansible_python_interpreter=&amp;#39;/usr/bin/env python3&amp;#39;
[servers]
server1
server2
server3
[servers:vars]
ansible_python_interpreter=/usr/bin/python3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;File: /etc/ansible/update.yml&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;---
- hosts: servers
become: true
become_user: root
tasks:
- name: Update apt repo and cache on all Debian/Ubuntu boxes
apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
- name: Upgrade all packages on servers
apt: upgrade=dist force_apt_get=yes
- name: Check if a reboot is needed on all servers
register: reboot_required_file
stat: path=/var/run/reboot-required get_md5=no
- name: Reboot the box if kernel updated
reboot:
msg: &amp;#34;Reboot initiated by Ansible for kernel updates&amp;#34;
connect_timeout: 5
reboot_timeout: 300
pre_reboot_delay: 0
post_reboot_delay: 30
test_command: uptime
when: reboot_required_file.stat.exist
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s how I run my Ansible update playbook.&lt;/p&gt;</description></item><item><title>center search widget</title><link>http://uly.me/posts/center-search-widget/</link><pubDate>Sat, 01 Aug 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/center-search-widget/</guid><description>&lt;p&gt;Here’s how to center the Search widget in a WordPress Page or a post. This applies only if you’re using the default Search Widget. Div classes may vary based on theme being used. The CSS example below may not work for your theme. Check your theme’s source code to be sure.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;.entry-content .wp-block-search {
display:block;
margin-left:auto;
margin-right:auto;
text-align: center;
}
.entry-content .wp-block-search label {
display:none;
}
.entry-content .wp-block-search input {
width:250px;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The CSS above centers the search block. It suppresses the search label, and finally sets the form’s input to a fixed width of 250px.&lt;/p&gt;</description></item><item><title>aws iam mfa</title><link>http://uly.me/posts/aws-iam-mfa/</link><pubDate>Tue, 28 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-iam-mfa/</guid><description>&lt;p&gt;Here’s how to give AWS IAM users the ability to manage their own (MFA) Multi Factor Authentication. MFA makes your AWS console secure. AWS IAM users will be able to turn on MFA, using virtual devices such as Google Authenticator to secure their cloud accounts. Here’s the policy.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowViewAccountInfo&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: &amp;#34;iam:ListVirtualMFADevices&amp;#34;,
&amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowManageOwnVirtualMFADevice&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;iam:CreateVirtualMFADevice&amp;#34;,
&amp;#34;iam:DeleteVirtualMFADevice&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:iam::*:mfa/${aws:username}&amp;#34;
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowManageOwnUserMFA&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;iam:DeactivateMFADevice&amp;#34;,
&amp;#34;iam:EnableMFADevice&amp;#34;,
&amp;#34;iam:ListUsers&amp;#34;,
&amp;#34;iam:GetUser&amp;#34;,
&amp;#34;iam:ListMFADevices&amp;#34;,
&amp;#34;iam:ResyncMFADevice&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:iam::*:user/${aws:username}&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws iam self manage policy</title><link>http://uly.me/posts/aws-iam-self-manage-policy/</link><pubDate>Tue, 28 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-iam-self-manage-policy/</guid><description>&lt;p&gt;Here’s the permission needed for an AWS user to manage their own IAM account. The policy allows them to view their own account information, change their own passwords, rotate access keys and certificates, and manage their own git credentials.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowViewAccountInfo&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;iam:GetAccountPasswordPolicy&amp;#34;,
&amp;#34;iam:GetAccountSummary&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowManageOwnPasswords&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;iam:ChangePassword&amp;#34;,
&amp;#34;iam:GetUser&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:iam::*:user/${aws:username}&amp;#34;
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowManageOwnAccessKeys&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;iam:CreateAccessKey&amp;#34;,
&amp;#34;iam:DeleteAccessKey&amp;#34;,
&amp;#34;iam:GetAccessKeyLastUsed&amp;#34;,
&amp;#34;iam:ListAccessKeys&amp;#34;,
&amp;#34;iam:UpdateAccessKey&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:iam::*:user/${aws:username}&amp;#34;
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowManageOwnSigningCertificates&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;iam:DeleteSigningCertificate&amp;#34;,
&amp;#34;iam:ListSigningCertificates&amp;#34;,
&amp;#34;iam:UpdateSigningCertificate&amp;#34;,
&amp;#34;iam:UploadSigningCertificate&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:iam::*:user/${aws:username}&amp;#34;
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowManageOwnSSHPublicKeys&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;iam:DeleteSSHPublicKey&amp;#34;,
&amp;#34;iam:GetSSHPublicKey&amp;#34;,
&amp;#34;iam:ListSSHPublicKeys&amp;#34;,
&amp;#34;iam:UpdateSSHPublicKey&amp;#34;,
&amp;#34;iam:UploadSSHPublicKey&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:iam::*:user/${aws:username}&amp;#34;
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowManageOwnGitCredentials&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;iam:CreateServiceSpecificCredential&amp;#34;,
&amp;#34;iam:DeleteServiceSpecificCredential&amp;#34;,
&amp;#34;iam:ListServiceSpecificCredentials&amp;#34;,
&amp;#34;iam:ResetServiceSpecificCredential&amp;#34;,
&amp;#34;iam:UpdateServiceSpecificCredential&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:iam::*:user/${aws:username}&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>change default editor</title><link>http://uly.me/posts/change-default-editor/</link><pubDate>Tue, 28 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-default-editor/</guid><description>&lt;p&gt;Ubuntu and Linux Mint use nano as their default editor. You’ll see it if you try to edit crontab or visudo. Now, there’s nothing wrong with nano, but I prefer using vim instead. Here’s how to change the default editor.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo update-alternatives --config editor
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You’ll be prompted to change the default editor.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;There are 4 choices for the alternative editor (providing /usr/bin/editor).
Selection Path Priority Status
------------------------------------------------------------
0 /bin/nano 40 auto mode
1 /bin/ed -100 manual mode
2 /bin/nano 40 manual mode
* 3 /usr/bin/vim.basic 30 manual mode
4 /usr/bin/vim.tiny 15 manual mode
Press &amp;lt;enter&amp;gt; to keep the current choice[*], or type selection number:
&amp;lt;/enter&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Type 3 to choose vim basic.&lt;/p&gt;</description></item><item><title>remove sudo password</title><link>http://uly.me/posts/remove-sudo-password/</link><pubDate>Tue, 28 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-sudo-password/</guid><description>&lt;p&gt;Removing sudo password is typically not a good practice. If you’re a seasoned system administrator, or you’re the only one using your own desktop, being prompted for a sudo password can get really annoying. Here’s how to stop getting prompted every time you run sudo.&lt;/p&gt;
&lt;p&gt;Run visudo.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo visudo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Edit the sudo line and set to below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;%sudo ALL=(ALL) NOPASSWD: ALL
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Save file.&lt;/p&gt;</description></item><item><title>aws lightsail restrict ip address</title><link>http://uly.me/posts/aws-lightsail-restrict-ip-address/</link><pubDate>Mon, 27 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-lightsail-restrict-ip-address/</guid><description>&lt;p&gt;AWS LightSail now has the ability to restrict IP addresses in their firewall rules. LightSail instances can now be secured by limiting firewall rules from an IP CIDR block or a single IP address. For example, you can restrict who can SSH into your instance by limiting it to just your IP address, so only you can SSH into your machine. Another feature AWS added in their LightSail firewall is support for ping, which could be helpful for monitoring and checks.&lt;/p&gt;</description></item><item><title>aws rotate iam keys</title><link>http://uly.me/posts/aws-rotate-iam-keys/</link><pubDate>Sun, 26 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-rotate-iam-keys/</guid><description>&lt;p&gt;Here’s a script that will rotate AWS IAM keys.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# set files
user=&amp;#39;johndoe&amp;#39;
newkey=&amp;#39;/root/new-access-key.json&amp;#39;
oldkey=&amp;#39;/root/old-access-key.json&amp;#39;
credentials=&amp;#39;/root/.aws/credentials&amp;#39;
# get old credentials
aws iam list-access-keys --user-name $user &amp;gt; $oldkey
okey=$(jq .AccessKeyMetadata[0].AccessKeyId $oldkey | tr -d \&amp;#34;)
# create new key
aws iam create-access-key --user-name $user &amp;gt; $newkey
# get new access keys and new secret
nkey=$(jq .AccessKey.AccessKeyId $newkey | tr -d \&amp;#34;)
nsecret=$(jq .AccessKey.SecretAccessKey $newkey | tr -d \&amp;#34;)
# backup old credentials
cp /root/.aws/credentials /root/.aws/credentials-backup
# store the new key
echo &amp;#39;[default]&amp;#39; &amp;gt; $credentials
echo &amp;#39;aws_access_key_id = &amp;#39; $nkey &amp;gt;&amp;gt; $credentials
echo &amp;#39;aws_secret_access_key = &amp;#39;$nsecret &amp;gt;&amp;gt; $credentials
sleep 10
# delete old key
aws iam delete-access-key --user-name $user --access-key-id $okey
rm $newkey
rm $oldkey
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The script performs the following:&lt;/p&gt;</description></item><item><title>remove quotes from strings</title><link>http://uly.me/posts/remove-quotes-from-strings/</link><pubDate>Sun, 26 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-quotes-from-strings/</guid><description>&lt;p&gt;Here’s the command to remove quotes from a string in Bash by using the tr -d command. I’m using jq tool to extract the access key from a json file. Bash returns a string surrounded by quotes. To remove the quotes, just pipe the string to the tr -d command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;jq .AccessKey.AccessKeyId key.json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;#34;ASDFSDFSDFASDFSDFSDFGHGDF&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Using tr -d.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;jq .AccessKey.AccessKeyId key.json | tr -d \&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ASDFSDFSDFASDFSDFSDFGHGDF
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>revolution theme</title><link>http://uly.me/posts/revolution-theme/</link><pubDate>Sun, 26 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/revolution-theme/</guid><description>&lt;p&gt;I’m now using the Revolution theme from StudioPress. It’s a minimal design with lots of whitespace. The default font is Playfair Display which highlights headlines and blockquotes. The Playfair Display is available from Google Fonts if you’re interested. I think it’s a perfect theme for a photography blog. Although the theme seems to invite you to write more, something I haven’t been doing lately. And before I sign off, let’s take a look at what a blockquote looks like. Not bad at all. A beautiful theme.&lt;/p&gt;</description></item><item><title>cinnamon or mate?</title><link>http://uly.me/posts/cinnamon-or-mate/</link><pubDate>Sat, 25 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cinnamon-or-mate/</guid><description>&lt;p&gt;Here’s how to tell if you’re running Cinnamon or Mate.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;inxi -Fxz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;System: Kernel: 5.4.0-40-generic x86_64
bits: 64
compiler: gcc v: 9.3.0
Desktop: Cinnamon 4.6.6
Distro: Linux Mint 20 Ulyana
base: Ubuntu 20.04 focal
...
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>clients connected to apache</title><link>http://uly.me/posts/clients-connected-to-apache/</link><pubDate>Sat, 25 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/clients-connected-to-apache/</guid><description>&lt;p&gt;Here’s how to find if clients are connected to Apache or Nginx service.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;netstat -tn src: 80
netstat -tn src: 443
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>genesis footer</title><link>http://uly.me/posts/genesis-footer/</link><pubDate>Sat, 25 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/genesis-footer/</guid><description>&lt;p&gt;Here’s how to display Copyright years in the footer section if you’re using the Genesis theme.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;© 2002–2023
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Copyright © 2002–2020
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The current year is dynamic. It will display 2021 a year from now. The first year is always fixed.&lt;/p&gt;</description></item><item><title>gb vs gib</title><link>http://uly.me/posts/gb-vs-gib/</link><pubDate>Wed, 15 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gb-vs-gib/</guid><description>&lt;p&gt;Interesting facts between GB and GiB.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GB uses base 1000. GiB uses base 1024.&lt;/li&gt;
&lt;li&gt;1GB is 1,000,000,000 bytes. 1GiB is 1,073,741,824 bytes.&lt;/li&gt;
&lt;li&gt;A 1TB drive is 1,000 GB. Or 931 GiB.&lt;/li&gt;
&lt;li&gt;A 1TiB drive is 1000 GiB. Or 1099 GB.&lt;/li&gt;
&lt;li&gt;To convert GB to GiB, multiply by (1000 / 1024).&lt;/li&gt;
&lt;li&gt;To convert GiB to GB, divide by (1000 / 1024).&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>linux format usb drive</title><link>http://uly.me/posts/linux-format-usb-drive/</link><pubDate>Thu, 09 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-format-usb-drive/</guid><description>&lt;p&gt;Here’s how to format a USB drive on Linux.&lt;/p&gt;
&lt;p&gt;Plug in the USB drive to see mount point.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# scan for all drives
df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdc1 fuseblk 30G 66M 30G 1% /media/ulysses/451B99AF225B48EC
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Unmount USB drive.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;umount /dev/sdc1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Choose a file system type and run the appropriate format command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# nfts format
mkfs.ntfs /dev/sdc1
# vfat format
mkfs.vfat /dev/sdc1
# ext4 format
mkfs.ext4 /dev/sdc1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>how to remove snap</title><link>http://uly.me/posts/how-to-remove-snap/</link><pubDate>Tue, 07 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/how-to-remove-snap/</guid><description>&lt;p&gt;Snap is cool, but not for everyone. To remove, follow these steps.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# get list
snap list
# remove snaps. repeat for each app.
snap remove chromium
# remove snapd
apt purge snapd
# remove snap from home
rm -rf ~/snap
# clean up cache
rm -rf /var/cache/snapd
apt purge snapd
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>printing from a terminal</title><link>http://uly.me/posts/printing-from-a-terminal/</link><pubDate>Tue, 07 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/printing-from-a-terminal/</guid><description>&lt;p&gt;There are times you just want to print directly from the command line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# check your printing options
lpotions
lpinfo -v
# what&amp;#39;s your default printer
lpinfo -p -d
# use lp to print
lp notes.txt
# use -n print multiple copies
lp -n 2 notes.txt
# check the printer queue
lp -q
# use the job number to cancel print jobs if needed
cancel 123
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>lightsail upstream error 515</title><link>http://uly.me/posts/lightsail-upstream-error-515/</link><pubDate>Mon, 06 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lightsail-upstream-error-515/</guid><description>&lt;p&gt;If you use LightSail, AWS provides an easy way for you to connect to LightSail instances via Web SSH. I normally use a terminal (ssh client) to connect to LightSail instances, but using Web SSH is very convenient. If you try to do an OS upgrade, for example from Ubuntu 18.04 LTS to Ubuntu 20.04 LTS, you will break Web SSH. AWS has added a special Web SSH configuration on LightSail base images. The error you’ll get is “Upstream Error 515.” The only way to fix this is to get AWS Support to help you apply the fix. It’s not a make or break it deal, but it can be a nuisance if you prefer to use AWS Web SSH instead of a terminal. If you need a more secure SSH connection, consider uploading your ssh-key to the server, and disable password login.&lt;/p&gt;</description></item><item><title>linux mint 20 ulyana</title><link>http://uly.me/posts/linux-mint-20-ulyana/</link><pubDate>Mon, 06 Jul 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-mint-20-ulyana/</guid><description>&lt;p&gt;I upgraded my desktop to Linux Mint 20 Ulyana over the weekend.&lt;/p&gt;
&lt;p&gt;Edit your package repository. Replace tricia with ulyana, and bionic with focal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim /etc/apt/sources.list.d/official-package-repositories.list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run update first.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt update -y
apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Perform upgrade to Linux Mint 20. When prompted, choose default.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt dist-upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;reboot
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;cat /etc/os-release.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ulysses@penguin:~/Code$ cat /etc/os-release
NAME=&amp;#34;Linux Mint&amp;#34;
VERSION=&amp;#34;20 (Ulyana)&amp;#34;
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME=&amp;#34;Linux Mint 20&amp;#34;
VERSION_ID=&amp;#34;20&amp;#34;
HOME_URL=&amp;#34;https://www.linuxmint.com/&amp;#34;
SUPPORT_URL=&amp;#34;https://forums.ubuntu.com/&amp;#34;
BUG_REPORT_URL=&amp;#34;http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/&amp;#34;
PRIVACY_POLICY_URL=&amp;#34;https://www.linuxmint.com/&amp;#34;
VERSION_CODENAME=ulyana
UBUNTU_CODENAME=focal
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>linux script</title><link>http://uly.me/posts/linux-script/</link><pubDate>Tue, 30 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-script/</guid><description>&lt;p&gt;The script command records all your keystrokes and output into a file called typescript.&lt;/p&gt;
&lt;p&gt;You can start recording by simply typing script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;script
Script started, file is typescript
df -h
ls -l
exit
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Typing exit stops the recording. Just cat typescript to see your recording.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cat typescript
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli v2</title><link>http://uly.me/posts/aws-cli-v2/</link><pubDate>Sun, 28 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-v2/</guid><description>&lt;p&gt;How to install AWS CLI version 2.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;curl &amp;#34;https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip&amp;#34; -o &amp;#34;awscliv2.zip&amp;#34;
unzip awscliv2.zip
sudo ./aws/install
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>php 7.0 to 7.4 upgrade</title><link>http://uly.me/posts/php-7-0-to-7-4-upgrade/</link><pubDate>Sun, 28 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/php-7-0-to-7-4-upgrade/</guid><description>&lt;p&gt;Here are steps I took to upgrade from PHP 7.0 to 7.4 on Ubuntu 18.04 LTS.&lt;/p&gt;
&lt;p&gt;Login as root, otherwise use sudo for all commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# use 3rd party ppa repo
add-apt-repository ppa:ondrej/php
apt -y update
apt -y upgrade
# install php-core
apt install php7.4 php7.4-common php7.4-cli
# add all the php extenstions your app needs
apt install php7.4-curl php7.4-json php7.4-gd php7.4-mbstring
apt install php7.4-intl php7.4-bcmath php7.4-bz2 php7.4-xml
apt install php7.4-readline php7.4-zip php7.4-mysql
# I&amp;#39;m using apache prefork MPM, so install it
apt install libapache2-mod-php7.4
a2enmod php7.4
# check version. Success!
php -v
# for good measure, reboot apache
systemctl restart apache2.service
# Finally, purge the old PHP versions
apt purge php7.0 libapache2-mod-php7.0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Finally, run update on more time to get all the latest updates.&lt;/p&gt;</description></item><item><title>bash variables</title><link>http://uly.me/posts/bash-variables/</link><pubDate>Sat, 27 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-variables/</guid><description>&lt;p&gt;Here’s how to read Bash variables from another file.&lt;/p&gt;
&lt;p&gt;Contents of config.sh&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
var1=&amp;#39;thisisvariableone&amp;#39;
var2=&amp;#39;thisisvariabletwo&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Call config.sh from another script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
source config.sh
echo var1
echo var2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is extremely helpful if you have multiple scripts using a common variable. You just to update one file instead of multiple files. All the other scripts will read and pick up the same variables from a config file. You can use this to setup your global variables.&lt;/p&gt;</description></item><item><title>internet test</title><link>http://uly.me/posts/internet-test/</link><pubDate>Fri, 26 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/internet-test/</guid><description>&lt;p&gt;My internet has been flaky lately. I wrote a script that logs my internet connection.&lt;/p&gt;
&lt;p&gt;I’m running it in cron every minute.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
log=&amp;#39;/home/ulysses/Code/spectrum.log&amp;#39;
if nc -zw1 google.com 443;
then
echo &amp;#39;Spectrum is up&amp;#39; $(date) &amp;gt;&amp;gt; $log
else
echo &amp;#39;Spectrum is down&amp;#39; $(date) &amp;gt;&amp;gt; $log
fi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To view, just cat the log.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cat spectrum.log
Spectrum is up Fri Jun 26 15:14:01 EDT 2020
Spectrum is up Fri Jun 26 15:15:01 EDT 2020
Spectrum is up Fri Jun 26 15:16:01 EDT 2020
Spectrum is up Fri Jun 26 15:17:01 EDT 2020
Spectrum is up Fri Jun 26 15:18:01 EDT 2020
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So, I now have a record when it was up or down.&lt;/p&gt;</description></item><item><title>largest files and directories</title><link>http://uly.me/posts/largest-files-and-directories/</link><pubDate>Wed, 24 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/largest-files-and-directories/</guid><description>&lt;p&gt;Here’s the command to find the largest files and directories in Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;du -a /var | sort -n -r | head -n 20
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>timedatectl</title><link>http://uly.me/posts/timedatectl/</link><pubDate>Wed, 24 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/timedatectl/</guid><description>&lt;p&gt;Here’s another way of setting your server’s timezone. See all the options under North America.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;timedatectl list-timezones | grep -i America
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Set timezone.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;timedatectl set-timezone America/New_York
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To check.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;date
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart cron if needed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl restart cron.service
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp load balancer logging</title><link>http://uly.me/posts/gcp-load-balancer-logging/</link><pubDate>Sun, 21 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-load-balancer-logging/</guid><description>&lt;p&gt;Go to Logging &amp;gt; Logs Viewer to monitor a GCP Load Balancer.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;resource.type=&amp;#34;http_load_balancer&amp;#34; AND resource.labels.url_map_name=&amp;#34;your-lb&amp;#34; AND resource.labels.project_id=&amp;#34;your-project-id&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ffmpeg offset audio</title><link>http://uly.me/posts/ffmpeg-offset-audio/</link><pubDate>Fri, 19 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ffmpeg-offset-audio/</guid><description>&lt;p&gt;If your audio is out of sync, you can fix using ffmpeg.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i source.mp4 \
-i livestream.mp4 \
-map 0:0 -map 1:1 \
-acodec copy \
-vcodec copy \
-itsoffset 0.100 \
output.mp4
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The ffmpeg fix is fast. A 1GB file took less than 30 seconds to run. Adjust -tsoffset until you find the sweet spot.&lt;/p&gt;</description></item><item><title>ansible run updates</title><link>http://uly.me/posts/ansible-run-updates/</link><pubDate>Thu, 18 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ansible-run-updates/</guid><description>&lt;p&gt;Here’s a simple adhoc to run updates on systems in Ansible.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ansible servers -m apt -a &amp;#34;upgrade=yes update_cache=yes&amp;#34; -b
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Results:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;server | SUCCESS =&amp;gt; {
&amp;#34;changed&amp;#34;: false,
&amp;#34;msg&amp;#34;: &amp;#34;Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.&amp;#34;,
&amp;#34;stderr&amp;#34;: &amp;#34;&amp;#34;,
&amp;#34;stderr_lines&amp;#34;: [],
&amp;#34;stdout&amp;#34;: &amp;#34;Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.&amp;#34;,
&amp;#34;stdout_lines&amp;#34;: [
&amp;#34;Reading package lists...&amp;#34;,
&amp;#34;Building dependency tree...&amp;#34;,
&amp;#34;Reading state information...&amp;#34;,
&amp;#34;Calculating upgrade...&amp;#34;,
&amp;#34;0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.&amp;#34;
]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want to reboot a remote server.&lt;/p&gt;</description></item><item><title>wordpress posts revision</title><link>http://uly.me/posts/wordpress-posts-revision/</link><pubDate>Thu, 18 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-posts-revision/</guid><description>&lt;p&gt;How to turn on post revisions in WordPress. Edit wp-config.php.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/** WordPress Revisions */
define(&amp;#39;WP_POST_REVISIONS&amp;#39;, false);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change to:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/** WordPress Revisions */
define(&amp;#39;WP_POST_REVISIONS&amp;#39;, 10);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;10 is the number of revisions you want to keep.&lt;/p&gt;</description></item><item><title>copy ssh key to server</title><link>http://uly.me/posts/copy-ssh-key-to-server/</link><pubDate>Tue, 16 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/copy-ssh-key-to-server/</guid><description>&lt;p&gt;Here’s the command to copy a secret key to a remote server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ssh-copy-id user@servername
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This assumes you already generated a key.&lt;/p&gt;</description></item><item><title>linux useradd</title><link>http://uly.me/posts/linux-useradd/</link><pubDate>Tue, 16 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-useradd/</guid><description>&lt;p&gt;Here’s the command to add a Linux user.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;useradd -m -s $(which bash) -G sudo ulysses
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;-m creates a home directory. -s selects a shell. -G adds user to a sudo group.&lt;/p&gt;</description></item><item><title>run ansible playbook</title><link>http://uly.me/posts/run-ansible-playbook/</link><pubDate>Tue, 16 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-ansible-playbook/</guid><description>&lt;p&gt;Here’s the command to run the Ansible playbook.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ansible-playbook -t hosts playbook.yml
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or simply run it like this.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ansible-playbook playbook.yml
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>powershell test network connection</title><link>http://uly.me/posts/powershell-test-network-connection/</link><pubDate>Mon, 15 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/powershell-test-network-connection/</guid><description>&lt;p&gt;Here’s the command to test a network connection in Powershell.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;C:&amp;gt; Test-NetConnection -ComputerName server -Port 443
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ComputerName : server
RemoteAddress : 10.0.0.5
RemotePort : 443
InterfaceAlias : Ethernet 0
SourceAddress : 10.1.1.34
TcpTestSucceeded : True
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ffmpeg fix audio sync</title><link>http://uly.me/posts/ffmpeg-fix-audio-sync/</link><pubDate>Sun, 14 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ffmpeg-fix-audio-sync/</guid><description>&lt;p&gt;If you have a video with audio sync issues, you can easily fix it using ffmpeg. It takes 2 inputs: the filename and delay: 0.100 is 100 ms or 0.1 seconds. Output file has -fixed appended to it. It’s fast. Only takes 2-3 seconds to process a 1.5 hour recording.&lt;/p&gt;
&lt;p&gt;Here’s the script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i livestream.mp4 \
-itsoffset 0.100 \
-i livestream.mp4 \
-map 0:0 -map 1:1 \
-acodec copy \
-vcodec copy \
livestream-fixed.mp4
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>mysql restore to another db</title><link>http://uly.me/posts/mysql-restore-to-another-db/</link><pubDate>Sun, 14 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mysql-restore-to-another-db/</guid><description>&lt;p&gt;In order to restore a MySQL database to another database, use routines and triggers.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysqldump -p user -p --routines --triggers db1 &amp;gt; db1.sql
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To restore to another database, just use the normal command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql -u user -p db2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp uefi compatible</title><link>http://uly.me/posts/gcp-uefi-compatible/</link><pubDate>Mon, 08 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-uefi-compatible/</guid><description>&lt;p&gt;When trying to boot from a disk created from snapshot and you’re getting an “UEFI feature is not available for this project” error, you’ll need to create a boot image with the –guest-os-features option set to “UEFI_COMPATIBLE.”&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks create new-server-disk-2 \
--project=project-name \
--source-snapshot=server-disk-2 \
--zone=us-central1-b \
--guest-os-features=&amp;#34;UEFI_COMPATIBLE&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It’s about enabling guest operating system features on custom images. The guest operating system features let you configure networking, security, storage, and operating system options on custom images to be used on boot disks.&lt;/p&gt;</description></item><item><title>ubuntu packages kept back</title><link>http://uly.me/posts/ubuntu-packages-kept-back/</link><pubDate>Thu, 04 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ubuntu-packages-kept-back/</guid><description>&lt;p&gt;If you see packages are being kept back in Ubuntu, you can run the following to force an update.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get --with-new-pkgs upgrade
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws certificate list</title><link>http://uly.me/posts/aws-certificate-list/</link><pubDate>Wed, 03 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-certificate-list/</guid><description>&lt;p&gt;Here’s how to get a list of certificates in AWS Certificate Manager.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm list-certificates \
--profile default \
--region us-east-1 \
--output text \
--query &amp;#39;CertificateSummaryList[*].{ARN:CertificateArn,Domain:DomainName}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>7zip in linux</title><link>http://uly.me/posts/7zip-in-linux/</link><pubDate>Tue, 02 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/7zip-in-linux/</guid><description>&lt;p&gt;To install 7zip.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install 7za
apt install p7zip
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To extract.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;7za e compressedfile.7z
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To archive.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;7za a myarchive.7z myfiles/
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp display forwarding rules</title><link>http://uly.me/posts/gcp-display-forwarding-rules/</link><pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-display-forwarding-rules/</guid><description>&lt;p&gt;Here’s how to display a list of Google Cloud forwarding rules.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute forwarding-rules list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want global only.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute forwarding-rules --global
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or just local regions only.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute forwarding-rules --filter=&amp;#34;region:( us-central us-west1 )&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ffmpeg convert mp3 to ogg</title><link>http://uly.me/posts/ffmpeg-convert-mp3-to-ogg/</link><pubDate>Sun, 31 May 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ffmpeg-convert-mp3-to-ogg/</guid><description>&lt;p&gt;How to convert MP3 to OGG audio format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i in.mp3 -ar 48000 -vn -c:a libvorbis out.ogg
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you have sample rate errors, use -vn.&lt;/p&gt;</description></item><item><title>gcp create firewall with tags</title><link>http://uly.me/posts/gcp-create-firewall-with-tags/</link><pubDate>Thu, 28 May 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-firewall-with-tags/</guid><description>&lt;p&gt;Here’s another way to create a firewall in GCP using network tag as targets.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules create &amp;#34;firewall-name&amp;#34; \
--description=&amp;#34;egress rule to allow port 8000 to destination&amp;#34; \
--priority &amp;#34;1000&amp;#34; \
--direction EGRESS \
--action allow \
--network &amp;#34;your-network&amp;#34; \
--target-tags=&amp;#34;your-network-tag&amp;#34; \
--destination-ranges=&amp;#34;10.0.0.1/32&amp;#34; \
--rules tcp:8000
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ec2 password authentication</title><link>http://uly.me/posts/ec2-password-authentication/</link><pubDate>Mon, 18 May 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ec2-password-authentication/</guid><description>&lt;p&gt;When you stand up an AWS instance, it’s only accessible via SSH key using the default user, typically ec2-user.&lt;/p&gt;
&lt;p&gt;Add password to ec2-user, then enable password authentication to ‘yes’ in SSH.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Add password to ec2-user
sudo passwd ec2-user
# edit ssh config
vim /etc/ssh/sshd_config
# enable password authentication
PasswordAuthentication yes
# save file and exit
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart SSH service.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl restart sshd.service
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gce agent bash</title><link>http://uly.me/posts/gce-agent-bash/</link><pubDate>Mon, 11 May 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gce-agent-bash/</guid><description>&lt;p&gt;This is a Bash script to restart a service.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
SERVICE=google_osconfig_agent
AGENT=google-osconfig-agent
if (( $(ps -ef | grep -v grep | grep $SERVICE | wc -l) &amp;gt; 0 ))
then
echo &amp;#34;$AGENT service running, everything is fine&amp;#34;
else
echo &amp;#34;$AGENT is not running&amp;#34;
echo &amp;#34;Restarting service&amp;#34;
systemctl start $AGENT
sleep 5s
if (( $(ps -ef | grep -v grep | grep $SERVICE | wc -l) &amp;gt; 0 ))
then
sleep 2s
echo &amp;#34;$AGENT service is now running&amp;#34;
fi
fi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gce agent powershell</title><link>http://uly.me/posts/gce-agent-powershell/</link><pubDate>Mon, 11 May 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gce-agent-powershell/</guid><description>&lt;p&gt;This is a Powershell script to restart a service if it’s down.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ServiceName = &amp;#39;GCEAgent&amp;#39;
$arrService = Get-Service -Name $ServiceName
if ($arrService.Status -ne &amp;#39;Running&amp;#39;)
{
Start-Service $ServiceName
write-host $arrService.status
write-host &amp;#39;Service starting&amp;#39;
Start-Sleep -seconds 60
$arrService.Refresh()
if ($arrService.Status -eq &amp;#39;Running&amp;#39;)
{
Write-Host &amp;#39;GCE Agent Service is now Running&amp;#39;
}
}
else
{
Write-Host &amp;#39;GCE Agent Service is Running&amp;#39;
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws ec2 describe snapshots</title><link>http://uly.me/posts/aws-ec2-describe-snapshots/</link><pubDate>Thu, 07 May 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-ec2-describe-snapshots/</guid><description>&lt;p&gt;Here’s how to describe snapshots using query with tags.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-snapshots \
--owner-ids xxxxxxxxxxx \
--profile default \
--region us-east-2 \
--output text \
--query &amp;#34;Snapshots[*].[SnapshotId,Tags[?Key==&amp;#39;Name&amp;#39;].Value[] | [0]]&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;snap-xxxxxxxxxxxxxxxxx Server1
snap-xxxxxxxxxxxxxxxxx Server2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>linux screen</title><link>http://uly.me/posts/linux-screen/</link><pubDate>Thu, 07 May 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-screen/</guid><description>&lt;p&gt;If you don’t have it installed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install screen
apt install screen
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Before you run a process, run screen, and detach.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;screen
# run the command
ping yahoo.com
# ctrl-a and ctrl-d to detach
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To reattach, get a list of screen sessions, and attach to it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;screen -ls
# result is somewhat similar to below
4452.hostname
# attach to it
screen -dr 4452.hostname
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To stop, just type exit from the screen terminal.&lt;/p&gt;</description></item><item><title>php modules</title><link>http://uly.me/posts/php-modules/</link><pubDate>Thu, 07 May 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/php-modules/</guid><description>&lt;p&gt;Here are some missing PHP modules on my WordPress install.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install php-gd php-dom php-mbstring php-imagick php-zip
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot Apache after the install.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sssd leave domain</title><link>http://uly.me/posts/sssd-leave-domain/</link><pubDate>Thu, 30 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sssd-leave-domain/</guid><description>&lt;p&gt;Here’s how to unjoin or leave the domain via SSSD.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;realm leave domain.com
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws s3 sync between accounts</title><link>http://uly.me/posts/aws-s3-sync-between-accounts/</link><pubDate>Wed, 29 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-sync-between-accounts/</guid><description>&lt;p&gt;Here’s how to sync S3 buckets between 2 different AWS accounts. Assuming buckets are already created.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Setup bucket permissions in Account A&lt;/li&gt;
&lt;li&gt;Setup IAM user with permissions in Account B&lt;/li&gt;
&lt;li&gt;Setup bucket permissions in Account B&lt;/li&gt;
&lt;li&gt;Run S3 sync from Account B.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Account A bucket permissions. Account and user are from Account B.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Sid&amp;#34;: &amp;#34;DelegateS3Access&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Principal&amp;#34;: {&amp;#34;AWS&amp;#34;: &amp;#34;arn:aws:iam::222222222222:user/Jane&amp;#34;},
&amp;#34;Action&amp;#34;: [&amp;#34;s3:ListBucket&amp;#34;,&amp;#34;s3:GetObject&amp;#34;],
&amp;#34;Resource&amp;#34;: [
&amp;#34;arn:aws:s3:::awsexamplesourcebucket/*&amp;#34;,
&amp;#34;arn:aws:s3:::awsexamplesourcebucket&amp;#34;
]
}
]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create IAM user (Jane) in Account B&lt;/p&gt;</description></item><item><title>aws cli autoscaler update</title><link>http://uly.me/posts/aws-cli-autoscaler-update/</link><pubDate>Mon, 27 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-autoscaler-update/</guid><description>&lt;p&gt;Here’s the AWS CLI command to set the Auto Scaling Group to a certain number for the minimum, maximum, and desired number of instances.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# Format:
# ./autoscaling.sh 3
# ./autoscaling.sh 0
int=$1
aws autoscaling update-auto-scaling-group \
--auto-scaling-group-name your-auto-scaling-group \
--min-size $int \
--max-size $int \
--desired-capacity $int \
--region us-east-2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Format:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;./autoscaling.sh 0
./autoscaling.sh 3
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>mysql ssl connection</title><link>http://uly.me/posts/mysql-ssl-connection/</link><pubDate>Mon, 27 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mysql-ssl-connection/</guid><description>&lt;p&gt;The standard way to connect to MySQL is:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql -h hostname -u user -p
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s how to connect to MySQL with SSL encryption.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql -h hostname -u user -p \
--ssl-ca=server-ca.pem \
--ssl-cert=client-cert.pem \
--ssl-key=client-key.pem
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Generate the SSL keys from the MySQL server. Download it to the client.&lt;/p&gt;</description></item><item><title>mysql restore</title><link>http://uly.me/posts/mysql-restore/</link><pubDate>Sun, 26 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mysql-restore/</guid><description>&lt;p&gt;Here’s how to restore a MySQL database from mysqldump.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql -u user -p
mysql&amp;gt; drop database databasename;
mysql&amp;gt; quit;
Bye
mysql -u user -p databasename
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Drop database first, then import the SQL file.&lt;/p&gt;</description></item><item><title>upgrade to ubuntu 20.04 lts</title><link>http://uly.me/posts/upgrade-to-ubuntu-20-04-lts/</link><pubDate>Sun, 26 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/upgrade-to-ubuntu-20-04-lts/</guid><description>&lt;p&gt;Now that Ubuntu 20.04 LTS (Long Term Support) is out, here’s a quick guide to upgrade to Ubuntu 20.04 LTS. You can ONLY upgrade from either Ubuntu 18.04 LTS or 19.10. If you have older versions of Ubuntu, it may not work. I suggest you back up your VM before running the upgrade, so you can quicky recover if something goes awry. This upgrade process will require sudo access.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# login as root
sudo -i
# check your current version
lsb_release -a
# update packages
apt update -y
apt upgrade -y
# reboot server
reboot
# remove old kernels
apt --purge autoremove
# install update manager core
apt install update-manager-core
# finally, perform the upgrade
do-release-upgrade -d
# reboot the server
reboot
# after reboot confirm
lsb_release -a
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>pfx to pem</title><link>http://uly.me/posts/pfx-to-pem/</link><pubDate>Wed, 22 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/pfx-to-pem/</guid><description>&lt;p&gt;Here’s how to convert SSL certificate from PFX to PEM format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
echo &amp;#34;This script converts SSL certificates from PFX to PEM.&amp;#34;
read -p &amp;#39;Enter PFX Certificate Name : &amp;#39; cert_pfx
read -p &amp;#39;Enter the Import Passphrase : &amp;#39; import_passphrase
openssl pkcs12 -in $cert_pfx -nocerts -out cert-key.pem -passin pass:$import_passphrase -passout pass:$import_passphrase
openssl pkcs12 -in $cert_pfx -clcerts -nokeys -out cert-body.pem -passin pass:$import_passphrase -passout pass:$import_passphrase
openssl pkcs12 -in $cert_pfx -nodes -nokeys -out cert-chain.pem -passin pass:$import_passphrase -passout pass:$import_passphrase
sleep 3
openssl rsa -in key.pem -out cert-private.key -passin pass:$import_passphrase -passout pass:$import_passphrase
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This was covered in an &lt;a href="https://uly.me/convert-pfx-to-pem-format/"&gt;earlier post&lt;/a&gt;, but this script prompts you for the passphrase.&lt;/p&gt;</description></item><item><title>waf cloudformation template</title><link>http://uly.me/posts/waf-cloudformation-template/</link><pubDate>Tue, 21 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/waf-cloudformation-template/</guid><description>&lt;p&gt;Here’s the &lt;a href="https://docs.aws.amazon.com/solutions/latest/aws-waf-security-automations/template.html"&gt;CloudFormation template&lt;/a&gt; for creating a WAF.&lt;/p&gt;
&lt;p&gt;Here are some options that you’ll be asked during creation.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Activate SQL Injection Protection ( yes | no )&lt;/li&gt;
&lt;li&gt;Activate Cross-site Scripting Protection ( yes | no )&lt;/li&gt;
&lt;li&gt;Activate HTTP Flood Protection ( WAF rate | Lambda log parser | Athena log parser | no )&lt;/li&gt;
&lt;li&gt;Activate Scanner &amp;amp; Probe Protection ( Lambda log parser | Athena log parser | no )&lt;/li&gt;
&lt;li&gt;Activate Reputation List Protection ( yes | no )&lt;/li&gt;
&lt;li&gt;Activate Bad Bot Protection ( yes | no )&lt;/li&gt;
&lt;li&gt;Endpoint Type (CloudFront or ALB)&lt;/li&gt;
&lt;li&gt;Application Access Log Bucket Name ( Leave blank if no S3 bucket)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The template creates 2 CloudFormation stacks.&lt;/p&gt;</description></item><item><title>aws waf ip set</title><link>http://uly.me/posts/aws-waf-ip-set/</link><pubDate>Fri, 17 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-waf-ip-set/</guid><description>&lt;p&gt;Here’s how to get the WAF rule.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws waf-regional get-rule \
--rule-id xxxxxxxxxxxxxxxxxxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s how to get the AWS WAF IP set.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws waf-regional get-ip-set \
--ip-set-id xxxxxxxxxxxxxxxxxxx \
--region us-east-1 \
--profile your-profile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s how to get the latest token.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws waf-regional get-change-token
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result is similar to this.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;ChangeToken&amp;#34;: &amp;#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a JSON file called “change.json” to be used for updating the IP set. We will insert and delete an IP set.&lt;/p&gt;</description></item><item><title>gcp instances by service account</title><link>http://uly.me/posts/gcp-instances-by-service-account/</link><pubDate>Tue, 14 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-instances-by-service-account/</guid><description>&lt;p&gt;Here’s how to get a list of GCP instances using a specific service account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances list \
--filter=&amp;#34;serviceAccounts.email=service-account@domain.com&amp;#34; \
--project project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To display all instances and their service accounts in JSON format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances list \
--format=&amp;#34;json(name,serviceAccounts[].email)&amp;#34; \
--project your-project-id
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Display in YAML which is also the Default.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances list \
--format=&amp;#34;default(name,serviceAccounts[].email)&amp;#34; \
--project your-project-id
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>s3 browser iam assume role</title><link>http://uly.me/posts/s3-browser-iam-assume-role/</link><pubDate>Sun, 12 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/s3-browser-iam-assume-role/</guid><description>&lt;p&gt;S3 Browser is a free Windows client for accessing AWS S3 buckets. You can access S3 buckets with an interface similar to File Manager. A typical setup requires that you use access and secret keys to connect to the S3 browser. However, if the server is in the cloud, it’s better that use a machine profile with an assume role. The assume role gets temporary credentials until they expire. They are automatically rotated by AWS behind the scenes for you. This is much safer process than storing key credentials in the cloud. The good news is, S3 Browser support IAM assume roles. Here’s the setup instructions to get your &lt;a href="https://s3browser.com/amazon-s3-via-assume-role.aspx"&gt;S3 Browser configured&lt;/a&gt; using IAM assume role. Here’s IAM role &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html"&gt;explained&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>video conferencing</title><link>http://uly.me/posts/video-conferencing/</link><pubDate>Sun, 12 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/video-conferencing/</guid><description>&lt;p&gt;Due to the Covid-19 lockdown, here are several video conferencing options.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.skype.com/en/"&gt;Microsoft Skype&lt;/a&gt; – been around for a long time.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://products.office.com/en-us/microsoft-teams/group-chat-software"&gt;Microsoft Teams&lt;/a&gt; – Microsoft wants everyone to switch to Teams.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://meet.google.com/?authuser=1"&gt;Google Meet&lt;/a&gt; – Uses the webRTC protocol. Video calls up to 10 people.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://discordapp.com/"&gt;Discord&lt;/a&gt; – Popular with gamers. Video chat capable up to 9 people.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://zoom.us/"&gt;Zoom&lt;/a&gt; – Got really hot, then took a dive due to zoombombing.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/chime/?chime-blog-posts.sort-by=item.additionalFields.createdDate&amp;amp;chime-blog-posts.sort-order=desc"&gt;Chime&lt;/a&gt; – Amazon Web Services video chat.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.webex.com/"&gt;Webex&lt;/a&gt; – Cisco’s video conferencing.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is not an extensive list, but are the popular options.&lt;/p&gt;</description></item><item><title>aws s3 ls recursive</title><link>http://uly.me/posts/aws-s3-ls-recursive/</link><pubDate>Sun, 05 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-ls-recursive/</guid><description>&lt;p&gt;Here’s how to list S3 files recursively.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3 ls s3://mybucket --recursive | awk &amp;#39;{print $4}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;By default, the results display date, time, disk size and filename. Use awk to display the filename only.&lt;/p&gt;</description></item><item><title>yum repo plugins</title><link>http://uly.me/posts/yum-repo-plugins/</link><pubDate>Thu, 02 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yum-repo-plugins/</guid><description>&lt;p&gt;Here’s how to disable plugin in Yum repos.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# check which plugins are enabled
yum repolist
# disable plugins
yum update --disableplugin=product-id,subscription-manager
# check agin
yum repolist
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If that doesn’t work, check the individual config files of each plugin.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /etc/yum/pluginconf.d/
vim product-id.conf
vim subscription-manager.conf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disable it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[main]
enable=0
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gitbash .bashrc</title><link>http://uly.me/posts/gitbash-bashrc/</link><pubDate>Wed, 01 Apr 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gitbash-bashrc/</guid><description>&lt;p&gt;Here’s how to find your GitBash .bashrc.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# cd takes you to gitbash home
cd
# edit .bashrc
vim ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can add aliases, change prompt styles, etc.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;export PS1=&amp;#34;\w: $ &amp;#34;
alias gcloud=&amp;#34;gcloud.cmd&amp;#34;
alias gsutil=&amp;#34;gsutil.cmd&amp;#34;
alias code=&amp;#34;cd ~/Code&amp;#34;
cd Code
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws xfs volume setup</title><link>http://uly.me/posts/aws-xfs-volume-setup/</link><pubDate>Tue, 31 Mar 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-xfs-volume-setup/</guid><description>&lt;p&gt;Here’s how to setup a XFS volume.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;file -s /dev/nvme2n1
mkfs -t xfs /dev/nvme2n1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount to /data.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir /data
mount /dev/nvme2n1 /data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add to /etc/fstab.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim /etc/fstab
#
#
UUID=xxxxxxxxxxxxxxxxxxxxxx /data xfs defaults 0 0
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>create swap disk</title><link>http://uly.me/posts/create-swap-disk/</link><pubDate>Sat, 28 Mar 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-swap-disk/</guid><description>&lt;p&gt;To see which disk is available for swap disk use.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsblk
blkid
df -Th
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Format the disk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fdisk /dev/xvda
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a swap disk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo mkswap -f /dev/xvda
sudo swapon -s /dev/xvda
# or
sudo swapon /dev/xvda
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check if swap disk is available.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsblk
free -h
cat /proc/swaps
cat /proc/meminfo
swapon -s
top
vmstat
vmstat 1 5
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp bucket size</title><link>http://uly.me/posts/gcp-bucket-size/</link><pubDate>Thu, 26 Mar 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-bucket-size/</guid><description>&lt;p&gt;Here are the commands to find out the bucket size in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gsutil du -s gs://bucket-name/
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp projects list</title><link>http://uly.me/posts/gcp-projects-list/</link><pubDate>Thu, 26 Mar 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-projects-list/</guid><description>&lt;p&gt;Here’s how to get a list of GCP projects.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud projects list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;PROJECT_ID NAME PROJECT_NUMBER
your-project-id-xxxx servers xxxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Use awk to display the project id only.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud projects list | awk &amp;#39;{print $1}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;PROJECT ID
your-project-id-xxxx
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ebs deleteontermination</title><link>http://uly.me/posts/ebs-deleteontermination/</link><pubDate>Sun, 22 Mar 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ebs-deleteontermination/</guid><description>&lt;p&gt;Here’s how to set the DeleteOnTermination setting on EBS volumes. The DeleteOnTermination flag determines if an EBS volume will be kept or deleted when an EC2 instance is terminated. The DeleteOnTermination setting can be set during EC2 instance creation, or it can be applied to an existing or a running EC2 instance. The settings can be placed in a JSON file and loaded using –block-device-mappings option upon creation.&lt;/p&gt;
&lt;p&gt;During creation.&lt;/p&gt;</description></item><item><title>nmap</title><link>http://uly.me/posts/nmap/</link><pubDate>Thu, 19 Mar 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nmap/</guid><description>&lt;p&gt;Here’s how to list all the devices on your network using nmap.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;nmap -sn 192.168.0.0/24
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If nmap is not installed, install it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install nmap
apt install nmap
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>netstat</title><link>http://uly.me/posts/netstat/</link><pubDate>Tue, 03 Mar 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/netstat/</guid><description>&lt;p&gt;Netstat is a utility for gathering network statistics. It comes preinstalled on most systems.&lt;/p&gt;
&lt;p&gt;If missing, here’s how to install.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Redhat, CentOS
yum install net-tools
# Debian, Ubuntu, Mint
apt install net-tools
# SLES, SUSE
zypper install net-tools
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here are some common and useful commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# show version
netstat -v
# show routing table
netstat -nr
# show network interface statistics
netstat -ai
# show network connections
netstat -ant
# show network services
netstat -tulpn
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>list available php modules</title><link>http://uly.me/posts/list-available-php-modules/</link><pubDate>Mon, 02 Mar 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/list-available-php-modules/</guid><description>&lt;p&gt;Here’s how to list the available PHP modules.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt-cache search php- | less
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To get details about a module.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt-cache show php-curl
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To install a module.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install php-curl
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or install all modules.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install php*
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart Apache after each install.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>run docker compose</title><link>http://uly.me/posts/run-docker-compose/</link><pubDate>Thu, 27 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-docker-compose/</guid><description>&lt;p&gt;Here’s how to run docker-compose. I have an Icecast docker-compose.yml file. Icecast is an audio streaming server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;version: &amp;#34;2&amp;#34;
services:
icecast:
image: moul/icecast
environment:
- ICECAST_SOURCE_PASSWORD=secret
- ICECAST_ADMIN_PASSWORD=secret
- ICECAST_PASSWORD=secret
- ICECAST_RELAY_PASSWORD=secret
ports:
- &amp;#34;8000:8000&amp;#34;
restart: always
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To run Icecast in a container , I run docker-compose in the background.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check to see if Icecast is running on your browser.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;http://localhost:8000
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To stop the Icecast container, I simply stop the docker-compose.&lt;/p&gt;</description></item><item><title>gcp sdk firewall rule ah and esp</title><link>http://uly.me/posts/gcp-sdk-firewall-rule-ah-and-esp/</link><pubDate>Wed, 26 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-sdk-firewall-rule-ah-and-esp/</guid><description>&lt;p&gt;Here’s how to add a GCP firewall rule with the AH (authentication header) and ESP (Encapsulating Security Payload) protocols.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules update &amp;#34;firewall-name&amp;#34; \
--description=&amp;#34;firewall description&amp;#34; \
--priority &amp;#34;1000&amp;#34; \
--target-service-accounts=&amp;#34;service-account@gserviceaccount.com&amp;#34; \
--destination-ranges=&amp;#34;10.0.0.0/8&amp;#34; \
--rules 50,51,tcp:80,udp:1000
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There is no need to add protocols for AH and ESP. Just the port numbers.&lt;/p&gt;</description></item><item><title>wheel group</title><link>http://uly.me/posts/wheel-group/</link><pubDate>Tue, 25 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wheel-group/</guid><description>&lt;p&gt;Here’s an alternate way to give Linux users sudo access by adding them to the wheel group. Most Linux systems come with the wheel group already predefined. By adding users to the wheel group, they now have the ability to sudo and run root commands. The wheel group is in the sudoers file for Redhat, Centos, Debian and Ubuntu.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;usermod -aG wheel username
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>splunk search for tanium clients</title><link>http://uly.me/posts/splunk-search-for-tanium-clients/</link><pubDate>Mon, 24 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/splunk-search-for-tanium-clients/</guid><description>&lt;p&gt;Here’s the Splunk search for Tanium clients reporting to the Tanium server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;#34;data.jsonPayload.rule_details.direction&amp;#34;=EGRESS
&amp;#34;data.jsonPayload.connection.src_ip&amp;#34;=&amp;#34;10.0.0.1&amp;#34;
&amp;#34;data.jsonPayload.connection.dest_port&amp;#34;=17472
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp sdk firewall update</title><link>http://uly.me/posts/gcp-sdk-firewall-update/</link><pubDate>Sun, 23 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-sdk-firewall-update/</guid><description>&lt;p&gt;Here’s how to update an existing GCP firewall.&lt;/p&gt;
&lt;p&gt;Ingress&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules update &amp;#34;firewall-rule-name&amp;#34; \
--description=&amp;#34;firewall description&amp;#34; \
--priority=&amp;#34;1000&amp;#34;
--target-service-accounts=&amp;#34;service-account@gserviceaccount.com&amp;#34; \
--source-ranges=&amp;#34;10.0.0.0/8&amp;#34;
--rules tcp:80,tcp:443,udp:1000-1100
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Egress&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules update &amp;#34;firewall-rule-name&amp;#34; \
--description=&amp;#34;firewall description&amp;#34; \
--priority=&amp;#34;1000&amp;#34;
--target-service-accounts=&amp;#34;service-account@gserviceaccount.com&amp;#34; \
--destination-ranges=&amp;#34;10.0.0.0/8&amp;#34;
--rules tcp:80,tcp:443,udp:1000-1100
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wowza 4.8.0 scripts</title><link>http://uly.me/posts/wowza-4-8-0-scripts/</link><pubDate>Sat, 22 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wowza-4-8-0-scripts/</guid><description>&lt;p&gt;Here are the start and stop scripts for the lastest Wowza version 4.8.0.&lt;/p&gt;
&lt;p&gt;Start scripts&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo service WowzaStreamingEngine start
# or
/etc/init.d/WowzaStreamingEngine start
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Stop scripts&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo service WowzaStreamingEngine stop
# or
/etc/init.d/WowzaStreamingEngine stop
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws register instances with load balancer</title><link>http://uly.me/posts/aws-register-instances-with-load-balancer/</link><pubDate>Wed, 19 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-register-instances-with-load-balancer/</guid><description>&lt;p&gt;Here’s the AWS CLI to register instances to a load balancer.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws elb register-instances-with-load-balancer \
--load-balancer-name my-load-balancer \
--instances i-xxxxxxxxxxx i-xxxxxxxxxxx i-xxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>redhat needs restarting</title><link>http://uly.me/posts/redhat-needs-restarting/</link><pubDate>Wed, 19 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/redhat-needs-restarting/</guid><description>&lt;p&gt;Here’s the command to determine if a host needs rebooting after system updates in Redhat.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ needs-restarting
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>chroot shortcut</title><link>http://uly.me/posts/chroot-shortcut/</link><pubDate>Sat, 15 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/chroot-shortcut/</guid><description>&lt;p&gt;Here’s a quick way to setup a chrooted environment.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mkdir /helper
for i in proc sys dev; do mount o bind /$i /helper/$i; done
chroot /helper
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>grub fixes</title><link>http://uly.me/posts/grub-fixes/</link><pubDate>Sat, 15 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/grub-fixes/</guid><description>&lt;p&gt;This are grub fixes to servers that are not booting up due to improper entries in the grub menu.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;grub --batch
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The fix includes replacing (hd0) with (hd0,0) and /dev/sda with /dev/hda.&lt;/p&gt;</description></item><item><title>disable host key checking</title><link>http://uly.me/posts/disable-host-key-checking/</link><pubDate>Sun, 09 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/disable-host-key-checking/</guid><description>&lt;p&gt;How to suppress typing “yes” when prompted by ssh.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
ssh-keygen -f &amp;#34;/home/user/.ssh/known_hosts&amp;#34; -R &amp;#34;yourdomain.com&amp;#34;
ssh -o &amp;#34;StrictHostKeyChecking=no&amp;#34; -i &amp;#34;keys/key.pem&amp;#34; ubuntu@domain.com
&lt;/code&gt;&lt;/pre&gt;&lt;ol&gt;
&lt;li&gt;First remove old keys in the know_hosts file.&lt;/li&gt;
&lt;li&gt;Use “StrictHostKeyChecking” to suppress prompt.&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>install go on linux mint 19.3</title><link>http://uly.me/posts/install-go-on-linux-mint-19-3/</link><pubDate>Sun, 09 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-go-on-linux-mint-19-3/</guid><description>&lt;p&gt;Here’s how to install Go on Ubuntu Linux Mint 19.3.&lt;/p&gt;
&lt;p&gt;Download the latest from &lt;a href="https://golang.org/dl/"&gt;https://golang.org/dl/&lt;/a&gt;.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check the checksum.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sha256sum go1.13.linux-amd64.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Extract the Go tarball to the /usr/local directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Edit your Bash profile to add Go’s path.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd ~
vim ~/.profile
# Add Go&amp;#39;s path
export PATH=$PATH:/usr/local/go/bin
# Load the profile
source ~/.profile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check if Go is installed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;go version
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;go version go1.13 linux/amd64
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>python pythagorean theorem</title><link>http://uly.me/posts/python-pythagorean-theorem/</link><pubDate>Sun, 09 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/python-pythagorean-theorem/</guid><description>&lt;p&gt;Here’s a simple Python program that calculates the hypotenuse of a right angle triangle using the Pythagorean Theory.&lt;/p&gt;
&lt;p&gt;a&lt;sup&gt;2&lt;/sup&gt; + b&lt;sup&gt;2&lt;/sup&gt; = c&lt;sup&gt;2&lt;/sup&gt;&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/usr/local/bin/python3
import math
print(&amp;#34;================================================&amp;#34;)
print(&amp;#34;This program will calculate pythagorean theorem.&amp;#34;)
print(&amp;#34;================================================&amp;#34;)
side_A = float(input(&amp;#34;Enter side A: &amp;#34;))
side_B = float(input(&amp;#34;Enter side B: &amp;#34;))
def pythagoreamTherem(side_A, side_B):
side_C = math.sqrt(side_A * side_A + side_B * side_B)
return side_C
side_C = pythagoreamTherem(side_A, side_B)
print(&amp;#34;&amp;#34;)
print(&amp;#34;Side C is: &amp;#34; + &amp;#34;%.2f&amp;#34; % round(side_C,2))
print(&amp;#34;&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output&lt;/p&gt;</description></item><item><title>standard ssl policy</title><link>http://uly.me/posts/standard-ssl-policy/</link><pubDate>Sun, 09 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/standard-ssl-policy/</guid><description>&lt;p&gt;Here’s a standard template for SSL Apache found in /etc/apache2/sites-available/default-ssl.conf.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;ifmodule mod_ssl.c=&amp;#34;&amp;#34;&amp;gt;
&amp;lt;virtualhost _default_:443=&amp;#34;&amp;#34;&amp;gt;
ServerAdmin your-email@your-domain.com
ServerName www.yourdomain.com
ServerName yourdomain.com
DocumentRoot /var/www/your-domain.com
ErrorLog /var/www/your-domain.com/log/error.log
CustomLog /var/www/your-domain.com/log/access.log combined
&amp;lt;directory&amp;gt;
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
&amp;lt;/directory&amp;gt;
SSLCertificateFile /etc/letsencrypt/live/your-domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/your-domain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
&amp;lt;/virtualhost&amp;gt;
&amp;lt;/ifmodule&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Enable SSL.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Enable SSL Module
a2enmod ssl
systemctl restart apache2.service
# Enable SSL Apache Config
a2ensite default-ssl
systemctl restart apache2.service
# Alternate way to restart.
service apache2 restart
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>display sequential write throughput</title><link>http://uly.me/posts/display-sequential-write-throughput/</link><pubDate>Wed, 05 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-sequential-write-throughput/</guid><description>&lt;p&gt;Here’s a dd command to display sequential write throughput from the command line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;time dd if=/dev/zero of=/mounted_backup_volume/zero.raw bs=1M count=512 status=progress
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output is.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 0.667813 s, 804 MB/s
real 0m0.669s
user 0m0.000s
sys 0m0.359s
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>replace spaces with comma</title><link>http://uly.me/posts/replace-spaces-with-comma/</link><pubDate>Tue, 04 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/replace-spaces-with-comma/</guid><description>&lt;p&gt;Here’s a simple sed command to replace multiple spaces into a comma delimited file.&lt;/p&gt;
&lt;p&gt;sample.txt&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;one two
three four
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The sed command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sed &amp;#39;s/ \+ /,/g&amp;#39; sample.txt &amp;gt; sample2.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;sample2.txt&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;one,two
three,four
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli s3 recursive copy</title><link>http://uly.me/posts/aws-cli-s3-recursive-copy/</link><pubDate>Sun, 02 Feb 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-s3-recursive-copy/</guid><description>&lt;p&gt;Here’s how to copy multiple files recursively using AWS CLI. The S3 cp command by default only copies a single file. To copy multiple files, you have to use the –recursive option along with –exclude and –include. In this example, we will exclude every file, but include only files with a json extension.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3 cp /tmp/folder s3://bucket/folder \
--recursive
--exclude &amp;#34;*&amp;#34;
--include &amp;#34;*.json&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;upload: ./abc.json to s3://bucket/folder/abc.json
upload: ./xyz.json to s3://bucket/folder/xyz.json
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>standard s3 policy</title><link>http://uly.me/posts/standard-s3-policy/</link><pubDate>Tue, 28 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/standard-s3-policy/</guid><description>&lt;p&gt;Here’s a standard S3 policy to grant an IAM user access to a bucket within an AWS account. User is allowed to add, update, and delete objects. These 3 actions s3:ListAllMyBuckets, s3:GetBucketLocation, and s3:ListBucket are the additional permissions required to access the console. Also, the s3:PutObjectAcl and the s3:GetObjectAcl actions are required to be able to copy, cut, and paste objects within the console.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;:&amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;:[
{
&amp;#34;Effect&amp;#34;:&amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;:[
&amp;#34;s3:ListAllMyBuckets&amp;#34;
],
&amp;#34;Resource&amp;#34;:&amp;#34;arn:aws:s3:::*&amp;#34;
},
{
&amp;#34;Effect&amp;#34;:&amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;:[
&amp;#34;s3:ListBucket&amp;#34;,
&amp;#34;s3:GetBucketLocation&amp;#34;
],
&amp;#34;Resource&amp;#34;:&amp;#34;arn:aws:s3:::examplebucket&amp;#34;
},
{
&amp;#34;Effect&amp;#34;:&amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;:[
&amp;#34;s3:PutObject&amp;#34;,
&amp;#34;s3:PutObjectAcl&amp;#34;,
&amp;#34;s3:GetObject&amp;#34;,
&amp;#34;s3:GetObjectAcl&amp;#34;,
&amp;#34;s3:DeleteObject&amp;#34;
],
&amp;#34;Resource&amp;#34;:&amp;#34;arn:aws:s3:::examplebucket/*&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wordpress permalinks not working</title><link>http://uly.me/posts/wordpress-permalinks-not-working/</link><pubDate>Tue, 28 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-permalinks-not-working/</guid><description>&lt;p&gt;Here’s a couple of things you can do to check if WordPress permalinks is not working.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make sure .htaccess has the right permissions.&lt;/li&gt;
&lt;li&gt;Make sure a2enmod Apache module is enabled.&lt;/li&gt;
&lt;li&gt;Restart the Apache server.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;chmod 664 /var/www/domain.com/.htaccess
a2enmod rewrite
systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>set linux time zone</title><link>http://uly.me/posts/set-linux-time-zone/</link><pubDate>Mon, 27 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/set-linux-time-zone/</guid><description>&lt;p&gt;Here’s another way of setting Linux time zone.&lt;/p&gt;
&lt;p&gt;Check server time.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# check server time
date
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change to local time.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# set to local time
rm /etc/localtime
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check server time again.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# check server time again
date
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash convert bytes</title><link>http://uly.me/posts/bash-convert-bytes/</link><pubDate>Sun, 26 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-convert-bytes/</guid><description>&lt;p&gt;Here’s a function to convert bytes into kilo, mega, giga, tera up to zeta bytes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function convert_bytes {
bytes=$credits
b=${bytes:-0}; d=&amp;#39;&amp;#39;; s=0; S=(Bytes {K,M,G,T,E,P,Y,Z}B)
while ((b &amp;gt; 1024)); do
d=&amp;#34;$(printf &amp;#34;.%02d&amp;#34; $((b % 1000 * 100 / 1000)))&amp;#34;
b=$((b / 1000))
let s++
done
echo &amp;#34;$b$d ${S[$s]}&amp;#34;
}
credits=2308974418330
echo $credits
convert_bytes $credits
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result is:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;2308974418330
2.30 TB
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>tasksel lampserver</title><link>http://uly.me/posts/tasksel-lampserver/</link><pubDate>Fri, 24 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tasksel-lampserver/</guid><description>&lt;p&gt;&lt;a href="http://wiki.debian.org/tasksel"&gt;Tasksel&lt;/a&gt; is a Debian/Ubuntu tool that installs multiple related packages as a co-ordinated “task” onto your system. It’s similar to meta-packages where tasks are dericed from from Ubuntu package managers like Synaptic or KPackageKit.&lt;/p&gt;
&lt;p&gt;Here’s a quickway to install a lamp server.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# install tasksel first if you don&amp;#39;t have it.
apt install tasksel
# install a lamp server package
tasksel install lamp-server
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wordpress salt</title><link>http://uly.me/posts/wordpress-salt/</link><pubDate>Fri, 24 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-salt/</guid><description>&lt;p&gt;Here’s a quick way to autogenerate salt for WordPress.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;curl -s https://api.wordpress.org/secret-key/1.1/salt/
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>google sdk install on debian or ubuntu</title><link>http://uly.me/posts/google-sdk-install-on-debian-or-ubuntu/</link><pubDate>Thu, 23 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/google-sdk-install-on-debian-or-ubuntu/</guid><description>&lt;p&gt;Here’s the script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo &amp;#34;deb [signed-by=/usr/share/keyrings/cloud.google.gpg] \
https://packages.cloud.google.com/apt cloud-sdk main&amp;#34; | \
sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get install apt-transport-https ca-certificates
sudo curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install google-cloud-sdk
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws display iam certificates</title><link>http://uly.me/posts/aws-display-iam-certificates/</link><pubDate>Wed, 22 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-display-iam-certificates/</guid><description>&lt;p&gt;SSL certificates were uploaded to IAM prior to Certificate Manager. Unfortunately, the certificates are not visible from the IAM console. There’s no way to view when a certificate is expiring. So, here’s how to display IAM certificates from the AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam list-server-certificates
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>determine usb format type</title><link>http://uly.me/posts/determine-usb-format-type/</link><pubDate>Tue, 21 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/determine-usb-format-type/</guid><description>&lt;p&gt;Here’s how to determine what type of USB format a thumb drive is in Linux.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;df -Th (shows the file system type)&lt;/li&gt;
&lt;li&gt;lsblk (shows the block devices)&lt;/li&gt;
&lt;li&gt;lsusb (show usb ports and devices)&lt;/li&gt;
&lt;li&gt;fdisk -l (displays the USB format type)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To display, use “fdisk -l” to display either NTFS, FAT32 or exFAT32.&lt;/p&gt;</description></item><item><title>linux prompt</title><link>http://uly.me/posts/linux-prompt/</link><pubDate>Mon, 20 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-prompt/</guid><description>&lt;p&gt;Here’s my favorite Linux prompt.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;PS1=&amp;#39;\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ &amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add to end of your .bashrc to make it permanent.&lt;/p&gt;</description></item><item><title>gcp start multiple instances</title><link>http://uly.me/posts/gcp-start-multiple-instances/</link><pubDate>Sun, 19 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-start-multiple-instances/</guid><description>&lt;p&gt;Here’s how to start multiple instances using Bash and Google SDK.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
while IFS=&amp;#39;, &amp;#39; read -r a b c; do
instance=&amp;#34;${a//[[:blank:]]/}&amp;#34;
project=&amp;#34;${b//[[:blank:]]/}&amp;#34;
zone=&amp;#34;${c//[[:blank:]]/}&amp;#34;
echo &amp;#34;Starting $instance ....&amp;#34;
gcloud compute instances start $instance \
--zone $zone --project $project --async
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Instances are read from an external file. The file format is displayed below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;server1,project1,us-central1-a
server2,project2,us-central1-b
server3,project3,us-central1-c
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To stop multiple instances, replace &amp;ldquo;start&amp;rdquo; with &amp;ldquo;stop.&amp;rdquo;&lt;/p&gt;</description></item><item><title>gcp check instances running</title><link>http://uly.me/posts/gcp-check-instances-running/</link><pubDate>Sat, 18 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-check-instances-running/</guid><description>&lt;p&gt;Here’s how to check if instances are running in GCP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
while IFS=&amp;#39;, &amp;#39; read -r a b c; do
instance=&amp;#34;${a//[[:blank:]]/}&amp;#34;
project=&amp;#34;${b//[[:blank:]]/}&amp;#34;
zone=&amp;#34;${c//[[:blank:]]/}&amp;#34;
gcloud compute instances describe $instance \
--zone $zone --project $project \
--format=&amp;#39;table[no-heading](name,status,zone)&amp;#39;
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Instances are read from an external file. File is comma delimited with instance name, project id and zone data.&lt;/p&gt;</description></item><item><title>terraform first class expressions</title><link>http://uly.me/posts/terraform-first-class-expressions/</link><pubDate>Thu, 16 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-first-class-expressions/</guid><description>&lt;p&gt;If you were running the older versions of Terraform, with release 0.12 and higher, there will be certain parts of your script that are no longer supported. Terraform uses expressions for dynamic configuration and dependencies. First-class expressions enable variables and operations to be performed outside of strings. In Terraform 0.11 and earlier all expressions were required to be part of interpolations in existing strings, such as “${var.foo}.&lt;/p&gt;
&lt;p&gt;In Terraform 0.11.&lt;/p&gt;</description></item><item><title>aws iam tag user</title><link>http://uly.me/posts/aws-iam-tag-user/</link><pubDate>Wed, 15 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-iam-tag-user/</guid><description>&lt;p&gt;Here’s how to add tags to an existing user.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam tag-user \
--user-name ulysses \
--tags &amp;#34;Key&amp;#34;=&amp;#34;dept&amp;#34;,&amp;#34;Value&amp;#34;=&amp;#34;it&amp;#34; &amp;#34;Key&amp;#34;=&amp;#34;role&amp;#34;,&amp;#34;Value&amp;#34;=&amp;#34;admin&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Tags with identical keys are overwritten. New keys are added.&lt;/p&gt;</description></item><item><title>netapp unlock file</title><link>http://uly.me/posts/netapp-unlock-file/</link><pubDate>Wed, 15 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/netapp-unlock-file/</guid><description>&lt;p&gt;To get status of a file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lock status -f &amp;#34;/vol/folder/path/filename.doc&amp;#34; -p cifs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To unlock a file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lock break -f &amp;#34;/vol/folder/path/filename.doc&amp;#34; -p cifs
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp ilb issue targets not healthy</title><link>http://uly.me/posts/gcp-ilb-issue-targets-not-healthy/</link><pubDate>Tue, 14 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-ilb-issue-targets-not-healthy/</guid><description>&lt;p&gt;I ran into an issue with Google Compute Engine TCP internal load balancer. The targets are unhealthy although all configs were correct installed. At one time the targets were working, but somehow they became unhealthy. In the end, 3 things needed to be checked.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make sure GCP’s guest environment is installed.&lt;/li&gt;
&lt;li&gt;Add the internal load balancer VIP address to the network properties.&lt;/li&gt;
&lt;li&gt;Add route via cmd. “route ADD VIP MASK 255.255.255.255”&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You will need to change the server’s IP from DHCP to static to add ILB VIP.&lt;/p&gt;</description></item><item><title>iam list access keys</title><link>http://uly.me/posts/iam-list-access-keys/</link><pubDate>Tue, 14 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/iam-list-access-keys/</guid><description>&lt;p&gt;Here’s how to list all the access keys in AWS via Python.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import logging
import boto3
from botocore.exceptions import ClientError
# set aws profile
session = boto3.Session(profile_name=&amp;#34;default&amp;#34;)
# get list of users
iam = session.client(&amp;#39;iam&amp;#39;)
users = iam.list_users()
# display results
print(&amp;#34;{0:
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>windows route add</title><link>http://uly.me/posts/windows-route-add/</link><pubDate>Tue, 14 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/windows-route-add/</guid><description>&lt;p&gt;Here’s how to add a route in Windows. Open CMD as Administrator.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;route add 10.10.10.10 mask 255.255.255.0 10.10.10.254
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To make it persistent, add -p.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;route add 10.10.10.10 mask 255.255.255.0 10.10.10.254
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To display. Specifies IP 4 only.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;route print -4
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>vm stats</title><link>http://uly.me/posts/vm-stats/</link><pubDate>Mon, 13 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vm-stats/</guid><description>&lt;p&gt;To check VM stats, use the following commands.&lt;/p&gt;
&lt;p&gt;To see used and unused memory, swap space.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;free
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To see RAM details.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo dmidecode -t 17
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To see number of processors.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;nproc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To see CPU details.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lscpu
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>docker to gcr</title><link>http://uly.me/posts/docker-to-gcr/</link><pubDate>Sun, 12 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/docker-to-gcr/</guid><description>&lt;p&gt;Here’s a couple of steps to move a Docker image to the Google Container Registry.&lt;/p&gt;
&lt;p&gt;Create a container image.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker build -t gcr.io/${PROJECT_ID}/my-app:v1 .
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Push image to GCR.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker push gcr.io/[PROJECT-ID]/[IMAGE]
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>feedburner https feed</title><link>http://uly.me/posts/feedburner-https-feed/</link><pubDate>Sun, 12 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/feedburner-https-feed/</guid><description>&lt;p&gt;When Google acquired Feedburner a few years ago, we thought it would make Feedburner a better product. The opposite has happened. Google has basically shelved the Feedburner product. There hasn’t been any updates to Feedburner the last 5 years.&lt;/p&gt;
&lt;p&gt;If you’ve recently updated your site from http to https, you may have noticed that https feeds are not supported. It looks like Google doesn’t plan on updating Feedburner anytime soon. If you want to replace Feedburner, take a look at couple of options. Try FeedBlitz or perhaps even Mailchimp.&lt;/p&gt;</description></item><item><title>use object versioning with cloudfront</title><link>http://uly.me/posts/use-object-versioning-with-cloudfront/</link><pubDate>Sat, 11 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/use-object-versioning-with-cloudfront/</guid><description>&lt;p&gt;If you are using AWS CloudFront, you can avoid costly invalidations by using object versioning. Due to the nature of CloudFront, overwriting to the same file will not have any effect until caching is invalidated. The default timeout for CloudFront is 24 hours. If you have a website and you’ve overwritten your logo image, the updated image file will not be reflected on your site due to the caching timeout is 24 hours. To avoid invalidation, enable object versioning by adding a policy when overwriting files.&lt;/p&gt;</description></item><item><title>aws boto3 client</title><link>http://uly.me/posts/aws-boto3-client/</link><pubDate>Thu, 09 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-boto3-client/</guid><description>&lt;p&gt;Boto is the Amazon Web Services (AWS) SDK for Python. It enables Python developers to create, configure, and manage AWS services, such as EC2 and S3. Boto provides an easy to use, object-oriented API, as well as low-level access to AWS services.&lt;/p&gt;
&lt;p&gt;Here’s a quick example how to query for AWS resources.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import logging
import boto3
from botocore.exceptions import ClientError
# set aws profile
session = boto3.Session(profile_name=&amp;#34;default&amp;#34;)
# get buckets
s3 = session.client(&amp;#39;s3&amp;#39;)
results = s3.list_buckets()
# display buckets
print(&amp;#39;Existing buckets:&amp;#39;)
for key in results[&amp;#39;Buckets&amp;#39;]:
print(f&amp;#39;{key[&amp;#34;Name&amp;#34;]}&amp;#39;)
# get ec2 instances. set region.
ec2 = session.client(&amp;#39;ec2&amp;#39;, region_name=&amp;#39;us-east-1&amp;#39;)
results = ec2.describe_instances()
# display instances
for key in results[&amp;#34;Reservations&amp;#34;]:
for instance in key[&amp;#34;Instances&amp;#34;]:
instance_id = instance[&amp;#34;InstanceId&amp;#34;]
instance_type = instance[&amp;#34;InstanceType&amp;#34;]
availability_zone = instance[&amp;#34;Placement&amp;#34;][&amp;#34;AvailabilityZone&amp;#34;]
print(instance_id + &amp;#34;\t&amp;#34; + instance_type + &amp;#34;\t&amp;#34; + availability_zone)
# get list of users
client = session.client(&amp;#39;iam&amp;#39;)
results = client.list_users()
# display list of users
for key in results[&amp;#39;Users&amp;#39;]:
print (key[&amp;#39;UserName&amp;#39;])
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp web server</title><link>http://uly.me/posts/gcp-web-server/</link><pubDate>Wed, 08 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-web-server/</guid><description>&lt;p&gt;Here’s a quick script to stand up a web server based on Centos image.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances create [VM-NAME] \
--zone=[ZONE] \
--image-family=debian-9 \
--image-project=debian-cloud \
--tags=allow-ssh,allow-health-check \
--subnet=lb-subnet \
--metadata=startup-script=&amp;#39;#! /bin/bash
apt-get update
apt-get install apache2 -y
a2ensite default-ssl
a2enmod ssl
vm_hostname=&amp;#34;$(curl -H &amp;#34;Metadata-Flavor:Google&amp;#34; \
http://169.254.169.254/computeMetadata/v1/instance/name)&amp;#34;
echo &amp;#34;Page served from: $vm_hostname&amp;#34; | \
tee /var/www/html/index.html
systemctl restart apache2&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>split a large file</title><link>http://uly.me/posts/split-a-large-file/</link><pubDate>Tue, 07 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/split-a-large-file/</guid><description>&lt;p&gt;How to split a large file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;split -b 500MB httpd.log
ll -lh
total 1.9G
-rw-r--r-- 1 root root 954M Mar 25 12:35 httpd.log
-rw-r--r-- 1 root root 477M Mar 25 12:38 xaa
-rw-r--r-- 1 root root 477M Mar 25 12:38 xab
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Split with an output file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;split -b 200M httpd.log split.log
ll -lh
total 1.9G
-rw-r--r-- 1 root root 954M Mar 25 12:35 httpd.log
-rw-r--r-- 1 root root 200M Mar 25 12:52 split.logaa
-rw-r--r-- 1 root root 200M Mar 25 12:52 split.logab
-rw-r--r-- 1 root root 200M Mar 25 12:52 split.logac
-rw-r--r-- 1 root root 200M Mar 25 12:52 split.logad
-rw-r--r-- 1 root root 154M Mar 25 12:52 split.logae
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>scp</title><link>http://uly.me/posts/scp/</link><pubDate>Mon, 06 Jan 2020 00:00:00 +0000</pubDate><guid>http://uly.me/posts/scp/</guid><description>&lt;p&gt;SCP is similar to the CP or copy command, but it’s done via a secure network.&lt;/p&gt;
&lt;p&gt;Here’s a CP command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cp /dir1/filename /dir2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can use SCP to copy file to another system. It requires login.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;scp /dir1/filename user@server:/home/user
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is using SCP to copy a file from 2 remote systems.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;scp user@host1:/home/user/dir1/file.txt user@host2:/home/user/dir2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cloudwatch efs burst credits</title><link>http://uly.me/posts/aws-cloudwatch-efs-burst-credits/</link><pubDate>Tue, 31 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cloudwatch-efs-burst-credits/</guid><description>&lt;p&gt;Here’s how to get the EFS Burst Credits from CloudWatch via AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws cloudwatch get-metric-statistics \
--namespace &amp;#34;AWS/EFS&amp;#34; \
--metric-name BurstCreditBalance \
--dimensions &amp;#34;Name=FileSystemId,Value=fs-xxxxxxx&amp;#34; \
--start-time 2019-12-31T00:00:00Z \
--end-time 2019-12-31T01:00:00Z \
--statistics Average \
--period 3600 \
--profile default
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Notice the start time, end time, period and statistics. Here’s the CLI &lt;a href="https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/get-metric-statistics.html"&gt;doc&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>aws rds backup permission</title><link>http://uly.me/posts/aws-rds-backup-permission/</link><pubDate>Tue, 31 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-rds-backup-permission/</guid><description>&lt;p&gt;Here’s the IAM policy to allow RDS Backup or create a snapshot on AWS.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Sid&amp;#34;: &amp;#34;VisualEditor0&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;rds:RestoreDBClusterFromSnapshot&amp;#34;,
&amp;#34;rds:DescribeDBSnapshots&amp;#34;,
&amp;#34;rds:CopyDBSnapshot&amp;#34;,
&amp;#34;rds:CopyDBClusterSnapshot&amp;#34;,
&amp;#34;rds:DeleteDBSnapshot&amp;#34;,
&amp;#34;rds:DeleteDBClusterSnapshot&amp;#34;,
&amp;#34;rds:CreateDBSnapshot&amp;#34;,
&amp;#34;rds:RestoreDBInstanceFromDBSnapshot&amp;#34;,
&amp;#34;rds:CreateDBInstance&amp;#34;,
&amp;#34;rds:DescribeDBClusterSnapshots&amp;#34;,
&amp;#34;rds:DescribeDBInstances&amp;#34;,
&amp;#34;rds:DescribeDBClusters&amp;#34;,
&amp;#34;rds:DeleteDBInstance&amp;#34;,
&amp;#34;rds:CreateDBClusterSnapshot&amp;#34;,
&amp;#34;rds:ModifyDBSnapshotAttribute&amp;#34;,
&amp;#34;rds:ModifyDBClusterSnapshotAttribute&amp;#34;,
&amp;#34;rds:ListTagsForResource&amp;#34;,
&amp;#34;rds:DeleteDBCluster&amp;#34;,
&amp;#34;ec2:DescribeSecurityGroups&amp;#34;,
&amp;#34;ec2:DescribeRegions&amp;#34;,
&amp;#34;ec2:DescribeAvailabilityZones&amp;#34;,
&amp;#34;ec2:DescribeVpcs&amp;#34;,
&amp;#34;ec2:DescribeAccountAttributes&amp;#34;,
&amp;#34;ec2:DescribeSubnets&amp;#34;,
&amp;#34;iam:GetUser&amp;#34;,
&amp;#34;iam:GetAccountAuthorizationDetails&amp;#34;,
&amp;#34;kms:ReEncrypt*&amp;#34;,
&amp;#34;kms:GenerateDataKey*&amp;#34;,
&amp;#34;kms:CreateGrant&amp;#34;,
&amp;#34;kms:DescribeKey*&amp;#34;,
&amp;#34;kms:ListKeys&amp;#34;,
&amp;#34;kms:ListAliases&amp;#34;,
&amp;#34;kms:Encrypt&amp;#34;,
&amp;#34;kms:Decrypt&amp;#34;,
&amp;#34;kms:GenerateDataKeyWithoutPlaintext&amp;#34;,
&amp;#34;kms:ListKeys&amp;#34;,
&amp;#34;kms:ListAliases&amp;#34;,
&amp;#34;kms:ListResourceTags&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wordpress asking for ftp details</title><link>http://uly.me/posts/wordpress-asking-for-ftp-details/</link><pubDate>Thu, 26 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-asking-for-ftp-details/</guid><description>&lt;p&gt;If WordPress is asking for FTP details when you’re trying to update a theme, plugin, or WordPress itself, you will need to edit your wp-config.php file to add the following line to your configuration.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;define(&amp;#39;FS_METHOD&amp;#39;,&amp;#39;direct&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Save the file and try updating again. It shouldn’t ask you for FTP details.&lt;/p&gt;</description></item><item><title>apache dockerfile</title><link>http://uly.me/posts/apache-dockerfile/</link><pubDate>Wed, 25 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/apache-dockerfile/</guid><description>&lt;p&gt;This Docker image contains Apache (httpd), a web server.&lt;/p&gt;
&lt;p&gt;Here’s the Dockerfile.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Build and run your Docker image.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker build -t my-app .
docker run -dit --name my-running-app -p 8080:80 my-app
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Visit http://localhost:8080 to view your app.&lt;/p&gt;</description></item><item><title>gcp static ip</title><link>http://uly.me/posts/gcp-static-ip/</link><pubDate>Wed, 25 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-static-ip/</guid><description>&lt;p&gt;Create a static IP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute addresses create your-app-static-ip \
--region us-central1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List static IP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute addresses list your-static-ip-name --region us-central1
# or
gcloud compute addresses list --filter=&amp;#34;name=(&amp;#39;live-tfc-static-ip-address&amp;#39;)&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Release static IP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute addresses delete your-app-static-ip \
--region us-central1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>static website on gke</title><link>http://uly.me/posts/static-website-on-gke/</link><pubDate>Wed, 25 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/static-website-on-gke/</guid><description>&lt;p&gt;Here’s how to run your web application on Google Kubernetes Engine.&lt;/p&gt;
&lt;p&gt;Create a Dockerfile. Place your web pages in the public-html directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Build a container image for Google Container Registry (GCR).&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# set your project
export PROJECT_ID=[project_id]
# build a container image
docker build -t gcr.io/${PROJECT_ID}/your-app:v1 .
# verify docker images
docker images
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Upload the container image to GCR.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# authenticate
gcloud auth configure-docker
# upload image
docker push gcr.io/${PROJECT_ID}/your-app:v1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a container GKE cluster.&lt;/p&gt;</description></item><item><title>xcode after catalina upgrade</title><link>http://uly.me/posts/xcode-after-catalina-upgrade/</link><pubDate>Wed, 25 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/xcode-after-catalina-upgrade/</guid><description>&lt;p&gt;I tried running git after the Mac OS Catalina upgrade and got this error.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the fix. For some very odd reason, Apple does not automatically reinstall xcode after each Mac OS upgrade.&lt;/p&gt;
&lt;p&gt;You will need to either reset it or install it again.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Try reset first
xcode-select --reset
# Or install it if reset doesn&amp;#39;t work
xcode-select --install
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Close your terminal, and reopen and run git again.&lt;/p&gt;</description></item><item><title>gcp sdk auth login</title><link>http://uly.me/posts/gcp-sdk-auth-login/</link><pubDate>Tue, 24 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-sdk-auth-login/</guid><description>&lt;p&gt;Here’s how to login to GCP from Google SDK.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth login
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;Click on the URL to authenticate on your browser.&lt;/li&gt;
&lt;li&gt;Login with your Google Account. Use MFA if prompted.&lt;/li&gt;
&lt;li&gt;Click Allow when prompted.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You will then be taken to a page that you have successfully logged in.&lt;/p&gt;</description></item><item><title>aws efs /etc/fstab</title><link>http://uly.me/posts/aws-efs-etc-fstab/</link><pubDate>Mon, 23 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-efs-etc-fstab/</guid><description>&lt;p&gt;To automatically mount a EFS volume after each reboot, you’ll need to add the following format to /etc/fstab.&lt;/p&gt;
&lt;p&gt;You can use the DNS name given by AWS.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fs-12345678:/ /mnt/efs efs defaults,_netdev 0 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or the IP address.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;10.0.0.22:/ /mnt/efs efs defaults,_netdev 0 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount all with fake and verbose.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mount -fav
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp setup nlb</title><link>http://uly.me/posts/gcp-setup-nlb/</link><pubDate>Mon, 23 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-setup-nlb/</guid><description>&lt;p&gt;Here’s how to setup a Network Load Balancer in GCP.&lt;/p&gt;
&lt;p&gt;Setup your instances.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Instance 1
gcloud compute instances create www1 \
--image-family debian-9 \
--image-project debian-cloud \
--zone us-central1-b \
--tags network-lb-tag \
--metadata startup-script=&amp;#34;#! /bin/bash
sudo apt-get update
sudo apt-get install apache2 -y
sudo service apache2 restart
echo &amp;#39;&amp;lt;h1&amp;gt;www1&amp;lt;/h1&amp;gt;&amp;#39; | tee /var/www/html/index.html
EOF&amp;#34;
# Instance 2
gcloud compute instances create www2 \
--image-family debian-9 \
--image-project debian-cloud \
--zone us-central1-b \
--tags network-lb-tag \
--metadata startup-script=&amp;#34;#! /bin/bash
sudo apt-get update
sudo apt-get install apache2 -y
sudo service apache2 restart
echo &amp;#39;&amp;lt;h1&amp;gt;www2&amp;lt;/h1&amp;gt;&amp;#39; | tee /var/www/html/index.html
EOF&amp;#34;
# Instance 3
gcloud compute instances create www3 \
--image-family debian-9 \
--image-project debian-cloud \
--zone us-central1-b \
--tags network-lb-tag \
--metadata startup-script=&amp;#34;#! /bin/bash
sudo apt-get update
sudo apt-get install apache2 -y
sudo service apache2 restart
echo &amp;#39;&amp;lt;h1&amp;gt;www3&amp;lt;/h1&amp;gt;&amp;#39; | tee /var/www/html/index.html
EOF&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a firewall to allow external traffic to reach port 80.&lt;/p&gt;</description></item><item><title>aws cli iam keys</title><link>http://uly.me/posts/aws-cli-iam-keys/</link><pubDate>Fri, 20 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-iam-keys/</guid><description>&lt;p&gt;Here’s a few commands to create, delete and disable AWS user keys.&lt;/p&gt;
&lt;p&gt;List user keys.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam list-access-keys --user-name john.doe
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create access key. Results are printed on screen in JSON format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam create-access-key --user-name john.doe
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disable a key. The real key id is obfuscated.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam update-access-key \
--access-key-id ******************** \
--status Inactive \
--user-name john.doe
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete a key. They real key id is obfuscated.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam delete-access-key \
--access-key-id ******************** \
--user-name john.doe
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws s3 replication policy</title><link>http://uly.me/posts/aws-s3-replication-policy/</link><pubDate>Fri, 20 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-replication-policy/</guid><description>&lt;p&gt;Here’s the policy for S3 replication between regions.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Action&amp;#34;: [
&amp;#34;s3:Get*&amp;#34;,
&amp;#34;s3:ListBucket&amp;#34;
],
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Resource&amp;#34;: [
&amp;#34;arn:aws:s3:::source-bucket-name&amp;#34;,
&amp;#34;arn:aws:s3:::source-bucket-name/*&amp;#34;
]
},
{
&amp;#34;Action&amp;#34;: [
&amp;#34;s3:ReplicateObject&amp;#34;,
&amp;#34;s3:ReplicateDelete&amp;#34;,
&amp;#34;s3:ReplicateTags&amp;#34;,
&amp;#34;s3:GetObjectVersionTagging&amp;#34;
],
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:s3:::destination-bucket-name/*&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>use curl on load balancers</title><link>http://uly.me/posts/use-curl-on-load-balancers/</link><pubDate>Wed, 18 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/use-curl-on-load-balancers/</guid><description>&lt;p&gt;You can use the curl command to test if your load balancer is working as expected. The curl command will alternately and randomly access several instances in your load balancer. If you have 3 instances behind your load balancer, it will be cycled across all 3. The -m1 command means max time is set to 1 second.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;while true; do curl -m1 [IP_ADDRESS]; done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp move instance to another zone</title><link>http://uly.me/posts/gcp-move-instance-to-another-zone/</link><pubDate>Fri, 13 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-move-instance-to-another-zone/</guid><description>&lt;p&gt;Moving a GCP instance to another zone is actually much simpler than initially thought. It’s just a single gcloud command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances move instance-name \
--zone us-central1-a \
--destination-zone us-central1-b
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A few details about moving to another zone.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VM has to be running.&lt;/li&gt;
&lt;li&gt;You may get a new internal or external IP address&lt;/li&gt;
&lt;li&gt;Local SSDs are ephemeral, so you can’t move them.&lt;/li&gt;
&lt;li&gt;When moving between regions, you may have to select a subnetwork.&lt;/li&gt;
&lt;li&gt;You may have to change GPUs available in the destination if you use them.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>which java version</title><link>http://uly.me/posts/which-java-version/</link><pubDate>Fri, 13 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/which-java-version/</guid><description>&lt;p&gt;Here’s a quick way how to find which Java version you are running.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;which java
java -version
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp move instance to another project</title><link>http://uly.me/posts/gcp-move-instance-to-another-project/</link><pubDate>Wed, 11 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-move-instance-to-another-project/</guid><description>&lt;p&gt;Here’s how to copy a disk from one project to another.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks create lamp-server \
--source-snapshot https://www.googleapis.com/compute/v1/projects/project-id/global/snapshots/lamp-server \
--project next-project-id \
--zone us-central1-a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once all the disks are copied. You can create a snapshot of the boot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks snapshot lamp-server
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create an instance from snapshot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks create &amp;#34;hostname-boot&amp;#34; \
--project &amp;#34;project-id&amp;#34; \
--zone &amp;#34;us-central1-a&amp;#34; \
--source-snapshot &amp;#34;snapshot-name&amp;#34; \
--type &amp;#34;pd-standard&amp;#34; \
--size &amp;#34;100&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>get-hotfix</title><link>http://uly.me/posts/get-hotfix-2/</link><pubDate>Tue, 10 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/get-hotfix-2/</guid><description>&lt;p&gt;How to find out if a Windows Server was last patched.&lt;/p&gt;
&lt;p&gt;From Powershell, run this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;get-hotfix
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;From the command line, run this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;C:\&amp;gt; systeminfo.exe
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or from the menu, follow these steps.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Open the Windows Settings UI.
Click on Update &amp;amp; security.
Click on the &amp;#34;Update history&amp;#34; link located under the Windows Update tab.
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>audacity on catalina</title><link>http://uly.me/posts/audacity-on-catalina/</link><pubDate>Sun, 08 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/audacity-on-catalina/</guid><description>&lt;p&gt;If you’ve recently upgraded your Mac to Catalina or Mac OS 10.15.1, you may have noticed that Audacity is no longer working. To get it working, you’ll need to download version Audacity 2.3.3. However, installing and running it normally the way you’ve done it in the past will not be enough. Because of Catalina, Audacity is not able to gain permissions to the microphone inputs. The only way I was able to get it working is to launch Audacity from the Terminal.&lt;/p&gt;</description></item><item><title>gcp create filestore</title><link>http://uly.me/posts/gcp-create-filestore/</link><pubDate>Sat, 07 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-filestore/</guid><description>&lt;p&gt;GCP Cloud Filestore is a managed file storage service for applications that require a filesystem interface and a shared filesystem for data. Filestore gives users a simple, native experience for standing up managed Network Attached Storage (NAS) with their Google Compute Engine and Kubernetes Engine instances.&lt;/p&gt;
&lt;p&gt;With that said, let’s build one.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud filestore instances create nfs-server \
--project=[PROJECT_ID] \
--zone=us-central1-c \
--tier=STANDARD \
--file-share=name=&amp;#34;vol1&amp;#34;,capacity=1TB \
--network=name=&amp;#34;default&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;How to mount the filestore on clients.&lt;/p&gt;</description></item><item><title>aws cli add user</title><link>http://uly.me/posts/aws-cli-add-user/</link><pubDate>Wed, 04 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-add-user/</guid><description>&lt;p&gt;Here’s how to add an AWS user using the CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam create-user --user-name john.doe \
--tags Key=&amp;#39;Name&amp;#39;,Value=&amp;#39;John Doe&amp;#39; Key=&amp;#39;Role&amp;#39;,Value=&amp;#39;Admin&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create an access key for the user.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam create-access-key --user-name john.doe
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ffmpeg convert ts to mp4</title><link>http://uly.me/posts/ffmpeg-convert-ts-to-mp4/</link><pubDate>Wed, 04 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ffmpeg-convert-ts-to-mp4/</guid><description>&lt;p&gt;If you have video files that are formatted in MPEG-2, video files with a .m2ts extension, you can convert them to MP4 using ffmpeg.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i input.ts -c:v libx264 -c:a aac output.mp4
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The video is encoded using open format H.264, while audio is encoded using AAC.&lt;/p&gt;</description></item><item><title>windows boot time</title><link>http://uly.me/posts/windows-boot-time/</link><pubDate>Mon, 02 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/windows-boot-time/</guid><description>&lt;p&gt;Here’s how to find when a Windows server was last rebooted.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systeminfo | find /i &amp;#34;boot time&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>mac os catalina</title><link>http://uly.me/posts/mac-os-catalina/</link><pubDate>Sun, 01 Dec 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mac-os-catalina/</guid><description>&lt;p&gt;I’ve updated my system to the latest Mac OS 10.15.1 codenamed Catalina. Well, it broke a couple of apps that I use regularly, Audacity and OBS. There are currently no updates from Audacity. However, OBS has a workaround in terms of a test build. You have to download it, and set the system preferences to allow the Mac OS to access the cameras (webcam) and audio devices (microphones). There are no official releases yet from neither Audacity and OBS projects. Maybe in a couple of months.&lt;/p&gt;</description></item><item><title>aws cli add network interface</title><link>http://uly.me/posts/aws-cli-add-network-interface/</link><pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-add-network-interface/</guid><description>&lt;p&gt;Create a new interface via AWS CLI with static IP.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ aws ec2 create-network-interface \
--subnet-id subnet-xxxxxxx \
--description &amp;#34;second ip&amp;#34; \
--groups sg-xxxxxxx \
--private-ip-address 10.0.0.16
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>set immutable attribute</title><link>http://uly.me/posts/set-immutable-attribute/</link><pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/set-immutable-attribute/</guid><description>&lt;p&gt;If you don’t want a file edited or deleted, you can set the immutable attribute to ON. If activated, not even root or the owner of the file can delete it. Users with write access can still read it, but they obviously will not be able to modify it. To unset it, just use the -i option.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Set immutable attribute
sudo chattr +i text.txt
# Unset immutable attribute
sudo chattr -i text.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>tcpdump</title><link>http://uly.me/posts/tcpdump/</link><pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tcpdump/</guid><description>&lt;p&gt;Tcpdump is a command line utility that allows you to capture and analyze network traffic going through your system. It is often used to help troubleshoot network issues.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Find out if tcpdump is installed
$ which tcpdump
/usr/sbin/tcpdump
# Install tcpdump
sudo yum install -y tcpdump
# Find which interface is available to you
tcpdump -D
# Capture on eth0. Use Ctrl-C to end capture.
tcpdump -i eth0
# Capture after 10 packets
tcpdump -i eth0 -c10
# Filter by port
tcpdump -i any -c10 -nn port 80
# Filter by ip address
tcpdump -i any -c10 -nn host 192.168.1.23
# Filter by source or destination ip
tcpdump -i any -c10 -nn src 192.168.1.23
tcpdump -i any -c10 -nn dst 192.168.1.23
# Filter by destination ip and port
tcpdump -i any -c5 -nn src 192.168.1.23 and port 80
# Save output to a file (binary format)
tcpdump -i any -c10 -nn -w http.pcap port 80
# Save output to a file (text format)
tcpdump -nn -r http.pcap
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s a good &lt;a href="https://opensource.com/article/18/10/introduction-tcpdump"&gt;intro&lt;/a&gt; article about tcpdump.&lt;/p&gt;</description></item><item><title>change mtu size</title><link>http://uly.me/posts/change-mtu-size/</link><pubDate>Tue, 26 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-mtu-size/</guid><description>&lt;p&gt;MTU means maximum transmission unit. The default value is 1500 for Ethernet, which is also the standard for the Internet. If your application or network requires a different MTU size, you can set the MTU size by running the following commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Edit ifcfg-eth0
vi /etc/sysconfig/network-scripts/ifcfg-eth0
#Add MTU, settings:
MTU=&amp;#34;1460&amp;#34;
# Save and close the file. Restart networking:
service network restart
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws ecr pushpull policy</title><link>http://uly.me/posts/aws-ecr-pushpull-policy/</link><pubDate>Tue, 19 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-ecr-pushpull-policy/</guid><description>&lt;p&gt;Amazon Elastic Container Registry (ECR) is a fully-managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images.&lt;/p&gt;
&lt;p&gt;Here’s the AWS IAM policy to push and pull images from Docker within ECR.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2008-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Sid&amp;#34;: &amp;#34;AllowPushPull&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Resource&amp;#34;: [
&amp;#34;arn:aws:iam::*:role/your-custom-role&amp;#34;
],
&amp;#34;Action&amp;#34;: [
&amp;#34;ecr:GetDownloadUrlForLayer&amp;#34;,
&amp;#34;ecr:BatchGetImage&amp;#34;,
&amp;#34;ecr:BatchCheckLayerAvailability&amp;#34;,
&amp;#34;ecr:PutImage&amp;#34;,
&amp;#34;ecr:InitiateLayerUpload&amp;#34;,
&amp;#34;ecr:UploadLayerPart&amp;#34;,
&amp;#34;ecr:CompleteLayerUpload&amp;#34;
]
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>tail a file in windows server</title><link>http://uly.me/posts/tail-a-file-in-windows-server/</link><pubDate>Tue, 19 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tail-a-file-in-windows-server/</guid><description>&lt;p&gt;Linux has tail command. What about Windows? You can use Powershell to tail a file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Get-Content myLog.log –Wait
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp change instance type</title><link>http://uly.me/posts/gcp-change-instance-type/</link><pubDate>Mon, 18 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-change-instance-type/</guid><description>&lt;p&gt;Here’s how to change instance types via the command line&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Set Project
gcloud config set project your-project-id
# Change instance type to 2 CPU 20GB memory.
gcloud compute instances set-machine-type your-server-name \
--zone us-east1-a \
--machine-type n2-custom-2-20480
# Change instance type to original settings.
gcloud compute instances set-machine-type your-server-name \
--zone us-east1-a \
--machine-type n2-custom-2-15360
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>passive ftp firewall</title><link>http://uly.me/posts/passive-ftp-firewall/</link><pubDate>Mon, 18 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/passive-ftp-firewall/</guid><description>&lt;p&gt;Passive FTP is a FTP mode that alleviates the issues with client firewalls. The client initiates a call to the server. The return traffic is allowed as long as the client has initiated it. In addition, the server sends a port command along with an ephemeral port that the client can connect to. The client initiates a call on that ephemeral port, and the connection is then established.&lt;/p&gt;
&lt;p&gt;Egress port 21 and ephemeral ports 1024-65535 needs to be opened from the client side.&lt;/p&gt;</description></item><item><title>aws efs describe mount targets</title><link>http://uly.me/posts/aws-efs-describe-mount-targets/</link><pubDate>Mon, 04 Nov 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-efs-describe-mount-targets/</guid><description>&lt;p&gt;Here’s how to display mount targets of an EFS system via AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws efs describe-mount-targets \
--file-system-id fs-xxxxxxxx \
--profile default \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash history with timestamps</title><link>http://uly.me/posts/bash-history-with-timestamps/</link><pubDate>Thu, 31 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-history-with-timestamps/</guid><description>&lt;p&gt;If you need to see Bash history with timestamps, use this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;HISTTIMEFORMAT=&amp;#34;%d/%m/%y %T &amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To make it permanent, add it to your .bashrc.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo &amp;#39;HISTTIMEFORMAT=&amp;#34;%d/%m/%y %T &amp;#34;&amp;#39; &amp;gt;&amp;gt; ~/.bashrc
source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Timestamps accuracy is retroactively, meaning it will not be accurate for commands performed prior to the history time format being set.&lt;/p&gt;</description></item><item><title>excel delete blank rows</title><link>http://uly.me/posts/excel-delete-blank-rows/</link><pubDate>Thu, 31 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/excel-delete-blank-rows/</guid><description>&lt;p&gt;Here’s how to &lt;a href="https://www.excel-easy.com/examples/delete-blank-rows.html"&gt;delete blank rows&lt;/a&gt; in Excel.&lt;/p&gt;</description></item><item><title>tar commands</title><link>http://uly.me/posts/tar-commands/</link><pubDate>Wed, 30 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tar-commands/</guid><description>&lt;p&gt;Here are two important tar commands on how to create and extract a tar.gz file.&lt;/p&gt;
&lt;p&gt;Create a tar gzip file called “project.tar.gz” of a directory called “foo.”&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar -cvzf project.tar.gz foo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Untar the “project.tar.gz” file to a directory called bar.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar -xvzf project.tar.gz bar
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ffmpeg with start time</title><link>http://uly.me/posts/ffmpeg-with-start-time/</link><pubDate>Tue, 29 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ffmpeg-with-start-time/</guid><description>&lt;p&gt;This is a follow up to a previous post about FFMPEG. In addition to sending a RTMP stream, you can also set a start time and duration.&lt;/p&gt;
&lt;p&gt;Here’s how to set the start time using -ss option and -to for the duration. Video will start at 1 min 23 secs and play until 2 mins.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -ss 00:01:23 -i video.mp4 -to 00:02:00 -c copy -copyts cut.mp4
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s how to start time to start the video at 1 min 23 sec for RTMP streaming. Please note, the start time option needs to be before the input file.&lt;/p&gt;</description></item><item><title>rtmp of mp4 via ffmpeg</title><link>http://uly.me/posts/rtmp-of-mp4-via-ffmpeg/</link><pubDate>Sun, 27 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rtmp-of-mp4-via-ffmpeg/</guid><description>&lt;p&gt;FFMPEG is the jack of all trades utility for both audio and video files. You can record, convert, and even live stream an audio or video file in just about any file format. In this example, I will be sending a RTMP stream of a MP4 file to a Wowza streaming server. I can easily send the same stream to YouTube, Facebook or any streaming server that accepts a RTMP source. In this example, I created simple Bash script called play.sh, with all the options needed to live stream to Wowza Streaming server.&lt;/p&gt;</description></item><item><title>rfc 1918</title><link>http://uly.me/posts/rfc-1918/</link><pubDate>Thu, 24 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rfc-1918/</guid><description>&lt;p&gt;Here’s the original document published back in February 1996 detailing the allocation for private internet addresses. The Internet Assigned Numbers Authority (IANA) has reserved the following three blocks of the IP address space for private internets. &lt;a href="https://tools.ietf.org/html/rfc1918"&gt;RFC 1918&lt;/a&gt;.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;10.0.0.0 - 10.255.255.255 (10/8 prefix)
172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>xfs filesystem has duplicate uuid</title><link>http://uly.me/posts/xfs-filesystem-has-duplicate-uuid/</link><pubDate>Mon, 07 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/xfs-filesystem-has-duplicate-uuid/</guid><description>&lt;p&gt;Here’s how to fix a duplicate UUID on a XFS file system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mount -o rw,nouuid /dev/sda1 /data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mounting with nouuid will work, but not after a reboot.&lt;/p&gt;
&lt;p&gt;To avoid a duplicate ID, run this command to generate a new UUID.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;xfs_admin -U generate /dev/sda3
Clearing log and setting UUID
writing all SBs
new UUID = xxxxx-xxxx-xxxx-xxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp stackdriver firewall log</title><link>http://uly.me/posts/gcp-stackdriver-firewall-log/</link><pubDate>Fri, 04 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-stackdriver-firewall-log/</guid><description>&lt;p&gt;Here’s one way how to look at traffic hitting a GCP firewall. To view the traffic activity, go to Stackdriver Logging &amp;gt; Viewer. Enter the following search string. Just replace the network name and firewall name.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;logName:(projects/project-name/logs/compute.googleapis.com%2Ffirewall)
AND jsonPayload.rule_details.reference:(&amp;#34;network:network-name/firewall:firewall-name&amp;#34;)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>yum rpmdb failed</title><link>http://uly.me/posts/yum-rpmdb-failed/</link><pubDate>Fri, 04 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yum-rpmdb-failed/</guid><description>&lt;p&gt;If you are getting an error similar to the yum error below, yum may be broken in your system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;error: rpmdb: BDB0113 Thread/process 2196/139984719730496 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv-&amp;gt;failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 - (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the fix.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mv /var/lib/rpm/__db* /tmp
yum clean all
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run your yum commands. The errors should be gone.&lt;/p&gt;</description></item><item><title>gcp increase download speed for gsutil</title><link>http://uly.me/posts/gcp-increase-download-speed-for-gsutil/</link><pubDate>Wed, 02 Oct 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-increase-download-speed-for-gsutil/</guid><description>&lt;p&gt;If you’re downloading large files, you can speed up download speeds by modifying gsutil. Decrease the number of threads and increase the number of components.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gsutil \
-o &amp;#34;GSUtil:parallel_thread_count=1&amp;#34; \
-o &amp;#34;GSUtil:parallel_process_count=8&amp;#34; \
cp gs://bucket/source.dat /download/dest/file.dat
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp service accounts</title><link>http://uly.me/posts/gcp-service-accounts/</link><pubDate>Wed, 25 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-service-accounts/</guid><description>&lt;p&gt;Here’s how display the Service Account of a particular instance in Google Cloud.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances describe server-name \
--zone us-central1-c \
--project project-id \
--format=&amp;#34;flattened(serviceAccounts[].email)&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result is:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;serviceAccounts[0].email: service-account-name@project-id.iam.gserviceaccount.com
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>elapse time on bash script</title><link>http://uly.me/posts/elapse-time-on-bash-script/</link><pubDate>Tue, 24 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/elapse-time-on-bash-script/</guid><description>&lt;p&gt;Here’s a nice little Bash function in a script to display the elapse time. It’s a nice function for showing how long a process ran.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
# pass number of seconds as argument.
# Example below calculates 1000s.
# elapse.sh 1000
function show_time () {
num=$1
min=0
hour=0
day=0
if((num&amp;gt;59));then
((sec=num%60))
((num=num/60))
if((num&amp;gt;59));then
((min=num%60))
((num=num/60))
if((num&amp;gt;23));then
((hour=num%24))
((day=num/24))
else
((hour=num))
fi
else
((min=num))
fi
else
((sec=num))
fi
echo &amp;#34;$day&amp;#34;d &amp;#34;$hour&amp;#34;h &amp;#34;$min&amp;#34;m &amp;#34;$sec&amp;#34;s
}
show_time $1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>fpsync</title><link>http://uly.me/posts/fpsync/</link><pubDate>Mon, 23 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fpsync/</guid><description>&lt;p&gt;&lt;a href="http://manpages.ubuntu.com/manpages/bionic/man1/fpsync.1.html"&gt;Fpsync&lt;/a&gt; is command line tool for synchronizing directories in parallel using fpart and &lt;a href="https://linux.die.net/man/1/rsync"&gt;rsync&lt;/a&gt; tools. You can specify a number of concurrent sync jobs, number of files per sync job, and the maximum byte size per sync among other things. Fpsync is believed to be 4 to 5 times faster than rsync. Fpsync makes sense when syncing massive drives with thousands of directories and small files.&lt;/p&gt;
&lt;p&gt;To install fpsync.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install fpart
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Fpsync with 8 parallel jobs.&lt;/p&gt;</description></item><item><title>gcp add iam role to service account</title><link>http://uly.me/posts/gcp-add-iam-role-to-service-account/</link><pubDate>Sun, 22 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-add-iam-role-to-service-account/</guid><description>&lt;p&gt;Here’s how to add an IAM role to a GCP Service Account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud projects add-iam-policy-binding your-project-id \
--member serviceAccount:service-account-name@your-project-id.iam.gserviceaccount.com \
--role roles/storage.objectAdmin
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create service account</title><link>http://uly.me/posts/gcp-create-service-account/</link><pubDate>Sun, 22 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-service-account/</guid><description>&lt;p&gt;Here’s how to create a GCP Service Account.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud beta iam service-accounts create service-account-name \
--description &amp;#34;service account description&amp;#34; \
--display-name &amp;#34;service account display name&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create service account key</title><link>http://uly.me/posts/gcp-create-service-account-key/</link><pubDate>Sun, 22 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-service-account-key/</guid><description>&lt;p&gt;Here’s how to create a key for the GCP Service Account.&lt;/p&gt;
&lt;p&gt;Create Key.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud iam service-accounts keys create ~/key.json \
--iam-account service-name@project-id.iam.gserviceaccount.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Activate Key&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth activate-service-account service-name@project-id.iam.gserviceaccount.com \
--key-file=key.json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Revoke Key.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud auth revoke service-account@project-id.iam.gserviceaccount.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete Key&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud iam service-accounts keys delete key-id \
--iam-account service-name@project-id.iam.gserviceaccount.com
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp sdk update</title><link>http://uly.me/posts/gcp-sdk-update/</link><pubDate>Sun, 22 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-sdk-update/</guid><description>&lt;p&gt;Here’s how to update your Google Cloud Platform SDK (Software Development Kit) which is aka the CLI for interacting with Google’s API.&lt;/p&gt;
&lt;p&gt;Get Current Version&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud version
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Get the Components List&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud components list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Update&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud components update
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcloud interactive shell</title><link>http://uly.me/posts/gcloud-interactive-shell/</link><pubDate>Sat, 21 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcloud-interactive-shell/</guid><description>&lt;p&gt;If you already have Google SDK installed, you can activate GCloud Interactive Shell, which is still in beta by the way, by typing the following command from the Google SDK terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud beta interactive
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/09/interactive-shell.png"&gt;&lt;/p&gt;
&lt;p&gt;The interactive shell environment has auto-completion. It shows you who’s logged in and which project you are currently set in. To exit the interactive shell, just Press F9 to quit.&lt;/p&gt;</description></item><item><title>gcp compute disks move</title><link>http://uly.me/posts/gcp-compute-disks-move/</link><pubDate>Sat, 21 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-compute-disks-move/</guid><description>&lt;p&gt;Here’s how to move a GCP disk between zones.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make sure disk is detached from instance.&lt;/li&gt;
&lt;li&gt;Use the GCloud Disk Move command.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Detach disk from instance
gcloud compute instances detach-disk server --disk=server-boot
# Move disk from us-central1-b to us-central1-f
gcloud compute disks move example-disk-1 --zone us-central1-b --destination-zone us-central1-f
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>codeigniter base url</title><link>http://uly.me/posts/codeigniter-base-url/</link><pubDate>Thu, 19 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/codeigniter-base-url/</guid><description>&lt;p&gt;I have a CodeIgniter dev site in Google Cloud. The instance obtains a new IP address at every start. You can set the base URL to a domain or IP address in the “/application/config/config.php” file. Since it’s only a dev box, I don’t have a domain assigned. It’s accessible via IP address only which changes every time the instance is started. So here’s the workaround. I added some extra code in the config file to obtain the external IP address.&lt;/p&gt;</description></item><item><title>windows + tab</title><link>http://uly.me/posts/windows-tab-2/</link><pubDate>Wed, 18 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/windows-tab-2/</guid><description>&lt;p&gt;Found another gem to display all Windows by using …&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Windows + Tab
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create instance from snapshot</title><link>http://uly.me/posts/gcp-create-instance-from-snapshot/</link><pubDate>Tue, 17 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-instance-from-snapshot/</guid><description>&lt;p&gt;There are two steps in creating an instance from a snapshot.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a disk from snapshot&lt;/li&gt;
&lt;li&gt;Create an instance from the disk&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Create a disk from snapshot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks create &amp;#34;hostname-boot&amp;#34; \
--project &amp;#34;project-id&amp;#34; \
--zone &amp;#34;us-central1-a&amp;#34; \
--source-snapshot &amp;#34;snapshot-name&amp;#34; \
--type &amp;#34;pd-standard&amp;#34; \
--size &amp;#34;100&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create an instance from disk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud beta compute instances create hostname \
--project=project-id \
--zone=us-central1-a \
--subnet=your-subnetwork \
--machine-type=n1-standard-1 \
--no-address \
--maintenance-policy=MIGRATE \
--service-account=service.account@developer.gserviceaccount.com \
--disk=name=instance-1,device-name=instance-1,mode=rw,boot=yes,auto-delete=yes \
--reservation-affinity=any \
--labels=builtby=john.doe \
--tags=web \
--scopes= \
--metadata=
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>nitro-based instance volumes</title><link>http://uly.me/posts/nitro-based-instance-volumes/</link><pubDate>Tue, 17 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nitro-based-instance-volumes/</guid><description>&lt;p&gt;AWS introduced Nitro-based instances which are modular. They are meant for high performance, high availability, and high security systems. Nitro building blocks provide direct access to high-speed local storage over a PCI interface and transparently encrypts all data using dedicated hardware. It also provides hardware-level isolation between storage devices and EC2 instances so that bare metal instances can benefit from local NVMe storage. The following are Nitro-based instances: A1, C5, C5d, C5n, I3en, M5, M5a, M5ad, M5d, p3dn.24xlarge, R5, R5a, R5ad, R5d, T3, T3a, and z1d. Bare metal: c5.metal, c5n.metal, i3.metal, i3en.metal, m5.metal, m5d.metal, r5.metal, r5d.metal, u-6tb1.metal, u-9tb1.metal, u-12tb1.metal, and z1d.metal.&lt;/p&gt;</description></item><item><title>force umount if busy</title><link>http://uly.me/posts/force-umount-if-busy/</link><pubDate>Mon, 16 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/force-umount-if-busy/</guid><description>&lt;p&gt;If device is busy and you can’t umount it, try it with -l option (lazy unmount). Or you can force it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# standard
umount /mnt/data
# lazy umount
umount -l /mnt/data
# force
umount -f /mnt/data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Lazy unmount is safer since it will detach immediately and clean up all references to the file system. Force is a bit more drastic.&lt;/p&gt;</description></item><item><title>ssh access allowgroups</title><link>http://uly.me/posts/ssh-access-allowgroups/</link><pubDate>Mon, 16 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ssh-access-allowgroups/</guid><description>&lt;p&gt;If unable to login via SSH, check the /etc/ssh/sshd_config for AllowGroups.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;AllowGroups root groupname
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It’s case sensitive.&lt;/p&gt;</description></item><item><title>aws security groups ip cidr</title><link>http://uly.me/posts/aws-security-groups-ip-cidr/</link><pubDate>Tue, 10 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-security-groups-ip-cidr/</guid><description>&lt;p&gt;Here’s how to search for AWS Security Groups containing this IP Cidr.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-security-groups \
--filter Name=egress.ip-permission.cidr,Values=&amp;#39;10.8.8.8/32&amp;#39; \
--query &amp;#34;SecurityGroups[*].{Name:GroupName}&amp;#34; \
--output text \
--profile default \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Search with ports.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-security-groups \
--filter Name=egress.ip-permission.cidr,Values=&amp;#39;10.8.8.8/32&amp;#39; \
Name=egress.ip-permission.from-port,Values=&amp;#39;22&amp;#39; \
Name=egress.ip-permission.to-port,Values=&amp;#39;22&amp;#39; \
--query &amp;#34;SecurityGroups[*].{Name:GroupName}&amp;#34; \
--output text \
--profile default \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Query will only display the Security Group name.&lt;/p&gt;</description></item><item><title>migrate gcp vm to another network</title><link>http://uly.me/posts/migrate-gcp-vm-to-another-network/</link><pubDate>Tue, 10 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/migrate-gcp-vm-to-another-network/</guid><description>&lt;p&gt;Here are the steps how to migrate a GCP VM from one network to another. It involves recreating the instance in that network.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Find the VM. Click the ‘Create Similar’ button.&lt;/li&gt;
&lt;li&gt;Select the new network. Save Network. Everything else should stay the same.&lt;/li&gt;
&lt;li&gt;Don’t click Create, but get the ‘Create Similar’ command line script only. Click Cancel after.&lt;/li&gt;
&lt;li&gt;Make sure to edit the hostname. GCP appends a ‘-1’ at the end of hostname.&lt;/li&gt;
&lt;li&gt;Edit VM to keep all disks. Delete VM. Make sure to preserve boot drive.&lt;/li&gt;
&lt;li&gt;Run the ‘Create Similar’ command line script you capture to create new VM in the new network.&lt;/li&gt;
&lt;li&gt;The new VM will be based on golden image.&lt;/li&gt;
&lt;li&gt;Stop VM. Swap new disks with old disks.&lt;/li&gt;
&lt;li&gt;Start VM.&lt;/li&gt;
&lt;li&gt;Done.&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>phpinfo blank page</title><link>http://uly.me/posts/phpinfo-blank-page/</link><pubDate>Tue, 10 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/phpinfo-blank-page/</guid><description>&lt;p&gt;Here’s how to fix when phpinfo is displaying a blank page. The install is missing this php module.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install php libapache2-mod-php
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart after install.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service apache2 restart
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>run shell script from your website</title><link>http://uly.me/posts/run-shell-script-from-your-website/</link><pubDate>Tue, 10 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-shell-script-from-your-website/</guid><description>&lt;p&gt;Here’s how to run a shell script from your website. You’ll need 2 files.&lt;/p&gt;
&lt;p&gt;Here’s the contents of foo.php. Wrap your output with ‘pre’ for better formatting.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;?php $output = shell_exec(&amp;#39;/var/www/html/bar.sh 2?&amp;gt;&amp;amp;1&amp;#39;);
echo &amp;#34;$output&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the content of bar.sh. Output will be displayed on web page.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
now=&amp;#34;$(date +&amp;#39;%y%m%d&amp;#39;)&amp;#34;
echo $now
aws s3 ls
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>rsync only new files</title><link>http://uly.me/posts/rsync-only-new-files/</link><pubDate>Mon, 09 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rsync-only-new-files/</guid><description>&lt;p&gt;Here’s how to sync files between two directories, while copying only new files and ignoring existing files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rsync --ignore-existing -rapzvh /dir1 /dir2 &amp;gt;&amp;gt; /root/rsync.log &amp;amp;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>display last 50 posts in archive page</title><link>http://uly.me/posts/display-last-50-posts-in-archive-page/</link><pubDate>Sun, 08 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-last-50-posts-in-archive-page/</guid><description>&lt;p&gt;Here’s the code to add to your archive template, e.g. archives.php.&lt;/p&gt;
&lt;p&gt;Last 50 Posts:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;wp_get_archives( array(
&amp;#39;type&amp;#39; =?&amp;gt;
&amp;#39;postbypost&amp;#39;, &amp;#39;limit&amp;#39; =&amp;amp;gt; 50, &amp;#39;format&amp;#39; =&amp;amp;gt; &amp;#39;&amp;#39;, &amp;#39;before&amp;#39; =&amp;amp;gt; &amp;#39;- &amp;#39;, &amp;#39;after&amp;#39; =&amp;amp;gt; &amp;#39;
&amp;#39; )); ?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>view contents of tar file</title><link>http://uly.me/posts/view-contents-of-tar-file/</link><pubDate>Sun, 08 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/view-contents-of-tar-file/</guid><description>&lt;p&gt;Here’s how to view the contents of a tar file without extracting the files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar -tvf file.tar
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wordpress numeric pagination</title><link>http://uly.me/posts/wordpress-numeric-pagination/</link><pubDate>Sun, 08 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-numeric-pagination/</guid><description>&lt;p&gt;Here’s how to add numeric pagination on your WordPress pages.&lt;/p&gt;
&lt;p&gt;Add this code to functions.php.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function pagination($pages = &amp;#39;&amp;#39;, $range = 4) {
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == &amp;#39;&amp;#39;) {
global $wp_query;
$pages = $wp_query-&amp;gt;max_num_pages;
if(!$pages) {
$pages = 1;
}
}
if(1 != $pages) {
echo &amp;#39;&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;div class=&amp;#34;pagination&amp;#34;&amp;gt;&amp;lt;span&amp;gt;Page&amp;#39; . $paged . &amp;#39; of &amp;#39; . $pages . &amp;#39;&amp;lt;/span&amp;gt; &amp;#39;;
if($paged &amp;gt; 2 &amp;amp;&amp;amp; $paged &amp;gt; $range+1 &amp;amp;&amp;amp; $showitems &amp;#39;;
if($paged &amp;gt; 1 &amp;amp;&amp;amp; $showitems &amp;#39;;
for ($i=1; $i = $paged+$range+1 || $i &amp;#39; . $i . &amp;#39;&amp;#39; : &amp;#39;&amp;lt;a class=&amp;#34;inactive&amp;#34; href=&amp;#34;&amp;#39; . get_pagenum_link($i) . &amp;#39;&amp;#34;&amp;gt;&amp;#39; . $i . &amp;#39;&amp;lt;/a&amp;gt;&amp;#39;;
}
}
if ($paged Next &amp;gt;&amp;#39;;
if ($paged Last &amp;gt;&amp;gt;&amp;#39;;
echo &amp;#39;&amp;lt;/div&amp;gt;&amp;#39;;
}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To display, comment out ‘the_post_navigation’ function and add the ‘pagination’ function instead in your template files.&lt;/p&gt;</description></item><item><title>get directory size</title><link>http://uly.me/posts/get-directory-size/</link><pubDate>Sat, 07 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/get-directory-size/</guid><description>&lt;p&gt;Here’s how to get the size of a directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;du -sh /var/www
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;2.1GB /var/www
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Size of the directories and files one level down.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;du -sh /var/www/*
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Sort with biggest files from top to bottom.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;du -sh /var/www/* | sort -rh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Top 5 biggest files from top to bottom.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;du -sh /var/www/* | sort -rh | head -5
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>mysql backup to s3 bucket</title><link>http://uly.me/posts/mysql-backup-to-s3-bucket/</link><pubDate>Sat, 07 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mysql-backup-to-s3-bucket/</guid><description>&lt;p&gt;Here’s my MySQL backup script to the S3 Bucket.&lt;/p&gt;
&lt;p&gt;Just a couple of things about the script. It’s using …&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;AWS CLI&lt;/li&gt;
&lt;li&gt;Mysqldump&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;They must be setup and configured to work properly.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
cd /root/database
TIMESTAMP=$(date +%Y-%m-%d)
S3FILE=&amp;#34;s3://bucketname/sqlbackup/backup-$TIMESTAMP.sql&amp;#34;
/usr/bin/mysqldump dbname &amp;gt; dbname.sql
/usr/local/bin/aws s3 cp dbname.sql $S3FILE
sleep 3s
rm dbname.sql
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Finally, set the S3 bucket with a 7 day retention. Backups older than 7 days are automatically deleted.&lt;/p&gt;</description></item><item><title>git diff head</title><link>http://uly.me/posts/git-diff-head/</link><pubDate>Tue, 03 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-diff-head/</guid><description>&lt;p&gt;Here’s how to check what’s changed in your local Git repo vs the master repo.&lt;/p&gt;
&lt;p&gt;Git Status tells you what file has changed, but not to the level of detail such as what lines or what code was changed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git diff HEAD
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>diff between two directories</title><link>http://uly.me/posts/diff-between-two-directories/</link><pubDate>Mon, 02 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/diff-between-two-directories/</guid><description>&lt;p&gt;Here’s how to get the differences between two directories using diff.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;-q display only files when they differ&lt;/li&gt;
&lt;li&gt;-r recursive to all sub-directories&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;diff -qr /directory-1 /directory-2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>recover mysql root password</title><link>http://uly.me/posts/recover-mysql-root-password/</link><pubDate>Mon, 02 Sep 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/recover-mysql-root-password/</guid><description>&lt;p&gt;How to recover a MySQL root password without a password.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Stop MySQL.&lt;/li&gt;
&lt;li&gt;Start MySQL Safe Mode.&lt;/li&gt;
&lt;li&gt;Login to MySQL as root without password.&lt;/li&gt;
&lt;li&gt;Change root password.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Stop MySQL.
service mysql stop
# MySQL Safe Mode.
mysqld_safe --skip-grant-tables &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;# Login to MySQL without password. Set new password.
mysql -u root -p
use mysql;
# For MySQL 5.6 or lower
UPDATE mysql.user SET Password=PASSWORD(&amp;#39;newpassword&amp;#39;) WHERE User=&amp;#39;root&amp;#39;;
# For MySQL 5.7 or higher
SET PASSWORD FOR &amp;#39;root&amp;#39;@&amp;#39;localhost&amp;#39; = PASSWORD(&amp;#34;newpassword&amp;#34;);
FLUSH PRIVILEGES;
exit;
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;# Kill mysqld
killall mysqld
# Restart MySQL
service mysql start
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I ran into issues running MySQL Safe mode. I got a “UNIX socket file don’t exists” error. Here’s the fix.&lt;/p&gt;</description></item><item><title>remove key from known_hosts</title><link>http://uly.me/posts/remove-key-from-known_hosts/</link><pubDate>Sat, 31 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-key-from-known_hosts/</guid><description>&lt;p&gt;If you’ve changed keys, you will need to delete a ssh key from /etc/known_hosts file.&lt;/p&gt;
&lt;p&gt;You can edit it manually using an editor such as vi or vim.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim ~/.ssh/known_hosts
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or you can use ssh-keygen command with -R option to delete the hostname or IP address.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ssh-keygen -f &amp;#34;~/.ssh/known_hosts&amp;#34; -R &amp;#34;xxx.xxx.xxx.xxx&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>copy files using rsync</title><link>http://uly.me/posts/copy-files-using-rsync/</link><pubDate>Fri, 30 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/copy-files-using-rsync/</guid><description>&lt;p&gt;Here’s how to copy files from one directory to another.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rsync -arvz /dir1 /dir2 &amp;gt;&amp;gt; /tmp/rsync.log &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Format: rsynch –options source destination&lt;/p&gt;
&lt;p&gt;Options&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;-a archive mode&lt;/li&gt;
&lt;li&gt;-v verbose&lt;/li&gt;
&lt;li&gt;-p keep permissions&lt;/li&gt;
&lt;li&gt;-z zipped during transfer&lt;/li&gt;
&lt;li&gt;-r recursive&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>aws rds start and stop policy</title><link>http://uly.me/posts/aws-rds-start-and-stop-policy/</link><pubDate>Thu, 29 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-rds-start-and-stop-policy/</guid><description>&lt;p&gt;Here’s a IAM policy that you can add to an IAM user or an IAM role so they are able to start and stop a specific RDS instance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Condition&amp;#34;: {
&amp;#34;StringEqualsIgnoreCase&amp;#34;: {
&amp;#34;rds:db-tag/Application&amp;#34;: &amp;#34;application-name&amp;#34;
}
},
&amp;#34;Action&amp;#34;: [
&amp;#34;rds:DescribeDBInstances&amp;#34;,
&amp;#34;rds:StartDBInstance&amp;#34;,
&amp;#34;rds:StopDBInstance&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:rds:us-east-1:xxxxxxxxxxxx:db:db-instance-name&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws instance type to m5 or c5</title><link>http://uly.me/posts/aws-instance-type-to-m5-or-c5/</link><pubDate>Wed, 28 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-instance-type-to-m5-or-c5/</guid><description>&lt;p&gt;If you have changed instance type to either C5 or M5 and it no longer boots, it’s due to the following reasons.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The Elastic Network Adapter (ENA) enaSupport attribute is disabled for the instance.&lt;/li&gt;
&lt;li&gt;The ENA module isn’t installed on the instance&lt;/li&gt;
&lt;li&gt;The NVMe module isn’t installed on the instance, or, if installed, the NVMe module isn’t loaded in the initramfs image of the instance.&lt;/li&gt;
&lt;li&gt;You are trying to mount the file systems at boot time in the “/etc/fstab” file using a device name. Amazon Elastic Block Store (Amazon EBS) volumes are exposed as NVMe devices to these instance types, and the device names are changed. To avoid this, mount the file systems using UUID/Label. For more information, see &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html"&gt;Amazon EBS and NVMe&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You will need to run a Bash script to update the current instance to be able to support a &lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/boot-error-linux-m5-c5/"&gt;C5 or M5&lt;/a&gt; instance.&lt;/p&gt;</description></item><item><title>aws iam get user</title><link>http://uly.me/posts/aws-iam-get-user/</link><pubDate>Tue, 27 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-iam-get-user/</guid><description>&lt;p&gt;Here’s how to get a user info from AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam get-user --user-name John.Doe --profile default
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli ec2 describe tags</title><link>http://uly.me/posts/aws-cli-ec2-describe-tags/</link><pubDate>Mon, 26 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-ec2-describe-tags/</guid><description>&lt;p&gt;Here’s how to get a list of EC2 tags.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-tags \
--filters &amp;#34;Name=resource-id,Values=i-xxxxxxxxxxxxx&amp;#34; \
--query &amp;#39;Tags[][Key,Value]&amp;#39; \
--profile default \
--region us-east-1 \
--output text
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>outbound dns</title><link>http://uly.me/posts/outbound-dns/</link><pubDate>Fri, 23 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/outbound-dns/</guid><description>&lt;p&gt;Here’s a typical setup for an Outbound DNS server.&lt;/p&gt;
&lt;p&gt;What are unbound servers? Unbound servers are a validating, recursive and caching DNS server&lt;/p&gt;
&lt;p&gt;Install Unbound DNS&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install unbound
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Configuration: /etc/outbound/outbound.conf&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;server:
interface: 0.0.0.0
access-control: 0.0.0.0/0 allow
local-zone: &amp;#34;10.in-addr.arpa.&amp;#34; nodefault
forward-zone:
name: &amp;#34;10.in-addr.arpa.&amp;#34;
forward-addr: 169.254.169.253
forward-zone:
name: &amp;#34;ec2.internal&amp;#34;
forward-addr: 169.254.169.253
forward-zone:
name: &amp;#39;.&amp;#39;
forward-addr: 10.10.10.1
forward-addr: 10.10.11.2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Unbound Start, Stop, Restart and Status&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service outbound start | stop | restart | status
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>.bash_profile vs .bashrc</title><link>http://uly.me/posts/bash_profile-vs-bashrc/</link><pubDate>Wed, 21 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash_profile-vs-bashrc/</guid><description>&lt;p&gt;.bash_profile is executed for login shells. .bashrc is executed for interactive non-login shells. When you login, .bash_profile is executed. If you are already logged in, .bashrc is executed. .bashrc is also executed when you start a new bash using /bin/bash.&lt;/p&gt;</description></item><item><title>install gcp sdk</title><link>http://uly.me/posts/install-gcp-sdk/</link><pubDate>Wed, 21 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-gcp-sdk/</guid><description>&lt;p&gt;Here’s how to install Google Cloud Platform SDK on the following.&lt;/p&gt;
&lt;p&gt;Centos, Fedora and Redhat&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Setup Repo
sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For Debian, Ubuntu, Mint.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Create an environment variable for the correct distribution
export CLOUD_SDK_REPO=&amp;#34;cloud-sdk-$(lsb_release -c -s)&amp;#34;
# Add the Cloud SDK distribution URI as a package source
echo &amp;#34;deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main&amp;#34; | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
# Update the package list and install the Cloud SDK
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install google-cloud-sdk
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>exportfs</title><link>http://uly.me/posts/exportfs/</link><pubDate>Tue, 20 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/exportfs/</guid><description>&lt;p&gt;What’s a stale file handle? A file handle becomes stale when the file or directory referenced by the handle is removed by another host/server, while our client still holds an active reference to the object file/directory. A typical example occurs when the current directory of a process, running on our client, is removed on the server (either by a process running on the server or on another client).&lt;/p&gt;
&lt;p&gt;If your NFS file handles are stale, run this command.&lt;/p&gt;</description></item><item><title>gcp convert standard to ssd</title><link>http://uly.me/posts/gcp-convert-standard-to-ssd/</link><pubDate>Tue, 20 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-convert-standard-to-ssd/</guid><description>&lt;p&gt;How to convert Persistent Standard disk to SSD.&lt;/p&gt;
&lt;p&gt;First create a snapshot of the disk.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks snapshot your-server \
--snapshot-names manual-snapshot-disk-1 \
--project your-project \
--zone us-central1-c
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restore snapshot to SSD format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks create disk-1-ssd \
--source-snapshot manual-snapshot-disk-1 \
--project your-project \
--zone us-central1-a \
--type pd-ssd \
--size 10GB
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Swap disks using GCP attach and detach.&lt;/p&gt;</description></item><item><title>set user umask</title><link>http://uly.me/posts/set-user-umask/</link><pubDate>Tue, 20 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/set-user-umask/</guid><description>&lt;p&gt;How to set up umask for a Linux user.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# sets umask for all users
vi /etc/profile
# sets umask for a user
vi ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add the following umask line to the file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;umask 0022
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>chroot a boot disk</title><link>http://uly.me/posts/chroot-a-boot-disk/</link><pubDate>Mon, 19 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/chroot-a-boot-disk/</guid><description>&lt;p&gt;Here’s a quick way to chroot another boot disk. Attach the rescued boot disk first. Run lsblk and mount.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsblk
mount -t xfs -o nouuid /dev/xvdf2 /mnt
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /dev /mnt/dev
chroot /mnt
cd /mnt
exit
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Unmount when done.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;umount /mnt/proc
umount /mnt/dev
umount /mnt/sys
umount /mnt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>convert file to utf-8</title><link>http://uly.me/posts/convert-file-to-utf-8/</link><pubDate>Mon, 19 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-file-to-utf-8/</guid><description>&lt;p&gt;Here’s how to convert multiple files to UTF-8 format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;for file in *.csv; do
iconv -f ascii -t utf-8 &amp;#34;$file&amp;#34; -o &amp;#34;${file%.txt}.utf8.csv&amp;#34;
done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws acm certificate import</title><link>http://uly.me/posts/aws-acm-certificate-import/</link><pubDate>Sun, 11 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-acm-certificate-import/</guid><description>&lt;p&gt;Here’s how to import a SSL certificate into AWS Certificate Manager.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm import-certificate \
--certificate fileb://example.crt \
--private-key fileb://example.key \
--certificate-chain fileb://example-bundle.crt \
--tags Key=Name,Value=mydomain.com_20220107
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>install aws cli on ubuntu 16.04</title><link>http://uly.me/posts/install-aws-cli-on-ubuntu-16-04/</link><pubDate>Sun, 11 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-aws-cli-on-ubuntu-16-04/</guid><description>&lt;p&gt;I ran into an issue with AWS CLI on Ubuntu 16.04. I was getting this error, “AWSHTTPSConnection’ object has no attribute ‘ssl_context” every time I try to do a simple “aws s3 ls” command. So, here’s the fix.&lt;/p&gt;
&lt;p&gt;Assuming you installed “awscli” using apt. Go ahead and uninstall it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt remove awscli
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install awscli using pip instead.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apt install python-pip
pip install awscli
aws --version
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If this is a fresh install, you may have to run “aws configure.”&lt;/p&gt;</description></item><item><title>gcp lists disk per project</title><link>http://uly.me/posts/gcp-lists-disk-per-project/</link><pubDate>Fri, 09 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-lists-disk-per-project/</guid><description>&lt;p&gt;Here’s the Google Cloud Platform (GCP) GCloud command to list all disks in a specific project.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks list --project yourprojectname
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli list acm certificates</title><link>http://uly.me/posts/aws-cli-list-acm-certificates/</link><pubDate>Thu, 08 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-list-acm-certificates/</guid><description>&lt;p&gt;If you’ve imported or created a SSL certificate via AWS Certificate Manager, here’s the CLI to display a list of certificates.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm list-certificates
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once you have the arn, you can describe certificate. Get the arn from the output above.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm describe-certificate --certificate-arn arn-xxxxxxxxxxxxxxxxxx
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws lightsail create snapshots</title><link>http://uly.me/posts/aws-lightsail-create-snapshots/</link><pubDate>Thu, 08 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-lightsail-create-snapshots/</guid><description>&lt;p&gt;Here’s my script to create snapshots of a LightSail instance. Create daily or weekly snapshots.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
if [ $1 != &amp;#39;&amp;#39; ]; then
prefix=$1
timestamp=$(date +%s)
snapshotname=$prefix&amp;#39;_web-server_&amp;#39;$timestamp
/usr/local/bin/aws lightsail create-instance-snapshot \
--instance-snapshot-name $snapshotname \
--instance-name web-server
else
echo &amp;#39;Need one argument. e.g. daily or weekly&amp;#39;
fi
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Crontab. Job can be scheduled daily or weekly.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# run daily at 4am
0 4 * * * /bin/bash /root/snapshots/create-snapshot.sh daily 2&amp;gt;&amp;amp;1
# run weekly every sunday at 5am
0 5 * * 0 /bin/bash /root/snapshots/create-snapshot.sh weekly 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws lightsail delete snapshots</title><link>http://uly.me/posts/aws-lightsail-delete-snapshots/</link><pubDate>Thu, 08 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-lightsail-delete-snapshots/</guid><description>&lt;p&gt;Here’s my script to delete AWS LightSail snapshots. It can delete daily or weekly backups and scheduled via crontab. If you want longer or shorter retention, adjust the expired value. It’s in seconds. 604800 is 1 week. 2592000 is 1 month.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#!/bin/bash
current=$(date +%s)
if [ $# -eq 0 ]; then
exit 1
fi
if [[ $1 = &amp;#39;daily&amp;#39; ]]; then
prefix=&amp;#39;daily&amp;#39;
expired=$(($current-604800))
elif [[ $1 = &amp;#39;weekly&amp;#39; ]]; then
prefix=&amp;#39;weekly&amp;#39;
expired=$(($current-2592000))
else
exit 1
fi
snaps=&amp;#39;/root/snapshots/snapshots.json&amp;#39;
names=&amp;#39;/root/snapshots/names.txt&amp;#39;
parse=&amp;#39;/root/snapshots/parse.txt&amp;#39;
logfile=&amp;#39;/root/snapshots/snapshots.log&amp;#39;
/usr/local/bin/aws lightsail get-instance-snapshots &amp;gt; $snaps
cat $snaps | jq -r &amp;#39;.instanceSnapshots[] | .name&amp;#39; &amp;gt; $names
cat $names | grep $prefix &amp;gt; $parse
while read -r line; do
snapshot=$(echo $line | cut -d_ -f3)
snapshotname=$line
if [ `expr $snapshot + 1 2&amp;gt; /dev/null` ] ; then
if [ $snapshot -le $expired ]; then
echo &amp;#39;Deleted: &amp;#39;$snapshotname &amp;gt;&amp;gt; $logfile
/usr/local/bin/aws lightsail delete-instance-snapshot \
--instance-snapshot-name $snapshotname
else
echo &amp;#39;Nothing: &amp;#39;$snapshotname &amp;gt;&amp;gt; $logfile
fi
else
echo $snapshot is not numeric &amp;gt; /dev/null
fi
done &amp;gt; $logfile
echo &amp;#39;Expired time: &amp;#39;$expired &amp;gt;&amp;gt; $logfile
echo &amp;#39;-----------------------------------&amp;#39; &amp;gt;&amp;gt; $logfile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Schedule deletes via crontab.&lt;/p&gt;</description></item><item><title>run jekyll in background</title><link>http://uly.me/posts/run-jekyll-in-background/</link><pubDate>Wed, 07 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-jekyll-in-background/</guid><description>&lt;p&gt;Jekyll is a static website generator you can use for developing simple websites. If you are running Jekyll on your desktop, you can view your static website by running a local server. If you want the leave the web server up and running in the background all the time, you can run this command instead.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# normally you run this command
jekyll serve
# running it in the background
jekyll serve &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;
# add incremental which builds only deltas
jekyll serve --incremental &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To kill the server, run the following.&lt;/p&gt;</description></item><item><title>yum add repo manually</title><link>http://uly.me/posts/yum-add-repo-manually/</link><pubDate>Mon, 05 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yum-add-repo-manually/</guid><description>&lt;p&gt;Add a yum repo manually by adding a configuration file in /etc/yum.repo.d/ directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /etc/yum.repos.d/
vi newrepo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;[newrepo]
name=New Repo for RHEL/ CentOS $releasever - $basearch
baseurl=http://newrepo.domain.com/centos/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://newrepo.domain.com/RPM-GPG-KEY.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You may need to import the key.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm --import http://newrepo.domain.com/RPM-GPG-KEY.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Finally, test the new repo by running the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum update -y
yum install new-package
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws efs list on aws backup</title><link>http://uly.me/posts/aws-efs-list-on-aws-backup/</link><pubDate>Fri, 02 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-efs-list-on-aws-backup/</guid><description>&lt;p&gt;Here’s how to get a list of EFS on AWS Backup. Displays a list and looks for a specific tag.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#! /bin/bash
tmpfil=&amp;#34;temp.txt&amp;#34;
output=&amp;#34;efs-list.txt&amp;#34;
&amp;gt; $output
&amp;gt; $tmpfil
declare -a account=(&amp;#34;default&amp;#34; &amp;#34;account1&amp;#34; &amp;#34;account2&amp;#34; &amp;#34;account3&amp;#34;)
declare -a region=(&amp;#34;us-east-1&amp;#34; &amp;#34;us-east-2&amp;#34; &amp;#34;us-west-1&amp;#34; &amp;#34;us-west-2&amp;#34;)
for i in &amp;#34;${account[@]}&amp;#34;; do
echo &amp;#34;===================&amp;#34; &amp;gt;&amp;gt; $output
echo $i &amp;gt;&amp;gt; $output
echo &amp;#34;===================&amp;#34; &amp;gt;&amp;gt; $output
for j in &amp;#34;${region[@]}&amp;#34;; do
echo $j &amp;gt;&amp;gt; $output
echo &amp;#34;-------------------&amp;#34; &amp;gt;&amp;gt; $output
aws efs describe-file-systems \
--query &amp;#39;FileSystems[*].[FileSystemId]&amp;#39; \
--profile $i --region $j --output text &amp;gt;&amp;gt; $tmpfil
while read -r efs; do
echo $efs &amp;gt;&amp;gt; $output
sleep 1s
aws efs describe-tags --file-system-id $efs \
--query &amp;#39;Tags[?Key==`aws-backup`].{Name:Key,Value:Value}&amp;#39; \
--profile $i --region $j --output text &amp;gt;&amp;gt; $output
echo &amp;#34;...................&amp;#34; &amp;gt;&amp;gt; $output
done $tmpfil
done
done
rm $tmpfil
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output file is efs-list.txt&lt;/p&gt;</description></item><item><title>terraform launch ec2 instance</title><link>http://uly.me/posts/terraform-launch-ec2-instance/</link><pubDate>Fri, 02 Aug 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-launch-ec2-instance/</guid><description>&lt;p&gt;Here’s the template for launching an EC2 instance via Terraform.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;provider &amp;#34;aws&amp;#34; {
region = &amp;#34;us-east-1&amp;#34;
shared_credentials_file = &amp;#34;/home/username/.aws/credentials&amp;#34;
profile = &amp;#34;default&amp;#34;
}
resource &amp;#34;aws_security_group&amp;#34; &amp;#34;hostname-sg&amp;#34; {
name = &amp;#34;allow ssh&amp;#34;
vpc_id = &amp;#34;&amp;#34;
ingress {
cidr_blocks = [ &amp;#34;10.0.0.0/8&amp;#34; ]
from_port = 22
to_port = 22
protocol = &amp;#34;tcp&amp;#34;
}
egress {
from_port = 0
to_port = 0
protocol = &amp;#34;-1&amp;#34;
cidr_blocks = [ &amp;#34;0.0.0.0/0&amp;#34; ]
}
}
resource &amp;#34;aws_instance&amp;#34; &amp;#34;hostname&amp;#34; {
ami = &amp;#34;ami-xxxxxxxxxx&amp;#34;
key_name = &amp;#34;your-key&amp;#34;
instance_type = &amp;#34;t2.large&amp;#34;
subnet_id = &amp;#34;subnet-xxxxxxxx&amp;#34;
security_groups = [&amp;#34;${aws_security_group.hostname-sg.id}&amp;#34;]
tags {
Name = &amp;#34;hostname&amp;#34;
Environment = &amp;#34;development&amp;#34;
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp load balancer local routing table</title><link>http://uly.me/posts/gcp-load-balancer-local-routing-table/</link><pubDate>Mon, 29 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-load-balancer-local-routing-table/</guid><description>&lt;p&gt;Test if the GCP Load Balancer is working by sending a curl command from the backend VM.&lt;/p&gt;
&lt;p&gt;Assume the load balancer IP address is 10.1.2.99, and the VM is called vm-a1.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;curl http://10.1.2.99
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The end result is …&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Page served from: vm-a1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Make sure there’s an entry in the local table that matches the IP of the load balancer.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ip route show table local | grep 10.1.2.99
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If not, add it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ip route add to local 10.1.2.99/32 dev eth0 proto 66
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a href="https://cloud.google.com/load-balancing/docs/internal/setting-up-internal"&gt;Documentation&lt;/a&gt;&lt;/p&gt;</description></item><item><title>chrony service</title><link>http://uly.me/posts/chrony-service/</link><pubDate>Sun, 28 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/chrony-service/</guid><description>&lt;p&gt;The chrony service actually does not change the time. The misconception is that the chrony service is setting the time given by the NTP server. This is not what’s happening. The chrony service is just telling the system clock to go faster or slower. This is the reason why sometimes even though the time is wrong and the NTP server is working, the time does not get corrected immediately. It takes a little while.&lt;/p&gt;</description></item><item><title>nfs fails to mount on bootup</title><link>http://uly.me/posts/nfs-fails-to-mount-on-bootup/</link><pubDate>Sun, 28 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nfs-fails-to-mount-on-bootup/</guid><description>&lt;p&gt;Check if rpcbind is running.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service rpcbind status|start|stop|restart
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or you can also clean the NFS cache.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service rpcbind stop
service nfslock stop
rm -rf /var/lib/nfs/statd/sm/*
rm -rf /var/lib/nfs/statd/sm.bak/*
service rpcbind start
service nfslock start
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws s3 upload policy</title><link>http://uly.me/posts/aws-s3-upload-policy/</link><pubDate>Fri, 26 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-upload-policy/</guid><description>&lt;p&gt;Give someone upload access to a S3 bucket. Here’s the policy.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;:&amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;:[
{
&amp;#34;Effect&amp;#34;:&amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;:[
&amp;#34;s3:ListAllMyBuckets&amp;#34;
],
&amp;#34;Resource&amp;#34;:&amp;#34;arn:aws:s3:::*&amp;#34;
},
{
&amp;#34;Effect&amp;#34;:&amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;:[
&amp;#34;s3:ListBucket&amp;#34;,
&amp;#34;s3:GetBucketLocation&amp;#34;
],
&amp;#34;Resource&amp;#34;:&amp;#34;arn:aws:s3:::your-bucket-name&amp;#34;
},
{
&amp;#34;Effect&amp;#34;:&amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;:[
&amp;#34;s3:PutObject&amp;#34;,
&amp;#34;s3:PutObjectAcl&amp;#34;,
&amp;#34;s3:GetObject&amp;#34;,
&amp;#34;s3:GetObjectAcl&amp;#34;,
&amp;#34;s3:DeleteObject&amp;#34;
],
&amp;#34;Resource&amp;#34;:&amp;#34;arn:aws:s3:::your-bucket-name/*&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws ec2 enable secondary ips</title><link>http://uly.me/posts/aws-ec2-enable-secondary-ips/</link><pubDate>Thu, 25 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-ec2-enable-secondary-ips/</guid><description>&lt;p&gt;Here’s how to enable secondary private IPs for AWS EC2 instances.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add secondary private IPs to the instance.
&lt;ul&gt;
&lt;li&gt;Editing the instance Networking &amp;gt; Manage IP Addresses.&lt;/li&gt;
&lt;li&gt;Add new private IP addresses.&lt;/li&gt;
&lt;li&gt;Save.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Set the route configuration for each secondary IP address.
&lt;ul&gt;
&lt;li&gt;Config files are ifcfg-eth0:0, ifcfg-eth:0.1 and so on.&lt;/li&gt;
&lt;li&gt;Test each interface or IP to see if they respond to ping.&lt;/li&gt;
&lt;li&gt;/etc/sysconfig/network-scripts/&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;ifcfg-eth0:0&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;NM_CONTROLLED=&amp;#34;no&amp;#34;
DEVICE=&amp;#34;eth0:0&amp;#34;
ONBOOT=&amp;#34;yes&amp;#34;
BOOTPROTO=&amp;#34;static&amp;#34;
IPADDR=&amp;#34;10.0.0.14&amp;#34;
NETMASK=&amp;#34;255.255.255.255&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;ifcfg-eth0:1&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;NM_CONTROLLED=&amp;#34;no&amp;#34;
DEVICE=&amp;#34;eth0:1&amp;#34;
ONBOOT=&amp;#34;yes&amp;#34;
BOOTPROTO=&amp;#34;static&amp;#34;
IPADDR=&amp;#34;10.0.0.15&amp;#34;
NETMASK=&amp;#34;255.255.255.255&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sssd issues redhat 7</title><link>http://uly.me/posts/sssd-issues-redhat-7/</link><pubDate>Thu, 25 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sssd-issues-redhat-7/</guid><description>&lt;p&gt;Some cache to clear.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service sssd stop
rm -r /var/lib/sss/db/*
rm -r /var/lib/sss/mc/*
service sssd start
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Rejoin domain. Run sssd script. Restart sssd.&lt;/p&gt;</description></item><item><title>trendmicro security agent</title><link>http://uly.me/posts/trendmicro-security-agent/</link><pubDate>Thu, 25 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/trendmicro-security-agent/</guid><description>&lt;p&gt;How to start/stop/restart/status TrendMicro Security agent.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/etc/init.d/ds_agent start
/etc/init.d/ds_agent stop
/etc/init.d/ds_agent restart
/etc/init.d/ds_agent status
/etc/init.d/ds_agent reset
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check if installed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -qa | grep &amp;#39;ds_agent&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install with verbose and hash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -ivh package-name
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Uninstall with verbose.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -ev package-name
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sftp with aws keys</title><link>http://uly.me/posts/sftp-with-aws-keys/</link><pubDate>Wed, 24 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sftp-with-aws-keys/</guid><description>&lt;p&gt;How to use SFTP with AWS Keys.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sftp -i &amp;#34;yourkey&amp;#34; ec2-user@your-server
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To copy files to server. File will copied to user’s home directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sftp&amp;gt; put file.txt .
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli add tags to iam user</title><link>http://uly.me/posts/aws-cli-add-tags-to-iam-user/</link><pubDate>Mon, 22 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-add-tags-to-iam-user/</guid><description>&lt;p&gt;How to add tags to an existing IAM user via AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam tag-user \
--user-name john.doe \
--tags &amp;#39;{&amp;#34;Key&amp;#34;: &amp;#34;Department&amp;#34;, &amp;#34;Value&amp;#34;: &amp;#34;Accounting&amp;#34;}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Multiple tags.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam tag-user \
--user-name john.doe \
--tags &amp;#39;[{&amp;#34;Key&amp;#34;: &amp;#34;Department&amp;#34;, &amp;#34;Value&amp;#34;: &amp;#34;Accounting&amp;#34;},{&amp;#34;Key&amp;#34;: &amp;#34;Manager&amp;#34;, &amp;#34;Value&amp;#34;: &amp;#34;jane.doe&amp;#34;}]&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli ec2 impaired instances</title><link>http://uly.me/posts/aws-cli-ec2-impaired-instances/</link><pubDate>Mon, 22 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-ec2-impaired-instances/</guid><description>&lt;p&gt;Here’s how to get a list of EC2 instances with a status of impaired.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-instance-status \
--filters Name=instance-status.status,Values=impaired
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli iam create user</title><link>http://uly.me/posts/aws-cli-iam-create-user/</link><pubDate>Mon, 22 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-iam-create-user/</guid><description>&lt;p&gt;How to create an IAM user via AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam create-user --user-name john.doe \
--tags Key=&amp;#39;key1&amp;#39;,Value=&amp;#39;value1&amp;#39;, Key=&amp;#39;key2&amp;#39;,Value=&amp;#39;value2&amp;#39; \
--profile your-profile
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To add keys.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws iam create-access-key \
--user-name username \
--profile your-profile
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>migrate efs to another vpc</title><link>http://uly.me/posts/migrate-efs-to-another-vpc/</link><pubDate>Sun, 21 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/migrate-efs-to-another-vpc/</guid><description>&lt;p&gt;Migrating a EFS from one VPC to another is quite simple. There’s no need to delete it. Just click on “manage file systems access” and remove all mount targets and Save. Once the targets are removed, you can choose another VPC from the dropdown. Once a VPC is selected. Add the subnets and security groups. Save and you are done!&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/07/efs-vpc.png"&gt;&lt;/p&gt;</description></item><item><title>aws cli ec2 instance status</title><link>http://uly.me/posts/aws-cli-ec2-instance-status/</link><pubDate>Wed, 17 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-ec2-instance-status/</guid><description>&lt;p&gt;How to display AWS EC2 instance statuses.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-instance-status \
--query &amp;#39;InstanceStatuses[].[InstanceId,SystemStatus.Status]&amp;#39; \
--include-all-instances \
--region us-east-2
--profile abcdef \
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Query and Filter.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-instance-status \
--query &amp;#39;InstanceStatuses[].[InstanceId,SystemStatus.Status]&amp;#39; \
--filter &amp;#39;Name=instance-state-name,Values=stopped&amp;#39; \
--region us-east-2
--profile abcdef \
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Filter event.code equal to instance-reboot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-instance-status \
--query &amp;#39;InstanceStatuses[].[InstanceId,SystemStatus.Status]&amp;#39; \
--filter &amp;#39;Name=eventcode,Values=instance-reboot&amp;#39; \
--region us-east-2
--profile abcdef \
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>https in codeigniter</title><link>http://uly.me/posts/https-in-codeigniter/</link><pubDate>Wed, 17 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/https-in-codeigniter/</guid><description>&lt;p&gt;If you switched to HTTPS in Apache, make sure to update CodeIgniter’s config file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim /var/www/applications/config/config.php
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change the base URL to https.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$config[&amp;#39;base_url&amp;#39;] = &amp;#39;https://yourdomain.com/ci/&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>uptime in windows</title><link>http://uly.me/posts/uptime-in-windows/</link><pubDate>Tue, 16 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/uptime-in-windows/</guid><description>&lt;p&gt;Here’s how to find uptime in Windows servers.&lt;/p&gt;
&lt;p&gt;Go to “Start” -&amp;gt; “Run”. Write “CMD” and press “Enter” key.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;net statistics server
# or
net stats srv
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>efs io issue</title><link>http://uly.me/posts/efs-io-issue/</link><pubDate>Thu, 11 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/efs-io-issue/</guid><description>&lt;p&gt;If the EFS mount is unresponsive, try using this …&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/bin/ls -1f
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is an issue with having too many small files in a directory. This can be fixed by sharding files to multiple sub-directories.&lt;/p&gt;</description></item><item><title>lessons from boeing 737</title><link>http://uly.me/posts/lessons-from-boeing-737/</link><pubDate>Thu, 11 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lessons-from-boeing-737/</guid><description>&lt;p&gt;On October 2018, Lion Air Flight 610 from Jakarta to Pangkal Pinang, crashed into the sea 13 minutes after takeoff, killing all 189 people aboard. Six months later, Ethiopian Airlines Flight 302, went down under similar circumstances, killing all 157 people aboard. All Boeing 737 Max planes were grounded world-wide. Over $6 billion dollars evaporated from the company’s market cap overnight. If the crisis is not fixed soon, it will impact the long term stability of the company. Boeing 737 sales are 33% of the projected sales in the next 5 years.&lt;/p&gt;</description></item><item><title>amazon linux docker install</title><link>http://uly.me/posts/amazon-linux-docker-install/</link><pubDate>Wed, 10 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/amazon-linux-docker-install/</guid><description>&lt;p&gt;Here’s the installation of Docker for the original Amazon Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# To install docker
sudo yum install docker
sudo service docker start
# Validate it&amp;#39;s working
docker --version
docker run hello-world
docker ps -a
docker image ls
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sftp login</title><link>http://uly.me/posts/sftp-login/</link><pubDate>Mon, 08 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sftp-login/</guid><description>&lt;p&gt;How to login using SFTP on a non-standard port.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sftp -oPort=2233 username@servername
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Get list of commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sftp help
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>display instance id and ip address</title><link>http://uly.me/posts/display-instance-id-ip-address/</link><pubDate>Sun, 07 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-instance-id-ip-address/</guid><description>&lt;p&gt;How to display IP address and Instance ID on web page behind a AWS load balancer.&lt;/p&gt;
&lt;p&gt;Add these 2 commands in crontab. The job runs every 5 mins.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;*/5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/instance-id &amp;gt; /var/www/html/id.txt
*/5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/public-ipv4 &amp;gt; /var/www/html/ip.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can view on the site.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# your domain
http://yourdomain.com/ip.txt
http://yourdomain.com/id.txt
# your server ip address
http://1.1.1.1/ip.txt
http://1.1.1.1/id.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sudo with no password</title><link>http://uly.me/posts/sudo-with-no-password/</link><pubDate>Sun, 07 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sudo-with-no-password/</guid><description>&lt;p&gt;If you’re the only user on your system, you don’t need to be prompted every time you run the sudo command.&lt;/p&gt;
&lt;p&gt;Add yourself to the sudoers file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# create a new file
sudo visudo -f /etc/sudoers.d/users
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add this line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# add your username
username ALL=(ALL) NOPASSWD:ALL
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Exit and try again.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# exit out and login again
exit
# try to sudo again
sudo -i
# there&amp;#39;s no password prompt for sudo this time
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>apache webroot</title><link>http://uly.me/posts/apache-webroot/</link><pubDate>Fri, 05 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/apache-webroot/</guid><description>&lt;p&gt;Where’s Apache and webroot for the different distros?&lt;/p&gt;
&lt;p&gt;Webroot:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Redhat, Fedora, Centos, Amazon Linux
/var/www/html
# Debian, Ubuntu, Mint
/var/www/html
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Apache Configuration:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Redhat, Fedora, Centos, Amazon Linux
/etc/httpd/conf/httpd.conf
# Debian, Ubuntu, Mint
/etc/apache2/sites-available/default
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>icecast on docker</title><link>http://uly.me/posts/icecast-on-docker/</link><pubDate>Fri, 05 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/icecast-on-docker/</guid><description>&lt;p&gt;Run Icecast2 on a Docker container.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker run -d \
-p 8000:8000 \
-e ICECAST_SOURCE_PASSWORD=aaaa \
-e ICECAST_ADMIN_PASSWORD=bbbb \
-e ICECAST_PASSWORD=cccc \
-e ICECAST_RELAY_PASSWORD=dddd \
moul/icecast
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Access localhost:8000 on browser. &lt;a href="https://github.com/moul/docker-icecast"&gt;Github&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>convert mp3 to ogg</title><link>http://uly.me/posts/convert-mp3-to-ogg/</link><pubDate>Thu, 04 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-mp3-to-ogg/</guid><description>&lt;p&gt;Convert MP3 to Vorbis OGG format using ffmpeg.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ffmpeg -i input.mp3 -c:a libvorbis -q:a 4 output.ogg
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want multiple files, use a loop.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;for f in ./*.mp3; do ffmpeg -i &amp;#34;$f&amp;#34; -c:a libvorbis -q:a 4 &amp;#34;${f/%mp3/ogg}&amp;#34;; done
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>docker stop and remove all</title><link>http://uly.me/posts/docker-stop-and-remove-all/</link><pubDate>Thu, 04 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/docker-stop-and-remove-all/</guid><description>&lt;p&gt;Here’s the command to stop and remove all Docker containers.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>install docker on linux</title><link>http://uly.me/posts/install-docker-on-linux/</link><pubDate>Thu, 04 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-docker-on-linux/</guid><description>&lt;p&gt;How to install Docker on Linux Mint or Ubuntu.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get install docker-ce docker-ce-cli containerd.io
docker --version
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>matrox monarch configuration</title><link>http://uly.me/posts/matrox-monarch-configuration/</link><pubDate>Thu, 04 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/matrox-monarch-configuration/</guid><description>&lt;p&gt;You can import the Matrox Monarch HD configuration on boot up from a web page. Go to:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Command Center &amp;gt; Automatic Configuration.
Type in URL Address starting with https.
Check &amp;#34;Load settings on device reboot.&amp;#34;
You can either power off the device or hit reset.
Holding reset for more than 5 seconds does a factory reset.
On next bootup, device will have configuration contained from the remote file.
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>matrox monarch usb format</title><link>http://uly.me/posts/matrox-monarch-usb-format/</link><pubDate>Thu, 04 Jul 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/matrox-monarch-usb-format/</guid><description>&lt;p&gt;Format USB drives to NTFS. Use USB 0 for recording.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/07/matrox.jpg"&gt;&lt;/p&gt;</description></item><item><title>cloudfront xml error</title><link>http://uly.me/posts/cloudfront-xml-error/</link><pubDate>Sun, 30 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cloudfront-xml-error/</guid><description>&lt;p&gt;If you’re seeing an XML error, check the default root object in your CloudFront distribution.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/06/default-root.png"&gt;&lt;/p&gt;
&lt;p&gt;CloudFront distribution setting&lt;/p&gt;
&lt;p&gt;It should be set to your index page.&lt;/p&gt;</description></item><item><title>obs source is a red dot</title><link>http://uly.me/posts/obs-source-is-a-red-dot/</link><pubDate>Sun, 30 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/obs-source-is-a-red-dot/</guid><description>&lt;p&gt;If you’re adding a media source (RTMP, RTSP or HLS) in OBS and all you’re getting is a red dot, here’s a quick fix.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;For Windows, hit Control-F.
For Mac OS, hit Command-F.
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>disable falcon-sensor</title><link>http://uly.me/posts/disable-falcon-sensor/</link><pubDate>Fri, 28 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/disable-falcon-sensor/</guid><description>&lt;p&gt;Here’s how to disable falcon-sensor or CrowdStrike.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl stop falcon-sensor
systemctl disable falcon-sensor
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>google sdk update</title><link>http://uly.me/posts/google-sdk-update/</link><pubDate>Fri, 28 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/google-sdk-update/</guid><description>&lt;p&gt;How to upgrade Google SDK on Redhat, Fedora and Centos Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud components update
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you are having trouble running that command because the GCloud component manager is disabled, you can try the following commands which will achieve the same result as above.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo yum makecache &amp;amp;&amp;amp; sudo yum update \
kubectl \
google-cloud-sdk \
google-cloud-sdk-app-engine-grpc \
google-cloud-sdk-pubsub-emulator \
google-cloud-sdk-app-engine-go \
google-cloud-sdk-cloud-build-local \
google-cloud-sdk-datastore-emulator \
google-cloud-sdk-app-engine-python \
google-cloud-sdk-cbt \
google-cloud-sdk-bigtable-emulator \
google-cloud-sdk-datalab \
google-cloud-sdk-app-engine-java
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>calculate epoch time to date</title><link>http://uly.me/posts/calculate-epoch-time-to-date/</link><pubDate>Thu, 27 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/calculate-epoch-time-to-date/</guid><description>&lt;p&gt;Here’s how to calculate epoch time using the Linux date command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Linux
date --date @1561266781
date -d @1561266781
# MacOS
date -r 1561266781
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output is : Sun Jun 23 05:13:01 UTC 2019&lt;/p&gt;
&lt;p&gt;Show current epoch time.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;date +%s
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Output: 1561642643&lt;/p&gt;</description></item><item><title>aws cli restore object from s3 glacier</title><link>http://uly.me/posts/aws-cli-restore-object-from-s3-glacier/</link><pubDate>Wed, 26 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-restore-object-from-s3-glacier/</guid><description>&lt;p&gt;How to restore an object from Amazon S3 Glacier via the AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws s3api restore-object \
--bucket awsexamplebucket \
--key dir1/example.obj \
--restore-request &amp;#39;{&amp;#34;Days&amp;#34;:25,&amp;#34;GlacierJobParameters&amp;#34;:{&amp;#34;Tier&amp;#34;:&amp;#34;Standard&amp;#34;}}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws lightsail create instance</title><link>http://uly.me/posts/aws-lightsail-create-instance/</link><pubDate>Mon, 24 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-lightsail-create-instance/</guid><description>&lt;p&gt;How to create a LightSail instance from a snapshot via AWS CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail create-instances-from-snapshot \
--instance-names your-server-name \
--availability-zone us-east-1a \
--instance-snapshot-name your-snapshot \
--bundle-id nano_1_0 \
--key-pair-name your-key-pair
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws lightsail delete instance</title><link>http://uly.me/posts/aws-lightsail-delete-instance/</link><pubDate>Mon, 24 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-lightsail-delete-instance/</guid><description>&lt;p&gt;How to delete AWS LightSail instance via CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail delete-instance --instance-name your-server-name
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws lightsail get instance info</title><link>http://uly.me/posts/aws-lightsail-get-instance-info/</link><pubDate>Mon, 24 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-lightsail-get-instance-info/</guid><description>&lt;p&gt;Get AWS LightSail instance info from the CLI.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail get-instance --instance-name your-server
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>add date to filenames</title><link>http://uly.me/posts/add-date-to-filenames/</link><pubDate>Sun, 23 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-date-to-filenames/</guid><description>&lt;p&gt;Here’s how to add date stamps to filenames. Uses epoch time.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;tar cpzf mybackup-`date +%s`.gz /home/user
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>obs chroma key</title><link>http://uly.me/posts/obs-chroma-key/</link><pubDate>Sun, 23 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/obs-chroma-key/</guid><description>&lt;p&gt;Here’s how to add chroma key (green screen) to your OBS shoot.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start OBS.&lt;/li&gt;
&lt;li&gt;Add a video source.&lt;/li&gt;
&lt;li&gt;Right click on video source and select ‘Filter’.&lt;/li&gt;
&lt;li&gt;Click + in the ‘Effects Filters’ section, and choose ‘Chroma Key’.&lt;/li&gt;
&lt;li&gt;Enter a name for the effects layer.&lt;/li&gt;
&lt;li&gt;Fine tune the settings.&lt;/li&gt;
&lt;li&gt;Add background layers.&lt;/li&gt;
&lt;li&gt;Make sure to send to the back.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>which shell is running</title><link>http://uly.me/posts/which-shell-is-running/</link><pubDate>Sun, 23 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/which-shell-is-running/</guid><description>&lt;p&gt;Here’s how to find out which shell you are running. Run any of the 3 commands below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo $0
echo $SHELL
ps -p &amp;#34;$$&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli create lightsail snapshot</title><link>http://uly.me/posts/aws-cli-create-lightsail-snapshot/</link><pubDate>Fri, 21 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-create-lightsail-snapshot/</guid><description>&lt;p&gt;Here’s the AWS CLI for creating a LightSail snapshot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail create-instance-snapshot \
--instance-snapshot-name test-snapshot \
--instance-name your-server
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s how to delete a snapshot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail delete-instance-snapshot \
--instance-snapshot-name test-snapshot
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>moving linux directory</title><link>http://uly.me/posts/moving-linux-directory/</link><pubDate>Mon, 17 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/moving-linux-directory/</guid><description>&lt;p&gt;Moving a Linux directory the safe way.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /mydir ; tar cf - . | (cd /data/mydir ; tar xf -) ; mv /mydir /mydir.0 ; ln -s /data/mydir /mydir
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>crontab editor</title><link>http://uly.me/posts/crontab-editor/</link><pubDate>Sun, 16 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/crontab-editor/</guid><description>&lt;p&gt;If you want to change the crontab editor, run the following:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ select-editor
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Choose one.&lt;/p&gt;</description></item><item><title>gcp restore</title><link>http://uly.me/posts/gcp-restore/</link><pubDate>Sun, 16 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-restore/</guid><description>&lt;p&gt;How to restore from GCP Snapshots. Let’s say you have an instance called webserver with 2 disks.&lt;/p&gt;
&lt;p&gt;Restore from snapshots:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks create webserver-boot-r \
--project=your-project \
--source-snapshot=webserver-boot-190616 \
--zone=us-central1-a
gcloud compute disks create webserver-data-r \
--project=your-project \
--source-snapshot=webserver-data-190616 \
--zone=us-central1-a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Stop instance. Detach and attach disks:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances detach-disk webserver --disk=webserver-boot --zone us-central1-a
gcloud compute instances attach-disk webserver --disk=webserver-boot-r --zone us-central1-a --boot
gcloud compute instances detach-disk webserver --disk=webserver-data --zone us-central1-a
gcloud compute instances attach-disk webserver --disk=webserver-data-r --zone us-central1-a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Boot instance.&lt;/p&gt;</description></item><item><title>vim page up and down</title><link>http://uly.me/posts/vim-page-up-down/</link><pubDate>Sun, 16 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vim-page-up-down/</guid><description>&lt;p&gt;How to Page Up and &amp;amp; Down in VIM.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Page Down
Ctrl-B
# Page Up
Ctrl-F
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>change dns records in route 53 via cli</title><link>http://uly.me/posts/change-dns-records-in-route-53-via-cli/</link><pubDate>Fri, 14 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-dns-records-in-route-53-via-cli/</guid><description>&lt;p&gt;How to change DNS records in Route 53 via AWS CLI.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Assuming AWS CLI is already configured&lt;/li&gt;
&lt;li&gt;Uses Route53 change-resource-record-sets to update DNS records&lt;/li&gt;
&lt;li&gt;Substitute with your own hosted-zone-id&lt;/li&gt;
&lt;li&gt;Uses JSON files containing record sets&lt;/li&gt;
&lt;li&gt;See JSON file examples below&lt;/li&gt;
&lt;/ul&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /path/to/scripts/
# the command to switch to the elb
aws route53 change-resource-record-sets --hosted-zone-id xxxxxxxxxxxxxx --change-batch file://elb.json
# the command to switch to standard site
aws route53 change-resource-record-sets --hosted-zone-id xxxxxxxxxxxxxx --change-batch file://live.json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;elb.json = points to AWS ELB (elastic load balancer)&lt;/p&gt;</description></item><item><title>route 53 policy to change records</title><link>http://uly.me/posts/route-53-policy-to-change-records/</link><pubDate>Fri, 14 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/route-53-policy-to-change-records/</guid><description>&lt;p&gt;Here’s the IAM policy you’ll need to change Route 53 DNS records. Substitute with your own hosted zone id.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Statement&amp;#34;:[{
&amp;#34;Effect&amp;#34;:&amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;:[&amp;#34;route53:ChangeResourceRecordSets&amp;#34;],
&amp;#34;Resource&amp;#34;:&amp;#34;arn:aws:route53:::hostedzone/*HOSTEDZONEID*&amp;#34;
}
],
&amp;#34;Statement&amp;#34;:[{
&amp;#34;Effect&amp;#34;:&amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;:[&amp;#34;route53:GetChange&amp;#34;],
&amp;#34;Resource&amp;#34;:&amp;#34;arn:aws:route53:::change/*&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add to policy to a user.&lt;/p&gt;</description></item><item><title>gcp list snapshots</title><link>http://uly.me/posts/gcp-list-snapshots/</link><pubDate>Thu, 13 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-list-snapshots/</guid><description>&lt;p&gt;Here are several examples how to display GCP snapshots using Google SDK (CLI – command line interface).&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# list snapshots
gcloud compute snapshots list \
--project my-project \
--filter=&amp;#34;name~&amp;#39;my-server-boot&amp;#39;&amp;#34;
# limit 10
gcloud compute snapshots list \
--project my-project \
--filter=&amp;#34;name~&amp;#39;my-server-boot&amp;#39;&amp;#34; \
--limit 10
# reverse order
gcloud compute snapshots list \
--project my-project \
--filter=&amp;#34;name~&amp;#39;my-server-boot&amp;#39;&amp;#34; \
--limit 10 \
--sort-by=&amp;#34;~name&amp;#34;
# display uri
gcloud compute snapshots list \
--project my-project \
--filter=&amp;#34;name~&amp;#39;my-server-boot&amp;#39;&amp;#34; \
--limit 10 \
--sort-by=&amp;#34;~name&amp;#34; \
--uri
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>crontab file</title><link>http://uly.me/posts/crontab-file/</link><pubDate>Wed, 12 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/crontab-file/</guid><description>&lt;p&gt;How to load crontab from file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;crontab /path/to/file.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Save crontab to a file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;crontab -l &amp;gt; /path/to/file.txt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>get-hotfix</title><link>http://uly.me/posts/get-hotfix/</link><pubDate>Tue, 11 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/get-hotfix/</guid><description>&lt;p&gt;What patches were installed on Windows Server. Run the command below in Powershell as Administrator.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;get-hotfix
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also see it from the Control Panel &amp;gt; Program &amp;gt; Programs and Features &amp;gt; Installed Updates.&lt;/p&gt;</description></item><item><title>nfs client</title><link>http://uly.me/posts/nfs-client/</link><pubDate>Mon, 10 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nfs-client/</guid><description>&lt;p&gt;Services to check.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;chkconfig nfs on
service rpcbind start
service nfs start
mount -a
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If missing, install it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install nfs-utils nfs-utils-lib
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Mount it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mount -a
mount 192.168.1.200:/home /mnt/nfs/home
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add to /etc/fstab.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;10.10.10.10:/home on /mnt/nfs/home type nfs (rw,noatime,nolock,bg,nfsvers=2,intr,tcp,actimeo=1800,addr=10.10.10.10)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>removing old kernels</title><link>http://uly.me/posts/removing-old-kernels/</link><pubDate>Mon, 10 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/removing-old-kernels/</guid><description>&lt;p&gt;How to check which kernel is running on your system&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;uname -sr
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;List all kernels installed on the system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -q kernel
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Removing old kernels using package-cleanup. This keeps 2 kernels on the system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;yum install yum-utils
package-cleanup --oldkernels --count=2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>efs cloudformation</title><link>http://uly.me/posts/efs-cloudformation/</link><pubDate>Sun, 09 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/efs-cloudformation/</guid><description>&lt;p&gt;Here’s a simple EFS CloudFormation template with a one mount target.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;AWSTemplateFormatVersion&amp;#34;: &amp;#34;2010-09-09&amp;#34;,
&amp;#34;Description&amp;#34;: &amp;#34;EFS example setup&amp;#34;,
&amp;#34;Parameters&amp;#34;: {
&amp;#34;VPC&amp;#34;: {
&amp;#34;Description&amp;#34;: &amp;#34;VPC ID&amp;#34;,
&amp;#34;Type&amp;#34;: &amp;#34;AWS::EC2::VPC::Id&amp;#34;
},
&amp;#34;Subnet&amp;#34;: {
&amp;#34;Description&amp;#34;: &amp;#34;Subnet ID&amp;#34;,
&amp;#34;Type&amp;#34;: &amp;#34;AWS::EC2::Subnet::Id&amp;#34;
},
&amp;#34;EC2SecurityGroup&amp;#34;: {
&amp;#34;Description&amp;#34;: &amp;#34;Security Group for EC2 instance&amp;#34;,
&amp;#34;Type&amp;#34;: &amp;#34;AWS::EC2::SecurityGroup::Id&amp;#34;
}
},
&amp;#34;Resources&amp;#34;: {
&amp;#34;EFSFileSystem&amp;#34;: {
&amp;#34;Type&amp;#34; : &amp;#34;AWS::EFS::FileSystem&amp;#34;,
&amp;#34;Properties&amp;#34; : {
&amp;#34;FileSystemTags&amp;#34; : [
{&amp;#34;Key&amp;#34; : &amp;#34;Name&amp;#34;, &amp;#34;Value&amp;#34; : {&amp;#34;Ref&amp;#34;: &amp;#34;AWS::StackName&amp;#34;}}
]
}
},
&amp;#34;EFSMountTarget&amp;#34;: {
&amp;#34;Type&amp;#34;: &amp;#34;AWS::EFS::MountTarget&amp;#34;,
&amp;#34;Properties&amp;#34;: {
&amp;#34;FileSystemId&amp;#34;: {&amp;#34;Ref&amp;#34;: &amp;#34;EFSFileSystem&amp;#34;},
&amp;#34;SubnetId&amp;#34;: { &amp;#34;Ref&amp;#34;: &amp;#34;Subnet&amp;#34; },
&amp;#34;SecurityGroups&amp;#34;: [{&amp;#34;Ref&amp;#34;: &amp;#34;EFSSecurityGroup&amp;#34;}]
}
},
&amp;#34;EFSSecurityGroup&amp;#34;: {
&amp;#34;Type&amp;#34;: &amp;#34;AWS::EC2::SecurityGroup&amp;#34;,
&amp;#34;Properties&amp;#34;: {
&amp;#34;GroupDescription&amp;#34;: &amp;#34;Allowing access to EFS&amp;#34;,
&amp;#34;VpcId&amp;#34;: {&amp;#34;Ref&amp;#34;: &amp;#34;VPC&amp;#34;},
&amp;#34;SecurityGroupIngress&amp;#34;: [{
&amp;#34;IpProtocol&amp;#34;: &amp;#34;tcp&amp;#34;,
&amp;#34;FromPort&amp;#34;: 2049,
&amp;#34;ToPort&amp;#34;: 2049,
&amp;#34;SourceSecurityGroupId&amp;#34;: {&amp;#34;Ref&amp;#34;: &amp;#34;EC2SecurityGroup&amp;#34;}
}]
}
}
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>api gateway policy</title><link>http://uly.me/posts/api-gateway-policy/</link><pubDate>Wed, 05 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/api-gateway-policy/</guid><description>&lt;p&gt;This policy gives a user access to the API gateway.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Sid&amp;#34;: &amp;#34;apigateway-policy&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Action&amp;#34;: [
&amp;#34;apigateway:DELETE&amp;#34;,
&amp;#34;apigateway:PUT&amp;#34;,
&amp;#34;apigateway:PATCH&amp;#34;,
&amp;#34;apigateway:POST&amp;#34;,
&amp;#34;apigateway:GET&amp;#34;
],
&amp;#34;Resource&amp;#34;: &amp;#34;*&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>s3 restrict ip addresses</title><link>http://uly.me/posts/s3-restrict-ip-addresses/</link><pubDate>Wed, 05 Jun 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/s3-restrict-ip-addresses/</guid><description>&lt;p&gt;Here’s the policy to restrict access to S3 bucket to certain IP addresses.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Id&amp;#34;: &amp;#34;S3PolicyIPRestrict&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Sid&amp;#34;: &amp;#34;IPAllow&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Principal&amp;#34;: {
&amp;#34;AWS&amp;#34;: &amp;#34;*&amp;#34;
},
&amp;#34;Action&amp;#34;: &amp;#34;s3:*&amp;#34;,
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:s3:::bucket/*&amp;#34;,
&amp;#34;Condition&amp;#34; : {
&amp;#34;IpAddress&amp;#34; : {
&amp;#34;aws:SourceIp&amp;#34;: &amp;#34;10.10.10.0/24&amp;#34;
},
&amp;#34;NotIpAddress&amp;#34; : {
&amp;#34;aws:SourceIp&amp;#34;: &amp;#34;10.10.10.100/32&amp;#34;
}
}
}
]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Allow anyone in the 10.10.10.0/24 network except for 10.10.10.100/32.&lt;/p&gt;</description></item><item><title>certbot aws renewals</title><link>http://uly.me/posts/certbot-aws-renewals/</link><pubDate>Mon, 27 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/certbot-aws-renewals/</guid><description>&lt;p&gt;Here are the instructions for renewing &lt;a href="https://certbot.eff.org/"&gt;Certbot&lt;/a&gt; SSL certificates in &lt;a href="https://aws.amazon.com/certificate-manager/"&gt;AWS Certificate Manager&lt;/a&gt;. Certbot provides SSL certificates for free for 60 days and are auto-renewed before they expire. If you are using Certbot SSL certificates with CloudFront, you will need to reimport them to AWS Certificate Manager before expiration.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Get the latest SSL certificate by running “&lt;strong&gt;certbot certificates&lt;/strong&gt;.”&lt;/li&gt;
&lt;li&gt;Reimport the certificate in 3 parts.
&lt;ul&gt;
&lt;li&gt;Certificate Body – the root or top portion of the full chain&lt;/li&gt;
&lt;li&gt;Certificate Private key – the private key&lt;/li&gt;
&lt;li&gt;Certificate chain – the entire full chain containing multiple certificates&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Click Save. Check expiration.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You’ll need to update the certificate before the next expiration date.&lt;/p&gt;</description></item><item><title>differences between aws, azure and gcp</title><link>http://uly.me/posts/differences-between-aws-azure-and-gcp/</link><pubDate>Sun, 26 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/differences-between-aws-azure-and-gcp/</guid><description>&lt;p&gt;Here’s a side by side comparison of &lt;a href="https://cloud.google.com/docs/compare/aws/"&gt;AWS vs. GCP&lt;/a&gt;, and &lt;a href="https://docs.microsoft.com/en-us/azure/architecture/aws-professional/services"&gt;AWS vs. Azure&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>aws assume role</title><link>http://uly.me/posts/aws-assume-role/</link><pubDate>Thu, 23 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-assume-role/</guid><description>&lt;p&gt;If you have multiple AWS accounts, you can gain additional permission by authorizing it to a different AWS account via IAM. Here’s the &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html"&gt;assume role&lt;/a&gt; documentation from AWS. And here are some documentation if you need to grant someone to &lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_permissions-to-switch.html"&gt;switch&lt;/a&gt; accounts. If you are going to be using the AWS CLI, you will need to run “aws configure” to setup multiple profiles.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Action&amp;#34;: &amp;#34;sts:AssumeRole&amp;#34;,
&amp;#34;Resource&amp;#34;: [
&amp;#34;arn:aws:iam::*:role/your-custom-role&amp;#34;
],
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sublime text remove tabs</title><link>http://uly.me/posts/sublime-text-remove-tabs/</link><pubDate>Mon, 20 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sublime-text-remove-tabs/</guid><description>&lt;p&gt;I keep forgetting this command. This is to remove tabs from multiple lines in Sublime Text.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Shift+Tab
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli lightsail</title><link>http://uly.me/posts/aws-cli-lightsail/</link><pubDate>Sun, 19 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-lightsail/</guid><description>&lt;p&gt;Get instance details&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail get-instance --instance-name your-server
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Get instance state&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail get-instance-state --instance-name your-server
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a snapshot&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail create-instance-snapshot \
--instance-snapshot-name your-server-new-snapshot-201905192200 \
--instance-name your-server
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create disk from snapshot&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail create-disk-from-snapshot \
--disk-name your-server-new-boot-disk \
--disk-name your-server-new-snapshot-201905192200 \
--availability-zone us-east-1a
--size-in-gb 50
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Attach Disk&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail attach-disk \
--disk-name your-server-new-boot-disk \
--instance-name your-server \
--disk-path /dev/sda1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create instance from snapshot&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws lightsail create-instance-snapshot \
--instance-snaphot-name your-server-new-snapshot-201905192200
--instance-name your-server
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Attach Static IP Address&lt;/p&gt;</description></item><item><title>count number of files in directory</title><link>http://uly.me/posts/count-number-of-files-in-directory/</link><pubDate>Tue, 14 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/count-number-of-files-in-directory/</guid><description>&lt;p&gt;Get a count of the number of files in a directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# using ls
ls | wc -l
ls -Aq | wc -l
# include hidden files
find . ! -name . -prune -print | grep -c /
find .//. ! -name . -print | grep -c //
# using tree if installed. yum install tree. apt-get install tree
tree
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>split text into columns in excel</title><link>http://uly.me/posts/split-text-into-columns-in-excel/</link><pubDate>Tue, 14 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/split-text-into-columns-in-excel/</guid><description>&lt;p&gt;How to Split Text into Columns in Excel.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select the cell or column that contains the text you want to split.&lt;/li&gt;
&lt;li&gt;Select Data &amp;gt; Text to Columns.&lt;/li&gt;
&lt;li&gt;In the Convert Text to Columns Wizard, select Delimited &amp;gt; Next.&lt;/li&gt;
&lt;li&gt;Select the Delimiters for your data. For example, Comma and Space.&lt;/li&gt;
&lt;li&gt;You can see a preview of your data in the Data preview window.&lt;/li&gt;
&lt;li&gt;Select Next.&lt;/li&gt;
&lt;li&gt;Select the Column data format or use what Excel chose for you.&lt;/li&gt;
&lt;li&gt;Select the Destination, which is where you want the split data to appear on your worksheet.&lt;/li&gt;
&lt;li&gt;Select Finish.&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>aws glacier setup via s3</title><link>http://uly.me/posts/aws-glacier-setup-via-s3/</link><pubDate>Mon, 13 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-glacier-setup-via-s3/</guid><description>&lt;p&gt;You can setup AWS Glacier via S3 bucket replication. Create a S3 bucket and slap this bucket policy.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Id&amp;#34;: &amp;#34;S3PolicyId1&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Sid&amp;#34;: &amp;#34;IPAllow&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Allow&amp;#34;,
&amp;#34;Principal&amp;#34;: &amp;#34;*&amp;#34;,
&amp;#34;Action&amp;#34;: &amp;#34;s3:*&amp;#34;,
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:s3:::your-bucket-storage-name/*&amp;#34;,
&amp;#34;Condition&amp;#34;: {
&amp;#34;IpAddress&amp;#34;: {
&amp;#34;aws:SourceIp&amp;#34;: &amp;#34;10.0.0.0/8&amp;#34;
}
}
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;DenyIncorrectEncryptionHeader&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Deny&amp;#34;,
&amp;#34;Principal&amp;#34;: &amp;#34;*&amp;#34;,
&amp;#34;Action&amp;#34;: &amp;#34;s3:PutObject&amp;#34;,
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:s3:::your-bucket-storage-name/*&amp;#34;,
&amp;#34;Condition&amp;#34;: {
&amp;#34;StringNotEquals&amp;#34;: {
&amp;#34;s3:x-amz-server-side-encryption&amp;#34;: &amp;#34;AES256&amp;#34;
}
}
},
{
&amp;#34;Sid&amp;#34;: &amp;#34;DenyUnEncryptedObjectUploads&amp;#34;,
&amp;#34;Effect&amp;#34;: &amp;#34;Deny&amp;#34;,
&amp;#34;Principal&amp;#34;: &amp;#34;*&amp;#34;,
&amp;#34;Action&amp;#34;: &amp;#34;s3:PutObject&amp;#34;,
&amp;#34;Resource&amp;#34;: &amp;#34;arn:aws:s3:::your-bucket-name/*&amp;#34;,
&amp;#34;Condition&amp;#34;: {
&amp;#34;Null&amp;#34;: {
&amp;#34;s3:x-amz-server-side-encryption&amp;#34;: &amp;#34;true&amp;#34;
}
}
}
]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add this policy to your IAM user or role.&lt;/p&gt;</description></item><item><title>gcp create images</title><link>http://uly.me/posts/gcp-create-images/</link><pubDate>Sun, 12 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-images/</guid><description>&lt;p&gt;Here’s how to create a GCP Disk Image from a Boot Drive.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First, stop the instance.&lt;/li&gt;
&lt;li&gt;If you can’t, stop the applications/database from writing to disks.&lt;/li&gt;
&lt;li&gt;Run sudo sync .&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="create-from-disk"&gt;Create From Disk&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute images create the-new-image-name \
--source-disk the-source-boot-disk \
--source-disk-zone us-central1-a \
--family the-image-family \
[--force]
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="create-from-image"&gt;Create From Image&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute images create the-new-image-name \
--source-image the-source-image \
--source-image-project the-project-where-the-image-is-located \
--family the-image-family
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="create-from-snapshot"&gt;Create From Snapshot&lt;/h3&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute images create the-new-image-name \
--source-snapshot the-source-snapshot
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For more &lt;a href="https://cloud.google.com/compute/docs/images/create-delete-deprecate-private-images"&gt;info&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>calculating the ideal efs file size</title><link>http://uly.me/posts/calculating-the-ideal-efs-file-size/</link><pubDate>Thu, 09 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/calculating-the-ideal-efs-file-size/</guid><description>&lt;p&gt;AWS EFS runs on burst credits when choosing burst mode, which is about 99% of most implementations. The reason for this is that provisioned throughput is very expensive. It’s a $6000 per month commitment. In burst mode, if the EFS volume is too small with heavy IO usage, the burst credits will nose dive. You will eventually run out of burst credits resulting in very poor IO performance. It will be slower than a floppy disk drive. We all know how old that technology is. In order to sustain your burst credits, you’ll need to add data, because more data means you’ll earn burst credits at a higher clip. Here’s how to calculate the ideal file size for an EFS system.&lt;/p&gt;</description></item><item><title>gcp change vpc of instance</title><link>http://uly.me/posts/gcp-change-vpc-of-instance/</link><pubDate>Thu, 09 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-change-vpc-of-instance/</guid><description>&lt;p&gt;The following are steps on how to change the network of an instance from one VPC to another. This is assuming you want to keep the same server name, but will need to make a network change. Unfortunately, changing networks will require creating a new instance. The following are the steps to make that change.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Keep track of all the disks.&lt;/li&gt;
&lt;li&gt;Keep all disks including boot.&lt;/li&gt;
&lt;li&gt;Stop the instance.&lt;/li&gt;
&lt;li&gt;Create an image of the boot drive. Wait for it to complete.&lt;/li&gt;
&lt;li&gt;Create a similar instance, but do not execute.&lt;/li&gt;
&lt;li&gt;Make the network changes. Save the GCloud CLI command.&lt;/li&gt;
&lt;li&gt;Delete the instance.&lt;/li&gt;
&lt;li&gt;Run the saved command from step 4. This creates a new instance.&lt;/li&gt;
&lt;li&gt;Stop the instance.&lt;/li&gt;
&lt;li&gt;Detach the boot disk.&lt;/li&gt;
&lt;li&gt;Attach all the other disks.&lt;/li&gt;
&lt;li&gt;Boot the instance.&lt;/li&gt;
&lt;/ol&gt;</description></item><item><title>list files human readable</title><link>http://uly.me/posts/list-files-human-readable/</link><pubDate>Wed, 08 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/list-files-human-readable/</guid><description>&lt;p&gt;How to list files that’s human readable in GB.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ls -lrt --block-size=G
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;l = long format&lt;/li&gt;
&lt;li&gt;t = sort time/date&lt;/li&gt;
&lt;li&gt;r = reverse order&lt;/li&gt;
&lt;li&gt;–block-size=M (Mb) or G (Gb)&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>add nofail</title><link>http://uly.me/posts/add-nofail/</link><pubDate>Wed, 01 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-nofail/</guid><description>&lt;p&gt;The /etc/fstab file allow volumes to be automatically mounted on bootup. Add nofail in your automated mounts to prevent instances from hanging on boot. Nofail makes the instance to boot even if there are errors with the mounted volume.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;UUID=aebf131c-6957-451e-8d34-ec978d9581ae /data xfs defaults,nofail 0 2
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp create disk from snapshot</title><link>http://uly.me/posts/gcp-create-disk-from-snapshot/</link><pubDate>Wed, 01 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-create-disk-from-snapshot/</guid><description>&lt;p&gt;Here’s how to create a disk from a snapshot via Google SDK.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks create new-server-disk-2 \
--project=project-name \
--source-snapshot=server-disk-2 \
--zone=us-central1-b
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sssd on sles12</title><link>http://uly.me/posts/sssd-on-sles12/</link><pubDate>Wed, 01 May 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sssd-on-sles12/</guid><description>&lt;p&gt;A must see for anyone trying to use SSSD on SLES12 systems.&lt;/p&gt;
&lt;iframe width="720" height="420" src="https://www.youtube.com/embed/z9ZBWMoZw-E?feature=oembed"&gt;&lt;/iframe&gt;
&lt;p&gt;A little bit lengthy, but worth every bit of your half hour.&lt;/p&gt;</description></item><item><title>xfs vs ext4 commands</title><link>http://uly.me/posts/xfs-vs-ext4-commands/</link><pubDate>Tue, 30 Apr 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/xfs-vs-ext4-commands/</guid><description>&lt;p&gt;File system command differences between ext3 and xfs.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;ext4&lt;/th&gt;
&lt;th&gt;xfs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Creating a file system&lt;/td&gt;
&lt;td&gt;mkfs.ext4&lt;/td&gt;
&lt;td&gt;mkfs.xfs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mounting a file system&lt;/td&gt;
&lt;td&gt;mount&lt;/td&gt;
&lt;td&gt;mount&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Resizing a file system&lt;/td&gt;
&lt;td&gt;resize2fs&lt;/td&gt;
&lt;td&gt;xfs_growfs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Repairing a file system&lt;/td&gt;
&lt;td&gt;e2fsck&lt;/td&gt;
&lt;td&gt;xfs_repair&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Changing the label on a file system&lt;/td&gt;
&lt;td&gt;e2label&lt;/td&gt;
&lt;td&gt;xfs_admin -L&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reporting on disk space and file usage&lt;/td&gt;
&lt;td&gt;quota&lt;/td&gt;
&lt;td&gt;quota&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Debugging a file system&lt;/td&gt;
&lt;td&gt;debugfs&lt;/td&gt;
&lt;td&gt;xfs_db&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saving critical file system metadata to a file&lt;/td&gt;
&lt;td&gt;e2image&lt;/td&gt;
&lt;td&gt;xfs_metadump&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div style="clear:both"&gt;&lt;/div&gt;</description></item><item><title>online rtmp players</title><link>http://uly.me/posts/online-rtmp-players/</link><pubDate>Sat, 20 Apr 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/online-rtmp-players/</guid><description>&lt;p&gt;Here are several online RTMP players:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.wowza.com/resources/3.6.0/examples/LiveVideoStreaming/FlashRTMPPlayer/player.html"&gt;Wowza Flash Player&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.wowza.com/testplayers"&gt;Wowza Test Player&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hlstester.com/"&gt;HLSTester&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hlsplayer.net/rtmp-player"&gt;HLSPlayer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I prefer the Wowza test players. The last two has annoying ads.&lt;/p&gt;</description></item><item><title>encrypt volume via terraform</title><link>http://uly.me/posts/encrypt-volume-via-terraform/</link><pubDate>Tue, 09 Apr 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/encrypt-volume-via-terraform/</guid><description>&lt;p&gt;Here’s the Terraform script to encrypt an unencrypted volume. It creates a snapshot, encrypts a snapshot, and encrypts the volume.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#
# Set Variables
#
variable &amp;#34;volume&amp;#34; {
description = &amp;#34;The Volume to encrypt: vol-12345678901234567&amp;#34;
}
variable &amp;#34;region&amp;#34; {
description = &amp;#34;The Region: us-east-2&amp;#34;
}
variable &amp;#34;az&amp;#34; {
description = &amp;#34;The AZ: us-east-2a&amp;#34;
}
#
# Set Credentials
#
provider &amp;#34;aws&amp;#34; {
access_key = &amp;#34;put-your-access-key-here&amp;#34;
secret_key = &amp;#34;put-your-secret-key-here&amp;#34;
region = &amp;#34;${var.region}&amp;#34;
}
/*
#
# Create Unencrypted Volume
#
resource &amp;#34;aws_ebs_volume&amp;#34; &amp;#34;unencrypted_volume&amp;#34; {
availability_zone = &amp;#34;${var.az}&amp;#34;
size = 10
tags = {
Name = &amp;#34;Unencrypted_Volume&amp;#34;
}
}
*/
#
# Create Unencrypted Snapshot
#
resource &amp;#34;aws_ebs_snapshot&amp;#34; &amp;#34;unencrypted_snapshot&amp;#34; {
#volume_id = &amp;#34;${aws_ebs_volume.unencrypted_volume.id}&amp;#34;
volume_id = &amp;#34;${var.volume}&amp;#34;
tags = {
Name = &amp;#34;Unencrypted_Snapshot&amp;#34;
}
}
#
# Create Encrypted Snapshot
#
resource &amp;#34;aws_ebs_snapshot_copy&amp;#34; &amp;#34;encrypted_snapshot&amp;#34; {
source_snapshot_id = &amp;#34;${aws_ebs_snapshot.unencrypted_snapshot.id}&amp;#34;
source_region = &amp;#34;${var.region}&amp;#34;
encrypted = true
tags = {
Name = &amp;#34;Encrypted_Snapshot&amp;#34;
}
}
#
# Created Encrypted Volume
#
resource &amp;#34;aws_ebs_volume&amp;#34; &amp;#34;encrypted_volume&amp;#34; {
availability_zone = &amp;#34;${var.az}&amp;#34;
snapshot_id = &amp;#34;${aws_ebs_snapshot_copy.encrypted_snapshot.id}&amp;#34;
tags = {
Name = &amp;#34;Encrypted_Volume&amp;#34;
}
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>terraform installation</title><link>http://uly.me/posts/terraform-installation/</link><pubDate>Tue, 09 Apr 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform-installation/</guid><description>&lt;p&gt;Where did I install Terraform?&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /usr/local/bin/
terraform --version
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sudoers directory</title><link>http://uly.me/posts/sudoers-directory/</link><pubDate>Mon, 08 Apr 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sudoers-directory/</guid><description>&lt;p&gt;What’s in the /etc/sudoers.d/ directory? It’s a group of files with the following format as displayed in the code below. In the example, the file allows a Linux group or an AD group to assume the role of root, via the sudo command. As long as the group uses the correct format, and is located inside the /etc/sudoers.d/ directory, that group will have access to root.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;%groupname ALL=(ALL) NOPASSWD: ALL
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>convert pfx to pem format</title><link>http://uly.me/posts/convert-pfx-to-pem-format/</link><pubDate>Wed, 03 Apr 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-pfx-to-pem-format/</guid><description>&lt;p&gt;SSL certificates comes in multiple formats. Some providers will hand you over certificates in PFX format which comes in a single file. If you need to import it to AWS Certificate Manager, you will need to convert it from PFX to PEM format. The following set of commands uses OpenSSL and pkcs12 to convert a SSL certificate from PFX to PEM format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;openssl pkcs12 -in cert.pfx -nocerts -out key.pem
openssl rsa -in key.pem -out server.key
openssl pkcs12 -in cert.pfx -clcerts -nokeys -out cert.pem
openssl pkcs12 -in cert.pfx -nodes -nokeys -out chain.pem
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It result in 3 files.&lt;/p&gt;</description></item><item><title>who is logged in?</title><link>http://uly.me/posts/whos-logged-in/</link><pubDate>Wed, 03 Apr 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/whos-logged-in/</guid><description>&lt;p&gt;Find out who is logged in to the system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ w
$ who
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>find the biggest file</title><link>http://uly.me/posts/find-the-biggest-file/</link><pubDate>Mon, 01 Apr 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/find-the-biggest-file/</guid><description>&lt;p&gt;Find the biggest files in the current directory. Sort by from large to small. Display only the top 20. Display in human readable format.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;find -type f -exec du -Sh {} + | sort -rh | head -n 20
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>statsmaker</title><link>http://uly.me/posts/statsmaker/</link><pubDate>Tue, 26 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/statsmaker/</guid><description>&lt;p&gt;A couple of personal statistics scripts.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# create stats. can be run from cron.
/var/www/statsmaker/create.sh
# fix. must supply date.
/var/www/statsmaker/fix.sh 190201
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wp_query reverse sort</title><link>http://uly.me/posts/wp_query-reverse-sort/</link><pubDate>Mon, 25 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wp_query-reverse-sort/</guid><description>&lt;p&gt;Here’s how to reverse sort WP_Query. Order by ID. Reverse sort by ASC intead of DESC.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; $args = array (
&amp;#39;cat&amp;#39; =&amp;gt; 8,
&amp;#39;year&amp;#39; =&amp;gt; $year,
&amp;#39;orderby&amp;#39; =&amp;gt; &amp;#39;ID&amp;#39;,
&amp;#39;order&amp;#39; =&amp;gt; &amp;#39;ASC&amp;#39;,
&amp;#39;posts_per_page&amp;#39; =&amp;gt; -1,
&amp;#39;paged&amp;#39; =&amp;gt; $paged,
&amp;#39;s&amp;#39; =&amp;gt; $searchterm
);
$category_posts = new WP_Query($args);
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>create group with id</title><link>http://uly.me/posts/create-group-with-id/</link><pubDate>Fri, 22 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-group-with-id/</guid><description>&lt;p&gt;Here’s how to create a Linux group with a specific ID. Group name is nginx in this example. ID is 1000.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;groupadd nginx -g 1000
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>change vim colors</title><link>http://uly.me/posts/change-vim-colors/</link><pubDate>Wed, 20 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-vim-colors/</guid><description>&lt;p&gt;Vim is a text editor. Edit the ~.vimrc&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# vim ~.vimrc
colo desert
syntax on
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>a month ago</title><link>http://uly.me/posts/a-month-ago/</link><pubDate>Tue, 19 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/a-month-ago/</guid><description>&lt;p&gt;How to get last month’s value. Useful with Bash scripts.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;LASTMONTH = $(date +%Y%m -d &amp;#39;1 month ago&amp;#39;)
echo $LASTMONTH
# Output is ...
201902
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>parsing wowza logs</title><link>http://uly.me/posts/parsing-wowza-logs/</link><pubDate>Tue, 19 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/parsing-wowza-logs/</guid><description>&lt;p&gt;I’ve been wanting to look at Wowza logs for a very long time. I just spent a couple of hours writing a Bash script that generates a stats report. It parses the Wowza log file for the IP addresses, and runs them and against a site called ipinfo.io to get the viewer’s geo location. The output is filtered, sorted, takes a count, and finally generates a webpage. Here’s the Bash script.&lt;/p&gt;</description></item><item><title>codeigniter 2.1.3 on php7</title><link>http://uly.me/posts/codeigniter-2-1-3-on-php7/</link><pubDate>Mon, 18 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/codeigniter-2-1-3-on-php7/</guid><description>&lt;p&gt;If you’re still running older versions of CodeIgniter, here are a couple of tips to make it work with PHP7.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Make sure to install all PHP tools and libraries that comes with PHP7. I was missing curl.&lt;/li&gt;
&lt;li&gt;Change your database driver from mysql to mysqli (application/config/config.php).&lt;/li&gt;
&lt;li&gt;Fix the /system/core/Common.php &lt;a href="https://stackoverflow.com/questions/28348879/only-variable-references-should-be-returned-by-reference-codeigniter#28348880"&gt;error&lt;/a&gt; or as some prefer, upgrade to a newer version.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Considering v2.1.3 is very old (currently 3.1.10) , I’m surprised it works with PHP7 with just a few modifications.&lt;/p&gt;</description></item><item><title>list of encrypted volumes</title><link>http://uly.me/posts/list-of-encrypted-volumes/</link><pubDate>Mon, 18 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/list-of-encrypted-volumes/</guid><description>&lt;p&gt;Here’s the AWS CLI to get a list of encrypted or unencrypted volumes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# list of encrypted volumes
aws ec2 describe-volumes \
--filters Name=encrypted,Values=true \
--region us-east-1 --profile default \
--query &amp;#34;Volumes[*].{ID:VolumeId}&amp;#34; --output text
# list of unencrypted volumes
aws ec2 describe-volumes \
--filters Name=encrypted,Values=false \
--region us-east-1 --profile default \
--query &amp;#34;Volumes[*].{ID:VolumeId}&amp;#34; --output text
# count the list of encrypted volumes. use wc -l to get a count.
aws ec2 describe-volumes \
--filters Name=encrypted,Values=true \
--region us-east-1 --profile default \
--query &amp;#34;Volumes[*].{ID:VolumeId}&amp;#34; --output text | wc -l
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>steps to encrypt volumes</title><link>http://uly.me/posts/steps-to-encrypt-volumes/</link><pubDate>Mon, 18 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/steps-to-encrypt-volumes/</guid><description>&lt;p&gt;Here the steps to encrypt an unencrypted volume.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Take a snapshot of the unencrypted volume.&lt;/li&gt;
&lt;li&gt;Make a copy of that snapshot and turn on encryption.&lt;/li&gt;
&lt;li&gt;Create a volume of the encrypted snapshot.&lt;/li&gt;
&lt;li&gt;Stop the instance.&lt;/li&gt;
&lt;li&gt;Detach the original unencrypted volume from the instance.&lt;/li&gt;
&lt;li&gt;Attach the newly created encrypted volume to the instance.&lt;/li&gt;
&lt;li&gt;Start the instance.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;AWS CLI&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# CREATE A SNAPSHOT
aws ec2 create-snapshot \
--volume-id vol-1234567890abcdef0 \
--description &amp;#34;This is my snapshot&amp;#34;
# COPY SNAPSHOT
aws ec2 copy-snapshot \
--source-region us-west-2 --source-snapshot-id snap-066877671789bd71b \
--region us-east-1 --description &amp;#34;This is my copied snapshot.&amp;#34;
# CREATE A VOLUME
aws ec2 create-volume \
--region us-east-1 --availability-zone us-east-1a \
--snapshot-id snap-066877671789bd71b --volume-type io1 --iops 1000
# STOP AN INSTANCE
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
# DETACH A VOLUME
aws ec2 detach-volume --volume-id vol-1234567890abcdef0
# ATTACH A VOLUME
aws ec2 attach-volume --volume-id vol-1234567890abcdef0 \
--instance-id i-01474ef662b89480 --device /dev/sdf
# START AN INSTANCE
aws ec2 start-instances --instance-ids i-1234567890abcdef0
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp instance scopes</title><link>http://uly.me/posts/gcp-instance-scopes/</link><pubDate>Fri, 15 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-instance-scopes/</guid><description>&lt;p&gt;Give Instances access to other cloud services using scopes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud alpha compute instances set-scopes instance-name \
--project project-name --zone us-central1-a \
--scopes=cloud-platform,cloud-source-repos,compute-rw,storage-rw
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>lvm extend physical volume</title><link>http://uly.me/posts/lvm-extend-physical-volume/</link><pubDate>Thu, 14 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lvm-extend-physical-volume/</guid><description>&lt;p&gt;The following are instructions on how to extend a disk volume with LVM.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# aws cli extend volume
aws ec2 modify-volume --region us-east-1 \
--volume-id vol-xxxxxxxxxxxx --size 15 \
--volume-type gp2
# check volumes before
lsblk
# extend via growpart
growpart /dev/xvdf 1
# check volumes after
lsblk
# resize physical volume
pvresize /dev/xvdf1
# check physical volume
pvscan
# extend logical volume
lvresize -l +100%FREE /dev/data/data
# check logical volume
lvscan
# check mounts
df -Th
# resize file system
resize2fs /dev/data/data
# or
xfs_growfs /dev/mapper/root
xfs_growfs /dev/xvda1
# check mounts again for new size
df -Th
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>list big files</title><link>http://uly.me/posts/list-big-files/</link><pubDate>Wed, 13 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/list-big-files/</guid><description>&lt;p&gt;Find out which files or directories are using up disk resources.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# display the biggest files
find -type f -exec du -Sh {} + | sort -rh | head -n 5
# display the biggest directories
du -Sh | sort -rh | head -5
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp cli create firewall</title><link>http://uly.me/posts/gcp-cli-create-firewall/</link><pubDate>Tue, 12 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-cli-create-firewall/</guid><description>&lt;p&gt;Here’s how to add a firewall rule in Google Cloud Platform CLI&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules create &amp;#34;firewall-name&amp;#34; \
--description=&amp;#34;firewall-description&amp;#34; \
--priority &amp;#34;1000&amp;#34; \
--direction INGRESS \
--action allow \
--network &amp;#34;network-name&amp;#34; \
--target-service-accounts=&amp;#34;service@account.net&amp;#34; \
--source-ranges=&amp;#34;10.0.0.0/8&amp;#34; \
--rules tcp:9001
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Describe firewall rule.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules describe firewall-name
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Delete firewall rule.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute firewall-rules delete firewall-name
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>gcp cli start stop instances</title><link>http://uly.me/posts/gcp-cli-start-stop-instances/</link><pubDate>Tue, 12 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-cli-start-stop-instances/</guid><description>&lt;p&gt;Here’s the CLI commands to start and stop Google Cloud instances.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute instances start server-name --zone=us-central1-c
gcloud compute instances stop server-name --zone=us-central1-c
gcloud compute instances reset server-name --zone=us-central1-c
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>local rpm install</title><link>http://uly.me/posts/local-rpm-install/</link><pubDate>Mon, 11 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/local-rpm-install/</guid><description>&lt;p&gt;Steps for creating a local RPM package installation.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# download plugin
yum install yum-plugin-downloadonly
# download package and dependencies
yum install --downloadonly reiserfs
# download package and dependencies to a specific directory
yum install --downloadonly --downloaddir=/home/ec2-user package
# download multiple packages
yum install --downloadonly --downloaddir=/root/mypackages/ package1 package2
# finally install package
rpm -ivh -r /home/ec2-user package.rpm
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>run sql in bash</title><link>http://uly.me/posts/run-sql-in-bash/</link><pubDate>Sun, 10 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-sql-in-bash/</guid><description>&lt;p&gt;Here’s an example on how to run MySQL commands from Bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql dbname -e &amp;#34;UPDATE wp_options SET option_value=&amp;#39;http://domain.com&amp;#39; WHERE option_name=&amp;#39;home&amp;#39;&amp;#34;;
mysql dbname -e &amp;#34;UPDATE wp_options SET option_value=&amp;#39;http://domain.com&amp;#39; WHERE option_name=&amp;#39;siteurl&amp;#39;&amp;#34;;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The example updates WordPress’ home and siteurl. Script contains no password. It’s using .my.cnf config file.&lt;/p&gt;</description></item><item><title>adding a xfs volume</title><link>http://uly.me/posts/adding-a-xfs-volume/</link><pubDate>Thu, 07 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/adding-a-xfs-volume/</guid><description>&lt;p&gt;Add a disk volume via cloud console. Then perform the following commands:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# check the new block
lsblk
# format
fdisk /dev/sdc
# create file system
mkfs.xfs -f /dev/sdc1
# get uuid
blkid /dev/sdc1
# vi /etc/fstab
UUID=&amp;#34;xxxxxxxxxxxxxxxxxxxxx&amp;#34; /mnt/directory xfs defaults 0 0
# mount
mount -a
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>lastlog</title><link>http://uly.me/posts/lastlog/</link><pubDate>Wed, 06 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lastlog/</guid><description>&lt;p&gt;Lastlog displays the latest login information of all users in the system. You can’t view the lastlog file since it’s not an ascii file. You’ll need to run the actual command to view what’s in it. The program will spit out a list that may be longer than your terminal buffer. In that case, it’s best to pipe the output to “more” or better yet, use the “grep” command to isolate the user.&lt;/p&gt;</description></item><item><title>print block device attributes</title><link>http://uly.me/posts/print-block-device-attributes/</link><pubDate>Tue, 05 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/print-block-device-attributes/</guid><description>&lt;p&gt;Everything you need to know about block devices, e.g. UUID&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;blkid
# or
blkid /dev/xvda
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also run file -s. You need to be root.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;file -s /dev/xvda1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>checking last patch</title><link>http://uly.me/posts/checking-last-patch/</link><pubDate>Fri, 01 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/checking-last-patch/</guid><description>&lt;p&gt;You can check when the system was last patch using the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# check RPM when the last updates were ran.
rpm -qa --last | grep kernel
# this is a bit of a stretch, but typically a reboot is performed after an upgrade.
uptime
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>scan for error, warning and panic</title><link>http://uly.me/posts/scan-for-error-warning-and-panic/</link><pubDate>Fri, 01 Mar 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/scan-for-error-warning-and-panic/</guid><description>&lt;p&gt;Here’s a command to scan for any errors, warnings and panics on the system. If the file is too large, pipe it to more.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo grep -E -i -r &amp;#39;error|warning|panic&amp;#39; /var/log
sudo grep -E -i -r &amp;#39;error|warning|panic&amp;#39; /var/log &amp;gt;error-warning-panic.log
cat error-warning-panic.log | more
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>macos custom launchpad</title><link>http://uly.me/posts/macos-custom-launchpad/</link><pubDate>Thu, 28 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/macos-custom-launchpad/</guid><description>&lt;p&gt;Are the icons too big in MacOS Launchpad? You can customize them. Here are the commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# change the launchpad icon size by changing the columns and rows
defaults write com.apple.dock springboard-columns -int 10
defaults write com.apple.dock springboard-rows -int 10
killall Dock
# reset the launchpd
defaults write com.apple.dock ResetLaunchPad -bool TRUE
killall Dock
# reset to defaults
defaults delete com.apple.dock springboard-columns
defaults delete com.apple.dock springboard-rows
killall Dock
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>styling the bash prompt</title><link>http://uly.me/posts/styling-the-bash-prompt/</link><pubDate>Tue, 26 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/styling-the-bash-prompt/</guid><description>&lt;p&gt;Great &lt;a href="https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html"&gt;article&lt;/a&gt; how to style your Bash prompt. Make sure you are using Bash shell, because you could be using another shell. Use this to display your current shell. Just type “bash” to start using Bash shell.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo $0
bash
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I use the prompt style below. See the result underneath PS1. You may have to exit and re-enter your Terminal to see results.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;PS1=&amp;#34;\u@\h:\w: &amp;#34;
ulysses@localhost:/var/www:
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli efs describe file systems</title><link>http://uly.me/posts/aws-cli-efs-describe-file-systems/</link><pubDate>Sun, 24 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-efs-describe-file-systems/</guid><description>&lt;p&gt;Show a list of EFS file systems within a region.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws efs describe-file-systems \
--region us-east-1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Filter by Name and FileSystemId.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws efs describe-file-systems \
--query &amp;#39;FileSystems[*].[Name,FileSystemId]&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws cli efs describe tags</title><link>http://uly.me/posts/aws-cli-efs-describe-tags/</link><pubDate>Sun, 24 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-efs-describe-tags/</guid><description>&lt;p&gt;How to display tags of EFS file system.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws efs describe-tags \
--file-system-id fs-xxxxxxxx \
--query &amp;#39;Tags[?Key==`tagname`].{Name:Key,Value:Value}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>reiserfsck rebuild tree</title><link>http://uly.me/posts/reiserfsck-rebuild-tree/</link><pubDate>Sun, 24 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/reiserfsck-rebuild-tree/</guid><description>&lt;p&gt;Rebuild tree with Reiserfsck&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;reiserfsck --rebuild-tree /dev/sda1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>rpm check packages</title><link>http://uly.me/posts/rpm-check-packages/</link><pubDate>Wed, 20 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/rpm-check-packages/</guid><description>&lt;p&gt;How to check RPM if packages are installed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -qa --last
rpm -qa --last | more
rpm -qa --last | grep &amp;#34;package name&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>remmina install</title><link>http://uly.me/posts/remmina-install/</link><pubDate>Tue, 19 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remmina-install/</guid><description>&lt;p&gt;Remmina is the RDP (remote desktop software) for Windows server on Linux. Here’s how to install.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo add-apt-repository ppa:remmina-ppa-team/remmina-next
sudo apt-get update
sudo apt-get install remmina remmina-plugin-* libfreerdp-plugins-standard
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you don’t see the RDP option, kill the process and restart Remmina.&lt;/p&gt;</description></item><item><title>yum remove repo</title><link>http://uly.me/posts/yum-remove-repo/</link><pubDate>Tue, 19 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yum-remove-repo/</guid><description>&lt;p&gt;How to remove repos in Yum. Just delete the repo file in /etc/yum.repos.d.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rm /etc/yum.repos.d/repo-name.repo
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>reiserfs</title><link>http://uly.me/posts/reiserfs/</link><pubDate>Mon, 18 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/reiserfs/</guid><description>&lt;p&gt;Install ReiserFS&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum update
yum install kmod-reiserfs kmod-reiserfs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Make a ReiserFS&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;fdisk /dev/xvdf
n, p, 1
[return]
[return]
mkreiserfs /dev/xvdf1
mount -t reiserfs /dev/xvdf1 /data
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Other Reiserfs commands&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;reiserfsck /dev/xvdf1
resize_reiserfs /dev/xvdf1
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>weather report from the terminal</title><link>http://uly.me/posts/weather-report-from-the-terminal/</link><pubDate>Sun, 17 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/weather-report-from-the-terminal/</guid><description>&lt;p&gt;Get the weather report right from your terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;curl wttr.in
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the output.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/02/weather.png"&gt;&lt;/p&gt;</description></item><item><title>linux mint windows and workspaces</title><link>http://uly.me/posts/linux-mint-windows-and-workspaces/</link><pubDate>Sun, 10 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-mint-windows-and-workspaces/</guid><description>&lt;p&gt;Here’s the shortcut key combination for managing windows and workspaces in Linux Mint 18.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Press the “Ctrl + Alt + Down” keys to display all open windows.&lt;/li&gt;
&lt;li&gt;Press the “Ctrl + Alt + Up” keys to display all workspaces.&lt;/li&gt;
&lt;li&gt;Press the “Ctrl + Alt + Left or Right” keys to move between workspaces.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Very useful.&lt;/p&gt;</description></item><item><title>run docker without sudo</title><link>http://uly.me/posts/run-docker-without-sudo/</link><pubDate>Sun, 10 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-docker-without-sudo/</guid><description>&lt;p&gt;Run Docker without sudo. Add user to docker group. Login as docker using newgrp.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo gpasswd -a $user docker
newgrp docker
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can now run the following commands without sudo.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;docker ps
docker images
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Every time you open a new terminal , just run.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;newgrp docker
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>storing git credentials</title><link>http://uly.me/posts/storing-git-credentials/</link><pubDate>Sat, 09 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/storing-git-credentials/</guid><description>&lt;p&gt;There are two ways to store git credentials. One is temporary and the other permanent. You can store your git credentials unencrypted on disk forever or in cache memory temporarily.&lt;/p&gt;
&lt;p&gt;Temporary. Store for 15 minutes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git config credential.helper &amp;#39;cache --timeout=900&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Permanent.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git config credential.helper store
git push http://example.com/repo.git
Username: &amp;lt;type username=&amp;#34;&amp;#34; your=&amp;#34;&amp;#34;&amp;gt;
Password: &amp;lt;type password=&amp;#34;&amp;#34; your=&amp;#34;&amp;#34;&amp;gt;
&amp;lt;/type&amp;gt;&amp;lt;/type&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Next time you use git, you will not be prompted for a password.&lt;/p&gt;</description></item><item><title>run bash script in gitbash</title><link>http://uly.me/posts/run-bash-script-in-gitbash/</link><pubDate>Fri, 08 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-bash-script-in-gitbash/</guid><description>&lt;p&gt;Unfortunately, you can’t run Bash scripts in GitBash the normal way. Here’s the workaround. You have to use sh script.sh&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Normal use
./script.sh
# Running it in GitBash
sh script.sh
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>check memory in linux</title><link>http://uly.me/posts/check-memory-in-linux/</link><pubDate>Wed, 06 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-memory-in-linux/</guid><description>&lt;p&gt;Here are several commands to check memory in Linux.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;free -m
cat /proc/meminfo
vmstat -s
top
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>extend linux boot</title><link>http://uly.me/posts/extend-linux-boot/</link><pubDate>Wed, 06 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/extend-linux-boot/</guid><description>&lt;p&gt;The following commands will extend Linux Boot drive without a reboot.&lt;/p&gt;
&lt;p&gt;List block devices. Check disk sizes.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;lsblk
df -h
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Determine file system type: xfs, ext2, ext3 or ext4.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;file -s /dev/xvda1
# or
df -Th
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Extend volume from the console or command line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 modify-volume --region us-east-1 \
--volume-id vol-xxxxxxxxxxxx --size 10 \
--volume-type gp2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Resize Linux partition.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# for /dev/xvda1
growpart /dev/xvda 1
# for /dev/xvda2
growpart /dev/xvda 2
# for ext2, ext3, ext4
resize2fs /dev/xvda1
# for xfs
xfs_growfs /dev/mapper/root
xfs_growfs /dev/xvda1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Check if new file size is being displayed.&lt;/p&gt;</description></item><item><title>aws quarterly report</title><link>http://uly.me/posts/aws-quarterly-report/</link><pubDate>Mon, 04 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-quarterly-report/</guid><description>&lt;p&gt;AWS made more money than McDonalds and Qualcomm in 2018. And that’s not counting the retail business Amazon.com. For this fourth quarter, Amazon reported $7.43 billion in revenue from its cloud-computing business, up 45.3% from the same period a year earlier. For the full 2018 year, AWS brought in $25.7 billion, a 47% jump on the 2017 year.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/02/aws.jpg"&gt;&lt;/p&gt;</description></item><item><title>create a dummy file</title><link>http://uly.me/posts/create-a-dummy-file/</link><pubDate>Mon, 04 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-a-dummy-file/</guid><description>&lt;p&gt;Here’s the command to create a dummy file in Linux. This creates a 1GB or a 2GB file. Adjust the count to achieve the file size.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# 1GB
dd if=/dev/zero of=/path/to/dummyfile bs=1M count=1024
# 2GB
dd if=/dev/zero of=/path/to/dummyfile bs=1M count=2048
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>empty buffer or cache</title><link>http://uly.me/posts/empty-buffer-or-cache/</link><pubDate>Fri, 01 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/empty-buffer-or-cache/</guid><description>&lt;p&gt;Here’s the command to empty or clear Linux’s buffer or cache. Run it as root.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;free &amp;amp;&amp;amp; sync &amp;amp;&amp;amp; echo 3 &amp;gt; /proc/sys/vm/drop_caches &amp;amp;&amp;amp; free
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>mount and unmount efs</title><link>http://uly.me/posts/mount-and-unmount-efs/</link><pubDate>Fri, 01 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mount-and-unmount-efs/</guid><description>&lt;p&gt;Here’s the command to mount and unmount AWS EFS. Assuming the EFS IP address is 10.0.0.23.&lt;/p&gt;
&lt;p&gt;Mount:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport 10.0.0.23:/ /efs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Umount:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# lazy unmount
umount -l /efs
# force unmount
umount -f /efs
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You may have to force it if it’s busy.&lt;/p&gt;</description></item><item><title>when linux was last patched</title><link>http://uly.me/posts/when-linux-was-last-patched/</link><pubDate>Fri, 01 Feb 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/when-linux-was-last-patched/</guid><description>&lt;p&gt;Here’s a handy command to see if Linux was patched recently.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;rpm -qa --last | head
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A typical result would look something like this.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;name-of-patch Sun 20 Jan 2019 05:36:31 PM UTC
name-of-patch Fri 18 Jan 2019 02:52:51 PM UTC
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>xfs vs ext 2/3/4</title><link>http://uly.me/posts/xfs-vs-ext-2-3-4/</link><pubDate>Tue, 29 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/xfs-vs-ext-2-3-4/</guid><description>&lt;p&gt;When resizing disks, here are the commands for each respected file system.&lt;/p&gt;
&lt;p&gt;For xfs:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;xfs_growfs /dev/vgname/lgname
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For ext 2/3/4:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;resize2fs /dev/vgname/lgname
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>extend lvm volume</title><link>http://uly.me/posts/extend-lvm-volume/</link><pubDate>Mon, 28 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/extend-lvm-volume/</guid><description>&lt;p&gt;Extending a LVM logical volume can be tricky. Extending a physical volume especially a boot drive is even more challenging. To make things simple, you can just easily add a new physical disk to your physical volume group. Here are the steps:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# add disk to your instance.
fdisk /dev/sdh
pvcreate /dev/sdh1
vgextend system /dev/sdh1
lvextend -l +100%FREE /dev/system/opt
resize2fs /dev/system/opt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The fdisk command requires a few steps inside such as creating a new partition, changing the partition to type to “8e” which is Linux LVM, and then writing your changes to disk.&lt;/p&gt;</description></item><item><title>apps to install on linux mint</title><link>http://uly.me/posts/apps-to-install-on-linux-mint/</link><pubDate>Wed, 23 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/apps-to-install-on-linux-mint/</guid><description>&lt;p&gt;I recently started using Linux Mint again. Although it contains many excellent apps, there are a few things that are missing. So, here’s a list of programs that I have installed ✅ or will be installing on Linux Mint in the near future.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;✅ sublime text 3&lt;/li&gt;
&lt;li&gt;✅ lastpass&lt;/li&gt;
&lt;li&gt;✅ discord&lt;/li&gt;
&lt;li&gt;✅ aws cli&lt;/li&gt;
&lt;li&gt;✅ ffmpeg&lt;/li&gt;
&lt;li&gt;✅ handbrake&lt;/li&gt;
&lt;li&gt;✅ git&lt;/li&gt;
&lt;li&gt;✅ vim&lt;/li&gt;
&lt;li&gt;✅ emacs&lt;/li&gt;
&lt;li&gt;✅ tor&lt;/li&gt;
&lt;li&gt;✅ slack&lt;/li&gt;
&lt;li&gt;✅ docker&lt;/li&gt;
&lt;li&gt;virtualbox&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>samba 4 domain controller</title><link>http://uly.me/posts/samba-4-domain-controller/</link><pubDate>Wed, 23 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/samba-4-domain-controller/</guid><description>&lt;p&gt;Starting with version 4, &lt;a href="https://www.samba.org/samba/"&gt;Samba&lt;/a&gt; can now run as a domain controller. It can support Windows and Linux clients. You can compile it from source or install it via package managers such as rpm, yum and apt. You can always use it as a standard shared drive and even use it as a print server.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/01/samba.png"&gt;&lt;/p&gt;</description></item><item><title>gutenberg youtube embed</title><link>http://uly.me/posts/gutenberg-youtube-embed/</link><pubDate>Sun, 20 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gutenberg-youtube-embed/</guid><description>&lt;p&gt;The Gutenberg Youtube embed lacks a few things. The alignment doesn’t seem to be working, at least in the theme I’m using. I’m using Generate-Pro, a Genesis child theme. By default, it’s left-aligned. I have to add this div to make it centered.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;div style=&amp;#34;text-align:center&amp;#34;&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want right aligned, use this div.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;div style=&amp;#34;text-align:right&amp;#34;&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>solar-putty</title><link>http://uly.me/posts/solar-putty/</link><pubDate>Sun, 20 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/solar-putty/</guid><description>&lt;p&gt;Bring Putty to the next level. Thanks to Solarwinds.&lt;/p&gt;
&lt;iframe width="720" height="420" src="https://www.youtube.com/embed/2xsqsNHGU8E?feature=oembed" &gt;&lt;/iframe&gt;
&lt;p&gt;Solar-Putty&lt;/p&gt;</description></item><item><title>ssl certificates explained</title><link>http://uly.me/posts/ssl-certificates-explained/</link><pubDate>Sun, 20 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ssl-certificates-explained/</guid><description>&lt;p&gt;If you’re confused about the different formats and files that the Certificate Manager will accept in AWS, this &lt;a href="https://helpdesk.ssls.com/hc/en-us/articles/115001391705-How-to-install-a-SSL-certificate-on-AWS"&gt;site&lt;/a&gt; explains it fairly well. The Certificate Manager contains 3 fields during the import process. Certificate body, Certificate private key, and Certificate chain.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/01/cm.png"&gt;&lt;/p&gt;
&lt;p&gt;Server certificate &amp;gt; Intermediate certificate &amp;gt; Root certificate&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Private RSA Key&lt;/li&gt;
&lt;li&gt;Chain consists of Root and Intermediate&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>regex match</title><link>http://uly.me/posts/regex-match/</link><pubDate>Sat, 19 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/regex-match/</guid><description>&lt;p&gt;Regex is really cool. You can do amazing things with it, but if you’re starting new, it’s quite daunting task. If you ever find one that works, you better hang on to it for dear life. Here’s one that I know is working. It reads data from a file, and compares and matches a variable to a certain pattern. In the example below, the variable I’m searching for, must contain a string with the following characters “server-w.” They also must be followed by at least one number or a set of numbers.&lt;/p&gt;</description></item><item><title>aws backup</title><link>http://uly.me/posts/aws-backup/</link><pubDate>Wed, 16 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-backup/</guid><description>&lt;p&gt;AWS just introduced &lt;a href="https://aws.amazon.com/backup/"&gt;Backup&lt;/a&gt;, a new managed service for backing up AWS resources. You can now create backup policies of EC2, RDS, DynamoDB, and EFS systems. The default backup uses S3 buckets, but storage can be moved to Glacier or it can be expired. The backup service is initially available in Virginia, Ohio, Oregon and Ireland.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/01/aws-backup.png"&gt;&lt;/p&gt;
&lt;p&gt;AWS Backup&lt;/p&gt;</description></item><item><title>sublime text 3</title><link>http://uly.me/posts/sublime-text-3/</link><pubDate>Wed, 16 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sublime-text-3/</guid><description>&lt;p&gt;Looking for a text editor for editing code? Check out &lt;a href="https://www.sublimetext.com/"&gt;Sublime Text 3&lt;/a&gt;. You can install the text editor using several package managers depending on your Linux distro. There’s apt, yum, zypper, pacman and dnf. Here’s the Apt install of Sublime Text 3.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;echo &amp;#34;deb https://download.sublimetext.com/ apt/stable/&amp;#34; | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>virtualbox 6 in mint 19</title><link>http://uly.me/posts/virtualbox-6-in-mint-19/</link><pubDate>Wed, 16 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/virtualbox-6-in-mint-19/</guid><description>&lt;p&gt;If you like to try out different flavors of Linux as well as other distros, install them in a virtual environment like VirtualBox. In this way you avoid messing up your system since installation will be inside a container. VirtualBox can run in Windows, Mac and Linux. I’m currently running it on Linux Mint 19. If you are curious, the instructions are &lt;a href="https://www.osradar.com/install-virtualbox-6-ubuntu-18-04-linux-mint-19/"&gt;here&lt;/a&gt; to install VirtualBox 6 in Linux Mint 19.&lt;/p&gt;</description></item><item><title>check argument in bash</title><link>http://uly.me/posts/check-argument-in-bash/</link><pubDate>Tue, 15 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-argument-in-bash/</guid><description>&lt;p&gt;How to check for an argument in a script in Bash.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if [ -z &amp;#34;$1&amp;#34; ] ; then
echo &amp;#34;there are no arguments&amp;#34;
else
echo &amp;#34;there is an argument&amp;#34;
fi
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>reset locked out linux user</title><link>http://uly.me/posts/reset-locked-out-linux-user/</link><pubDate>Tue, 15 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/reset-locked-out-linux-user/</guid><description>&lt;p&gt;Perform this command to reset a Linux account that has been locked out due to multiple login failures. This involves resetting the pam_tally back down to zero. Some systems use pam_tally2. First, check what’s the current tally.&lt;/p&gt;
&lt;p&gt;Current tally:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pam_tally --user=username
pam_tally2 --user=username
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To reset:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pam_tally --user=username --reset
pam_tally2 --user=username --reset
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>etcher</title><link>http://uly.me/posts/etcher/</link><pubDate>Mon, 14 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/etcher/</guid><description>&lt;p&gt;Etcher allows you to safely and easily burn images to SD and USB drives. It has a simple interface, and and exclusively available on the Mac OS platform. Burning an image has never been easy. Just select an image (ISO), select a drive, and flash the image.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/01/etcher.png"&gt;&lt;/p&gt;
&lt;p&gt;Etcher interface&lt;/p&gt;</description></item><item><title>hostname</title><link>http://uly.me/posts/hostname/</link><pubDate>Mon, 14 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/hostname/</guid><description>&lt;p&gt;If you need to change your system’s hostname, use hostname or hostnamectl commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;hostname servername
hostnamectl set-hostname servername
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can add the hostname to these 2 files and reboot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vi /etc/hostname
vi /etc/hosts
reboot
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Without a reboot. Add the hostname to these 2 files.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vi /etc/hostname
vi /etc/hosts
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And add a hostname entry to 127.0.0.1 in /etc/hosts.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;127.0.0.1 servername
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That’s all she wrote.&lt;/p&gt;</description></item><item><title>linux mint 19.1</title><link>http://uly.me/posts/linux-mint-19-1/</link><pubDate>Mon, 14 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linux-mint-19-1/</guid><description>&lt;p&gt;Just got done installing &lt;a href="http://linuxmint.com"&gt;Linux Mint&lt;/a&gt; 19.1 Tessa Cinnamon edition. It’s a long-term support release with support until 2023. Here are some of the new &lt;a href="https://www.linuxmint.com/rel_tessa_cinnamon_whatsnew.php"&gt;features&lt;/a&gt;. I use Etcher on the Mac to write to the USB. I then booted via USB to install Linux Mint on the new machine. Linux Mint was done installing in less than 10 minutes. I went with Cinnamon since it was a darker theme.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2019/01/linuxmint.png"&gt;&lt;/p&gt;
&lt;p&gt;Linux Mint 19 Cinnamon&lt;/p&gt;</description></item><item><title>windows 10 activation</title><link>http://uly.me/posts/windows-10-activation/</link><pubDate>Mon, 14 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/windows-10-activation/</guid><description>&lt;p&gt;I recently upgraded my system which involved a new motherboard. I brought over the old hard drive from my previous machine to the new one. I booted it. Bang! And just like that Microsoft deactivated my account. I called them. They said they have no record of it based on the email addresses that I’ve provided.&lt;/p&gt;
&lt;p&gt;I told them that I’ve upgraded from Windows 7 to Windows 10 a few years back. Microsoft proceeded to tell me that I needed to provide them my Windows 7 product key. Now, I have to look for it. I have no idea where it is. If I can’t find it. I won’t be able to activate it. I’m sure I’m not the only who got screwed for upgrading their hardware.&lt;/p&gt;</description></item><item><title>adding to crontab in bash</title><link>http://uly.me/posts/adding-to-crontab-in-bash/</link><pubDate>Thu, 10 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/adding-to-crontab-in-bash/</guid><description>&lt;p&gt;Here’s a neat command to append a job to a crontab within a Bash script.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;crontab -l | { cat; echo &amp;#34;0 1 * * * /dir/script.sh &amp;gt; /logs/script.cronlog 2&amp;gt;&amp;amp;1&amp;#34;; } | crontab -
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To validate, perform crontab -l to see if your changes are there.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;crontab -l
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>cloud filestore</title><link>http://uly.me/posts/cloud-filestore/</link><pubDate>Thu, 10 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cloud-filestore/</guid><description>&lt;p&gt;Cloud Filestore is a managed file service by Google Cloud. It’s a shared file system similar to Amazon’s Elastic File System offering. Users of Cloud Filestore will experience something similar to when using a NAS drive (network attached storage). Filestore is used for both Compute and Kubernetes Engine instances. Unlike EFS where storage is unlimited, you have to specify a storage size when creating a new Filestore.&lt;/p&gt;
&lt;p&gt;Create a Filestore:&lt;/p&gt;</description></item><item><title>new pc</title><link>http://uly.me/posts/new-pc/</link><pubDate>Wed, 09 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/new-pc/</guid><description>&lt;p&gt;Just ordered parts for a new system.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CPU: AMD – Ryzen 7 1700X 3.4 GHz 8-Core Processor&lt;/li&gt;
&lt;li&gt;Cooler: Cooler Master – ML240L RGB 66.7 CFM Liquid CPU Cooler&lt;/li&gt;
&lt;li&gt;Motherboard: Asus – STRIX B350-F GAMING ATX AM4 Motherboard&lt;/li&gt;
&lt;li&gt;Memory: G.Skill – Trident Z RGB 16 GB (2 x 8 GB) DDR4-3000 Memory&lt;/li&gt;
&lt;li&gt;Storage: ADATA – Ultimate SU800 256 GB 2.5″ Solid State Drive&lt;/li&gt;
&lt;li&gt;Case: FSP Group – CMT520 ATX Mid Tower Case&lt;/li&gt;
&lt;li&gt;Power Supply: Rosewill – 600 W 80+ Semi-Modular ATX Power Supply&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;PCPartPicker: &lt;a href="https://pcpartpicker.com/list/jCBF9J"&gt;parts list&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>upgrade firefox in linux mint</title><link>http://uly.me/posts/upgrade-firefox-in-linux-mint/</link><pubDate>Wed, 09 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/upgrade-firefox-in-linux-mint/</guid><description>&lt;p&gt;I fired up my old Linux PC which runs on Linux Mint. I noticed the default Firefox browser is quite old. It needs an upgrade, which is expected since this Linux Mint version is 18.1. The current version is 19.1. So, here are the steps to upgrade Firefox in Linux Mint.&lt;/p&gt;
&lt;p&gt;Download Firefox.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;wget https://www.mozilla.org/en-US/firefox/download/thanks/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Extract.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd ~/Downloads/
tar xjf firefox-64.0.2.tar.bz2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Move Firefox.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mv firefox /opt/firefox
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a symbolic link.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ln -s /opt/firefox/firefox /usr/bin/firefox
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The old icons should still work. Enjoy.&lt;/p&gt;</description></item><item><title>vi display line numbers</title><link>http://uly.me/posts/vi-display-line-numbers/</link><pubDate>Wed, 09 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/vi-display-line-numbers/</guid><description>&lt;p&gt;If you work with the vi or vim editors in Linux, sometimes it’s nice to be able to see the line numbers display on the editor.&lt;/p&gt;
&lt;p&gt;Turn it on.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim filename
:set number
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Turn it off.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;vim filename
:set nonumber
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>windows + tab</title><link>http://uly.me/posts/windows-tab/</link><pubDate>Wed, 09 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/windows-tab/</guid><description>&lt;p&gt;Better late than never. How to display all open windows in Windows. Just press the Windows key + Tab.&lt;/p&gt;</description></item><item><title>resolv.conf</title><link>http://uly.me/posts/resolv-conf/</link><pubDate>Mon, 07 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/resolv-conf/</guid><description>&lt;p&gt;Resolv.conf is a computer file used by various operating systems as a DNS resolver. The file is in plain text. It’s usually generated by the system administrator or a network program. The file is located in the /etc/ directory and contains the search domain as well a list of nameservers.&lt;/p&gt;
&lt;p&gt;Here’s an example of the /etc/resolv.conf file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;search domain.com local.lan
nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 9.9.9.9
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you have problems resolving domain names, check this file first.&lt;/p&gt;</description></item><item><title>certificate management import</title><link>http://uly.me/posts/certificate-management-import/</link><pubDate>Fri, 04 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/certificate-management-import/</guid><description>&lt;p&gt;My previous post lightly talked about about adding SSL certificates via the AWS Console. This post talks about adding your own SSL certificate to Certificate Manager via the AWS CLI. The CLI which makes it super simple to manage. It also allows for automation as well.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws acm import-certificate \
--certificate fileb://Certificate.pem \
--certificate-chain fileb://CertificateChain.pem \
--private-key fileb://PrivateKey.pem
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If successful, it will return ARN or Amazon Resource Name.&lt;/p&gt;</description></item><item><title>cloudfront ssl certificates</title><link>http://uly.me/posts/cloudfront-ssl-certificates/</link><pubDate>Fri, 04 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cloudfront-ssl-certificates/</guid><description>&lt;p&gt;If you have SSL on your website, you can import your own SSL certificates into CloudFront, which is a content delivery network service by AWS. You will need to work a few AWS services to get it working.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CloudFront – create a distribution&lt;/li&gt;
&lt;li&gt;Route 53 – create a hosted zone and add a CNAME&lt;/li&gt;
&lt;li&gt;Certificate Manager – import your SSL certificate&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Finally, on the WordPress side, enable the use CloudFront in your SuperCache plugin.&lt;/p&gt;</description></item><item><title>restart sssd service</title><link>http://uly.me/posts/restart-sssd-service/</link><pubDate>Fri, 04 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/restart-sssd-service/</guid><description>&lt;p&gt;Just documenting how to restart SSSD service. SSSD is a service that allows Active Directory groups access to Linux systems.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;systemctl restart sssd.service
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For other or older Linux distros, you may have to use this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;service sssd restart
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can always try the other if one doesn’t work.&lt;/p&gt;</description></item><item><title>block lab</title><link>http://uly.me/posts/block-lab/</link><pubDate>Tue, 01 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/block-lab/</guid><description>&lt;p&gt;Block Lab is a plugin that allows you to create custom blocks within the WordPress Gutenberg editor. You can create blocks for content or code that you repeatedly use in an effort to simplify publishing. To create a custom plugin, you will need to create a block first. Once you named a block, you can add fields to that block and pass the variables to the block templates. The template contains the code that you need to send to the Gutenberg editor in the form of blocks. Here’s an example of a Block and Template.&lt;/p&gt;</description></item><item><title>yaml indentation</title><link>http://uly.me/posts/yaml-indentation/</link><pubDate>Tue, 01 Jan 2019 00:00:00 +0000</pubDate><guid>http://uly.me/posts/yaml-indentation/</guid><description>&lt;p&gt;JSON and YAML are used in AWS CloudFormation. Some people prefer YAML for its simplicity. It’s easy to read and code. However, YAML has its own little quirks. It relies heavily on indentation for its structure. If you don’t use the proper spaces, it will fail. I ran into an issue when I ran CloudFormation in AWS. The example below display the contents of my userdata.&lt;/p&gt;
&lt;p&gt;This piece of code will NOT work in CloudFormation.&lt;/p&gt;</description></item><item><title>create a crontab via script</title><link>http://uly.me/posts/create-a-crontab-via-script/</link><pubDate>Sun, 30 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-a-crontab-via-script/</guid><description>&lt;p&gt;How do you create a crontab entry via a Bash script? That’s a good question. Here is one solution:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;(crontab -l 2&amp;gt;/dev/null; echo &amp;#34;* 11 * * * /path/to/job -with args&amp;#34;) | crontab -
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want to run it as a specific user, use the following:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;(crontab -l -u user 2&amp;gt;/dev/null; echo &amp;#34;* 11 * * * /path/to/job -with args&amp;#34;) | crontab -
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>terraform</title><link>http://uly.me/posts/terraform/</link><pubDate>Sun, 30 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/terraform/</guid><description>&lt;p&gt;Hashicorp has a product called &lt;a href="https://learn.hashicorp.com/terraform/"&gt;Terraform&lt;/a&gt;, which is a provisioning tool for the cloud. It works with most major providers like AWS, GCP, Azure and many more. Unlike &lt;a href="https://aws.amazon.com/cloudformation/"&gt;CloudFormation&lt;/a&gt;, &lt;a href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/"&gt;Resource Manager&lt;/a&gt; and &lt;a href="https://cloud.google.com/deployment-manager/docs/"&gt;Deployment Manager&lt;/a&gt;, Terraform will work with not just its own, but with many cloud providers. Here’s an example of how to provision a single instance to AWS, and assign an elastic IP to it. The cloud resources in the example were redacted. Placeholder values were placed instead for security purposes.&lt;/p&gt;</description></item><item><title>wordpress on kubernetes</title><link>http://uly.me/posts/wordpress-on-kubernetes/</link><pubDate>Fri, 28 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-on-kubernetes/</guid><description>&lt;p&gt;&lt;a href="http://kubernetes.io"&gt;Kubernetes&lt;/a&gt; has documentation on how to deploy &lt;a href="http://wordpress.org"&gt;WordPress&lt;/a&gt; on its platform. The setup is using Persistent Volumes for both WordPress and MySQL on &lt;a href="https://github.com/kubernetes/minikube"&gt;MiniKube&lt;/a&gt;. Although the setup is not recommended for a production environment, it is a good start to get yourself familiar with Kubernetes. For production environments, they do recommend running WordPress on a Kubernetes cluster using the &lt;a href="https://github.com/helm/charts/tree/master/stable/wordpress"&gt;Helm&lt;/a&gt; package manager. Here’s the WordPress-MySQL &lt;a href="https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/"&gt;deployment on MiniKube.&lt;/a&gt;&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
name: wordpress-mysql
labels:
app: wordpress
spec:
ports:
- port: 3306
selector:
app: wordpress
tier: mysql
clusterIP: None
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
labels:
app: wordpress
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: wordpress-mysql
labels:
app: wordpress
spec:
selector:
matchLabels:
app: wordpress
tier: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: wordpress
tier: mysql
spec:
containers:
- image: mysql:5.6
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ec2 delete snapshots</title><link>http://uly.me/posts/ec2-delete-snapshots/</link><pubDate>Thu, 27 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ec2-delete-snapshots/</guid><description>&lt;p&gt;Here’s the AWS CLI command for deleting a snapshot.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 delete-snapshot \
--snapshot-id snap-xxxxxxxxxxxxxxx \
--profile default
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ec2 describe snapshots</title><link>http://uly.me/posts/ec2-describe-snapshots/</link><pubDate>Thu, 27 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ec2-describe-snapshots/</guid><description>&lt;p&gt;If you have a ton of snapshots, they tend to be difficult to find within the AWS console. Although AWS has optimized the snapshot view, it’s still in beta. Filtering a volume id is still a problem. It might be faster just to use the AWS CLI to display snapshot information. Here’s an example of how to display snapshots given a certain volume id.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-snapshots \
--filters Name=volume-id,Values=vol-xxxxxxxxxxxxxx \
--query &amp;#34;Snapshots[*].{ID:SnapshotId,Time:StartTime,Progress:Progress}&amp;#34; \
--profile default
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is something like this.&lt;/p&gt;</description></item><item><title>building a custom block</title><link>http://uly.me/posts/building-a-custom-block/</link><pubDate>Wed, 26 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/building-a-custom-block/</guid><description>&lt;p&gt;I found a new WordPress plugin that allows you to add custom blocks within the Gutenberg editor. You can create any block that you want by using the same templating code you’re already familiar with in WordPress. You can work with CSS, PHP, plugin shortcodes, etc. It’s a beautiful plugin with endless possibilities. The plugin is called &lt;a href="https://getblocklab.com/"&gt;Block Lab&lt;/a&gt;.&lt;/p&gt;
&lt;iframe width="720" height="420" src="https://www.youtube.com/embed/cmWnMBF0ly0?feature=oembed"&gt;&lt;/iframe&gt;</description></item><item><title>sublime text comment multiple lines</title><link>http://uly.me/posts/sublime-text-comment-multiple-lines/</link><pubDate>Wed, 26 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sublime-text-comment-multiple-lines/</guid><description>&lt;p&gt;If you need to comment out multiple lines in Sublime Text 2 or 3, there’s a short keystroke that you can use. First, you need to highlight the block (multiple lines) that you want to comment out, then press Ctrl + /. You can press it again to toggle on and off.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Line 1
Line 2
Line 3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Pressing Ctrl + / will comment out the highlighted block.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#Line 1
#Line 2
#Line 3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Press Ctrl + / again to toggle it back.&lt;/p&gt;</description></item><item><title>aws efs userdata</title><link>http://uly.me/posts/aws-efs-userdata/</link><pubDate>Tue, 25 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-efs-userdata/</guid><description>&lt;p&gt;If you want to auto mount the EFS volumes when the instance is created, add the following script to userdata:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;#cloud-config
repo_upgrade: all
packages:
- amazon-efs-utils
runcmd:
- file_system_id_01=fs-12345678
- file_system_id_02=fs-34593405
- efs_directory_01=/mnt/efs
- efs_directory_02=/mnt/efs2
- mkdir -p ${efs_directory_01}
- mkdir -p ${efs_directory_02}
- echo &amp;#34;${file_system_id_01}:/ ${efs_directory_01} efs tls,_netdev&amp;#34; &amp;gt;&amp;gt; /etc/fstab
- echo &amp;#34;${file_system_id_02}:/ ${efs_directory_02} efs tls,_netdev&amp;#34; &amp;gt;&amp;gt; /etc/fstab
- mount -a -t efs defaults
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Just add more if you have more mounts.&lt;/p&gt;</description></item><item><title>gcp attach detach disks</title><link>http://uly.me/posts/gcp-attach-detach-disks/</link><pubDate>Sun, 23 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-attach-detach-disks/</guid><description>&lt;p&gt;Google Cloud Platform just recently released a beta feature called detaching and attaching boot disks. Previously, boot disks were permanently attached to their VM instances. Now you have the ability to detach boot disk from your instance and attach it to another instance without deleting the original instance. You can also replace the boot disks for an instance rather than recreating the entire instance. I’ve tested it on my test account, and it works quite nicely.&lt;/p&gt;</description></item><item><title>cmd shift dot</title><link>http://uly.me/posts/cmd-shift-dot/</link><pubDate>Sat, 22 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cmd-shift-dot/</guid><description>&lt;p&gt;If you’re using Finder on a Mac OS, the quickest way to display and hide hidden files is by using the Command + Shift + . (or the period) key combination. This key combination will toggle on and off the hidden files inside the Finder. By the way, this is only applicable if you have the Mac Sierra OS and above. I like the clean look better (without the hidden files), but the Command + Shift + . is pretty handy if you need to quickly look at hidden files.&lt;/p&gt;</description></item><item><title>aws cli describe instances</title><link>http://uly.me/posts/aws-cli-describe-instances-2/</link><pubDate>Mon, 17 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-describe-instances-2/</guid><description>&lt;p&gt;If you have the instance id, you can print out the details like this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;aws ec2 describe-instances --instance-ids i-xxxxxxxxxxxxx \
--region us-east-1 --profile default
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>bash source in cron</title><link>http://uly.me/posts/bash-source-in-cron/</link><pubDate>Sun, 16 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bash-source-in-cron/</guid><description>&lt;p&gt;I’m running a “source” command inside a Bash script. The script is running fine on its own, but when I try running it inside a crontab, it doesn’t work. I’m using the source command just to load variables in a file, so I don’t have to edit multiple files. As it turns out, the regular shell in crontab does not quite understand the source command, and it’s the very reason the script fails. Here’s an example.&lt;/p&gt;</description></item><item><title>aws cli bucket lifecycle configuration</title><link>http://uly.me/posts/aws-cli-bucket-lifecycle-configuration/</link><pubDate>Fri, 14 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-bucket-lifecycle-configuration/</guid><description>&lt;p&gt;I was banging my head against the wall (not quite literally, but it was close) trying to come up with a S3 lifecycle configuration from scratch. I needed a JSON file that I can run in a bash script, so I can apply the lifecycle rules to a few dozen S3 buckets. Obviously, trying to create one from scratch wasn’t the wisest choice in my part. As it turns out, you can setup a temporary bucket and use the console to recreate the lifecycle, then export the lifecycle JSON file. Duh! Genius! Here’s the command to export the lifecycle configuration.&lt;/p&gt;</description></item><item><title>aws cli: describe instances</title><link>http://uly.me/posts/aws-cli-describe-instances/</link><pubDate>Thu, 13 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-describe-instances/</guid><description>&lt;p&gt;If you have a ton of EC2 instances, one way to get results quickly is to run to use AWS CLI such as “describe-instances.” Here’s an example on how to get a list of instances with a tag name equal to some value. In addition, you limit the display only results you want displayed.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ aws ec2 describe-instances \
--query &amp;#39;Reservations[].Instances[].Tags[?Key==`Name`].Value&amp;#39; \
--filter Name=tag:Project,Values=web \
--region us-east-1 \
--profile default \
--output text
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This returns values of the “Name” tag name in instances where they occur.&lt;/p&gt;</description></item><item><title>aws s3 intelligent-tiering</title><link>http://uly.me/posts/aws-s3-intelligent-tiering/</link><pubDate>Thu, 13 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-intelligent-tiering/</guid><description>&lt;p&gt;AWS recently released a new S3 feature called Intelligent-Tiering. It’s designed to optimize storage costs automatically when data access patterns change, without performance impact or operational overhead. S3 Intelligent-Tiering delivers automatic cost savings by moving data between two access tiers, frequent access and infrequent access, when access patterns change. To activate, all you need to do create or edit your current S3 lifecycle.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2018/12/it2.png"&gt;&lt;/p&gt;
&lt;p&gt;Transition to Intelligent-Tiering&lt;/p&gt;</description></item><item><title>aws cli s3 versioning</title><link>http://uly.me/posts/aws-cli-s3-versioning/</link><pubDate>Wed, 12 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-s3-versioning/</guid><description>&lt;p&gt;To turn on S3 versioning from the AWS CLI, just run the following command:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ aws s3api put-bucket-versioning --bucket mybucket \
----versioning-configuration Status=Enabled
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>split view on mac</title><link>http://uly.me/posts/split-view-on-mac/</link><pubDate>Mon, 10 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/split-view-on-mac/</guid><description>&lt;p&gt;I use split views on Windows quite a bit at work. On my Mac at home, not so much. Here are the instructions if you’re curious how it’s done on the MacOS. I’ve done it a few times, but just like many things, if you don’t use it enough, you tend to forget it. So, here’s a quick post for a search on the blog later.&lt;/p&gt;
&lt;h2 id="enter-the-split-view"&gt;Enter the Split View&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Hold down the full-screen button in the upper-left corner of a window.&lt;/li&gt;
&lt;li&gt;As you hold the button, the window shrinks and you can drag it to the left or right side of the screen.&lt;/li&gt;
&lt;li&gt;Release the button, then click another window to begin using both windows side by side&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img loading="lazy" src="https://uly.me/wp-content/uploads/2018/12/fullscreen.jpg"&gt;&lt;/p&gt;</description></item><item><title>aws cli create bucket</title><link>http://uly.me/posts/aws-cli-create-bucket/</link><pubDate>Sun, 09 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-create-bucket/</guid><description>&lt;p&gt;Creating a bucket via the AWS Console takes only a few clicks. If you’re creating a bucket via shell script, you will need to use the AWS CLI (command line interface). So, here’s the script to create a S3 bucket via the AWS CLI within shell. Now the bucket name has to be globally unique similar to a domain name. If someone already has claimed it, you will need to use an alternative name.&lt;/p&gt;</description></item><item><title>aws cli encrypt bucket</title><link>http://uly.me/posts/aws-cli-encrypt-bucket/</link><pubDate>Sun, 09 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-encrypt-bucket/</guid><description>&lt;p&gt;Here’s the CLI command to set server-side AES-256 encryption on a bucket.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ aws s3api put-bucket-encryption --bucket bucket-name \
--server-side-encryption-configuration \
&amp;#39;{&amp;#34;Rules&amp;#34;: [{&amp;#34;ApplyServerSideEncryptionByDefault&amp;#34;: {&amp;#34;SSEAlgorithm&amp;#34;: &amp;#34;AES256&amp;#34;}}]}&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can apply this to any existing bucket.&lt;/p&gt;</description></item><item><title>aws cli s3 lifecycle</title><link>http://uly.me/posts/aws-cli-s3-lifecycle/</link><pubDate>Sun, 09 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-cli-s3-lifecycle/</guid><description>&lt;p&gt;Here’s how to add a lifecycle management to S3 buckets via the CLI. In this example, expiration is set to 7 days. S3 will auto delete expired objects.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$aws s3api put-bucket-lifecycle-configuration \
--bucket bucketname --lifecycle-configuration file://lifecycle.json
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The lifecycle is defined in this JSON file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Rules&amp;#34;: [
{
&amp;#34;ID&amp;#34;: &amp;#34;Expires in 7 DAYS&amp;#34;,
&amp;#34;Prefix&amp;#34;: &amp;#34;&amp;#34;,
&amp;#34;Status&amp;#34;: &amp;#34;Enabled&amp;#34;,
&amp;#34;Expiration&amp;#34;: {
&amp;#34;Days&amp;#34;: 7
}
}
]
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>clean duplicates in file</title><link>http://uly.me/posts/clean-duplicates-in-file/</link><pubDate>Sun, 09 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/clean-duplicates-in-file/</guid><description>&lt;p&gt;Here’s a nice command to get rid of line duplicates in a file. I’m sending the output to a temporary file then renaming it back to the original file.&lt;/p&gt;
&lt;p&gt;The reason is, it’s probably not a good idea to overwrite a file that you are editing. It’s much safer to send the output to another file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ awk &amp;#39;!seen[$0]++&amp;#39; filename.txt &amp;gt; filename.temp
$ mv filename.temp filename.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A much cleaner approach is to use this. It will edit the file in place.&lt;/p&gt;</description></item><item><title>tlk.io embed</title><link>http://uly.me/posts/tlk-io-embed/</link><pubDate>Sun, 02 Dec 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/tlk-io-embed/</guid><description>&lt;p&gt;tlk.io is a simple chat page that you can embed on your site. If all you are seeing is a blank screen, I may have a fix for it. I don’t think it’s documented anywhere. I did not see it on tlk.io’s website. Here’s the code that they want you to embed. Of course, you have to use your own data-channel instead of the default “hey.”&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;div data-channel=&amp;#34;hey&amp;#34; id=&amp;#34;tlkio&amp;#34; style=&amp;#34;width:100%;height:400px;&amp;#34;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;script async=&amp;#34;&amp;#34; src=&amp;#34;http://tlk.io/embed.js&amp;#34; type=&amp;#34;text/javascript&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The above code will not work if your site is secured via SSL. You’ll need to change the embed.js reference to https. In this case, it would be something like this.&lt;/p&gt;</description></item><item><title>revised wordpress permissions</title><link>http://uly.me/posts/revised-wordpress-permissions/</link><pubDate>Fri, 23 Nov 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/revised-wordpress-permissions/</guid><description>&lt;p&gt;Here’s my revised WordPress permissions. Originally, I had it set to:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo chown -R www-data:www-data /var/www
$ find /var/www -type d -exec sudo chmod 755 {} \;
$ find /var/www -type f -exec sudo chmod 644 {} \;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is a very safe setup as recommended by quite a few WordPress security gurus.&lt;/p&gt;
&lt;p&gt;However, here’s the issue. When you try to FTP as “ulysses” user, it won’t let you overwrite files, because it doesn’t have write access to the “/var/www” directory since it’s owned by www-data. To fix the permission issue, first you have to add the “ulysses” user to the www-data group. See below. In addition, you’ll need to change ownership of the files and directories to the “ulysses” user and give “ulysses” user full access to the files. Change file permissions to 775, and directory permissions to 664.&lt;/p&gt;</description></item><item><title>using the gutenberg editor</title><link>http://uly.me/posts/using-the-gutenberg-editor/</link><pubDate>Thu, 22 Nov 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/using-the-gutenberg-editor/</guid><description>&lt;p&gt;Beginning with WordPress 5, Gutenberg will be part of the WordPress core. If you want a preview, install it as a plugin. What is Gutenberg?&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Gutenberg WordPress editor is a new page builder that is being designed to integrate with WordPress core. Gutenberg will add content blocks and page builder-like functionality to every up-to-date WordPress website. When in use, it will replace TinyMCE as the default content editor. With Gutenberg, content is added in blocks of various types from the WordPress backend. This is a quote block.&lt;/p&gt;</description></item><item><title>200mb usb drive</title><link>http://uly.me/posts/200mb-usb-drive/</link><pubDate>Mon, 19 Nov 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/200mb-usb-drive/</guid><description>&lt;p&gt;I have a 8GB USB drive that displays only as 200MB. I have to run diskpart as an Administrator from my Windows 10 computer. I selected the disk, and then cleaned it. After that, go back to disk management, and then reformat the entire partition to FAT32. USB drive is now showing 7.9GB.&lt;/p&gt;
&lt;p&gt;Here’s the &lt;a href="https://answers.microsoft.com/en-us/windows/forum/windows_8-hardware/usb-sandisk-8-gb-device-showing-as-200mb-how-do-i/f631df0d-9068-4f2d-820e-a6cbe9b464c3"&gt;fix&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>python: 16:9 aspect ratio</title><link>http://uly.me/posts/python-169-aspect-ratio/</link><pubDate>Thu, 15 Nov 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/python-169-aspect-ratio/</guid><description>&lt;p&gt;Just playing around with Python. This program a simple calculation of a video’s 16:9 aspect ratio.&lt;/p&gt;
&lt;p&gt;Just supply the width or height in pixels, it will display the 16:9 resolution.&lt;/p&gt;
&lt;p&gt;Here’s the code.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import math
print(&amp;#34;===================================================&amp;#34;)
print(&amp;#34;This program will calculate a video&amp;#39;s aspect ratio.&amp;#34;)
print(&amp;#34;===================================================&amp;#34;)
height_or_width = input(&amp;#39;Choose a height or width (h, w) to calculate? &amp;#39;)
if height_or_width == &amp;#34;h&amp;#34;:
video_height = float(input(&amp;#34;Enter a video height in px: &amp;#34;))
video_width = video_height * 1.7777777777777
print(&amp;#34;&amp;#34;)
print(&amp;#34;The video aspect ratio is: {:.0f} x {:.0f}&amp;#34;.format(video_width, video_height))
print(&amp;#34;&amp;#34;)
elif height_or_width == &amp;#34;w&amp;#34;:
video_width = float(input(&amp;#34;Enter a video width in px: &amp;#34;))
video_height = video_width / 1.7777777777777
print(&amp;#34;&amp;#34;)
print(&amp;#34;The video aspect ratio is: {:.0f} x {:.0f}&amp;#34;.format(video_width, video_height))
print(&amp;#34;&amp;#34;)
else:
print(&amp;#39;Thanks for playing .... &amp;#39;)
print(&amp;#39;&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The output:&lt;/p&gt;</description></item><item><title>learning python</title><link>http://uly.me/posts/learning-python/</link><pubDate>Wed, 07 Nov 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/learning-python/</guid><description>&lt;p&gt;I decided to start learning another programming language. &lt;a href="https://www.python.org/doc/"&gt;Python&lt;/a&gt;! Reading up with some docs now.&lt;/p&gt;
&lt;p&gt;By the way, Python 2.7 is already installed on the recent Mac OS. If you have Mavericks or a later OS, you’re good.&lt;/p&gt;</description></item><item><title>remote desktop sharing on mac</title><link>http://uly.me/posts/remote-desktop-sharing-on-mac/</link><pubDate>Wed, 07 Nov 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remote-desktop-sharing-on-mac/</guid><description>&lt;p&gt;If you have 2 Macs, you can get to the other one by using Screen Sharing. Just go System Preferences &amp;gt; Sharing &amp;gt; Remote Management. From there you can choose the type of access the remote user will have. You can also limit it to just one user or allow all if you have multiple users.&lt;/p&gt;
&lt;p&gt;To access the desktop from a remote desktop, just open up a Safari browser and enter in the URL box: vnc://192.168.1.222. Substitute the IP Address of the remote desktop that you want to control remotely. I works on Chrome as well. Wished I did this earlier.&lt;/p&gt;</description></item><item><title>lightsail manage databases</title><link>http://uly.me/posts/lightsail-manage-databases/</link><pubDate>Thu, 01 Nov 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lightsail-manage-databases/</guid><description>&lt;p&gt;Amazon Web Services is now offering managed databases in LightSail.&lt;/p&gt;
&lt;p&gt;If you have a small website or just want to develop something quickly, it might be worth a try creating a simple database in &lt;a href="https://aws.amazon.com/blogs/aws/new-managed-databases-for-amazon-lightsail/"&gt;LightSail&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>force rewrite to https except for page</title><link>http://uly.me/posts/force-rewrite-to-https-except-for-page/</link><pubDate>Wed, 31 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/force-rewrite-to-https-except-for-page/</guid><description>&lt;p&gt;Here’s how to force a rewrite pages to https except for a couple of pages.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteCond %{REQUEST_URI} !^\/page1\/
RewriteCond %{REQUEST_URI} !^\/page2\/
RewriteRule (.*) https://%{HTTP_HOST}/$1 [L,R=301]
RewriteCond %{HTTPS} =on
RewriteCond %{REQUEST_URI} \/page1\/ [OR]
RewriteCond %{REQUEST_URI} \/page2\/
RewriteRule (.*) http://%{HTTP_HOST}/$1 [L,R=301]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The first rule-set will redirect all pages not /page1/ or /page2/ to the same URL but https://.&lt;br&gt;
The second rule will make sure that /page1/ and /page2/ are redirected back to http:// if accessed via https://.&lt;/p&gt;</description></item><item><title>ssl expiry</title><link>http://uly.me/posts/ssl-expiry/</link><pubDate>Tue, 30 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ssl-expiry/</guid><description>&lt;p&gt;It’s not always clear how to find out when your SSL certificate is expiring. Openssl should be able to tell you.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ openssl x509 -enddate -noout -in certificate.crt
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>ibm buys redhat</title><link>http://uly.me/posts/ibm-buys-redhat/</link><pubDate>Sun, 28 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ibm-buys-redhat/</guid><description>&lt;p&gt;Fresh news from today. &lt;a href="https://devops.com/ibm-acquires-red-hat-to-create-devops-behemoth/"&gt;IBM buys Redhat&lt;/a&gt; for $34 billion.&lt;/p&gt;
&lt;p&gt;Here’s the &lt;a href="https://www.google.com/search?q=red+hat&amp;amp;source=lnms&amp;amp;tbm=nws&amp;amp;sa=X&amp;amp;ved=0ahUKEwjZwJ6c9qreAhUFq1kKHYnsBRsQ_AUIDigB&amp;amp;biw=1650&amp;amp;bih=886"&gt;latest news&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>working with ssmtp</title><link>http://uly.me/posts/working-with-ssmtp/</link><pubDate>Sun, 28 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/working-with-ssmtp/</guid><description>&lt;p&gt;Sometimes you just want something simple. There’s no need to configure sendmail every time you build a box.&lt;/p&gt;
&lt;p&gt;Instead, you can install and use &lt;a href="https://www.nixtutor.com/linux/send-mail-with-gmail-and-ssmtp/"&gt;ssmtp&lt;/a&gt; coupled with a Gmail account.&lt;/p&gt;</description></item><item><title>lvm documentation</title><link>http://uly.me/posts/lvm-documentation/</link><pubDate>Wed, 17 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/lvm-documentation/</guid><description>&lt;p&gt;If you’re working with LVM, here’s everything you need to know about Logical Volume Manager. Thanks to Centos.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/"&gt;LVM Documentation&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>gsutil installation</title><link>http://uly.me/posts/gsutil-installation/</link><pubDate>Mon, 15 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gsutil-installation/</guid><description>&lt;p&gt;The standard GSUtil installation recommended by Google wasn’t working. I found an alternative way to install GSUtil using wget to download, and tar to unzip. You might need to add a path if you install it on a non-standard directory.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.aodba.com/install-google-cloud-storage-tool-gsutil-linux-centos/"&gt;Alternative way to install GSUtil on Linux&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>attach an ebs volume to an instance</title><link>http://uly.me/posts/attach-an-ebs-volume-to-an-instance/</link><pubDate>Wed, 10 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/attach-an-ebs-volume-to-an-instance/</guid><description>&lt;p&gt;Attaching an EBS volume to an existing instance is quite easy. You can easily add them via the AWS Console. With just a few clicks, you can add an EBS volume in no time. Just click the Create Volume button, indicate the size of the volume, choose which availability zone (preferably the same AZ where your instance resides), and enable encryption if you decide to do so. You can also add an EBS volume from an existing snapshot.&lt;/p&gt;</description></item><item><title>limitations when stopping rds</title><link>http://uly.me/posts/limitations-when-stopping-rds/</link><pubDate>Wed, 10 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/limitations-when-stopping-rds/</guid><description>&lt;p&gt;There are several cases where there will be a need to stop a RDS instance. It could be due to testing, development activity, or simply to save money. Whatever the reasons may be, you’ll need to be aware of the limitations when stopping RDS instances. Here are several cases where it may become an issue.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can’t stop a DB instance that has a Read Replica, or that is a Read Replica.&lt;/li&gt;
&lt;li&gt;You can’t stop a DB instance that is in a Multi-AZ deployment.&lt;/li&gt;
&lt;li&gt;You can’t stop a DB instance that uses Microsoft SQL Server Mirroring.&lt;/li&gt;
&lt;li&gt;You can’t modify a stopped DB instance.&lt;/li&gt;
&lt;li&gt;You can’t delete an option group that is associated with a stopped DB instance.&lt;/li&gt;
&lt;li&gt;You can’t delete a DB parameter group that is associated with a stopped DB instance.&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>testing a network port connection</title><link>http://uly.me/posts/testing-a-network-port-connection/</link><pubDate>Wed, 10 Oct 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/testing-a-network-port-connection/</guid><description>&lt;p&gt;You can test a network port connection using the “nc” command on Linux and “telnet” on Windows.&lt;/p&gt;
&lt;p&gt;Format:&lt;br&gt;
$ nc -zv domain.com port&lt;br&gt;
C:&amp;gt; telnet domain.com port&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ nc -zv domain.com 80
Connection to domain.com 80 port [tcp/http] succeeded!
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;C:\&amp;gt; telnet -zv domain.com 80
Connecting To domain.com...Could not open connection to the host, on port 80: Connect failed
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For Telnet, if a connection is successful, it returns no message.&lt;/p&gt;</description></item><item><title>domain sorter</title><link>http://uly.me/posts/domain-sorter/</link><pubDate>Fri, 14 Sep 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/domain-sorter/</guid><description>&lt;p&gt;Here’s a Bash and Perl script for sorting domains and subdomains.&lt;/p&gt;
&lt;p&gt;Command:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat filename | perl -ple&amp;#39;$_=join&amp;#34;.&amp;#34;,reverse split/\./&amp;#39; | sort | perl -ple&amp;#39;$_=join&amp;#34;.&amp;#34;,reverse split/\./&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;What’s in the domains.txt?&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat domains.txt
domain.com
abc.com
xyz.com
bbb.com
mail.gmail.com
ess.sfss.org
csub.edu
gmail.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Result:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat domains.txt | perl -ple&amp;#39;$_=join&amp;#34;.&amp;#34;,reverse split/\./&amp;#39; | sort | perl -ple&amp;#39;$_=join&amp;#34;.&amp;#34;,reverse split/\./&amp;#39;
abc.com
bbb.com
domain.com
gmail.com
mail.gmail.com
xyz.com
csub.edu
ess.sfss.org
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also pipe the result to another file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ cat filename | perl -ple&amp;#39;$_=join&amp;#34;.&amp;#34;,reverse split/\./&amp;#39; | sort | perl -ple&amp;#39;$_=join&amp;#34;.&amp;#34;,reverse split/\./&amp;#39; &amp;gt; output.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a href="https://www.perlmonks.org/?node_id=299555"&gt;Source&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>remove duplicate in a file</title><link>http://uly.me/posts/remove-duplicate-in-a-file/</link><pubDate>Fri, 14 Sep 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-duplicate-in-a-file/</guid><description>&lt;p&gt;Here’s a Perl script for removing duplicates in a file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;perl -ne &amp;#39;print unless $dup{$_}++;&amp;#39; input_file &amp;gt; output_file
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>create image on gcp</title><link>http://uly.me/posts/create-image-on-gcp/</link><pubDate>Wed, 08 Aug 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-image-on-gcp/</guid><description>&lt;p&gt;Here’s the command to create an image from an existing VM instance. You can create an image from disks, snapshots, images or from a cloud storage file. You can use images you built to launch and restore VM instances, as well as create Instance Templates.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute --project=your-project images create your-server --source-disk=your-server --source-disk-zone=us-central1-c
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>take a gcp snapshot</title><link>http://uly.me/posts/take-a-gcp-snapshot/</link><pubDate>Wed, 08 Aug 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/take-a-gcp-snapshot/</guid><description>&lt;p&gt;Here’s the gcloud command to create a snapshot of your GCP instance.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud compute disks snapshot your-server \
--snapshot-names=your-server-180808 \
--project=your-project \
--zone=us-central1-c
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>cloning a gcp repo</title><link>http://uly.me/posts/cloning-a-gcp-repo/</link><pubDate>Fri, 03 Aug 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cloning-a-gcp-repo/</guid><description>&lt;p&gt;Here are the steps on how to clone a Google Cloud Platform (GCP) repository. This is assuming you already installed Google Cloud SDK.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;gcloud init
gcloud source repos clone name_of_repo --project=project_name
cd name_of_repo
git commit -a -m &amp;#34;your comment&amp;#34;
git push -u origin master
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git diff</title><link>http://uly.me/posts/git-diff/</link><pubDate>Thu, 02 Aug 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-diff/</guid><description>&lt;p&gt;When working with version control, sometimes you would like to know what files were committed locally vs what’s on the master origin repository. One way to know the difference is to use the git diff or the git log commands. Here are the commands to check the differences between the local and master origin repositories. Diff is better in my opinion since it actually displays the code changes instead of just displaying the commit ID.&lt;/p&gt;</description></item><item><title>url encode</title><link>http://uly.me/posts/url-encode/</link><pubDate>Thu, 02 Aug 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/url-encode/</guid><description>&lt;p&gt;If you need to special characters encoded in a URL, these sites really come handy. Why is there a need to encode? URLs accepts only alphanumeric characters and a limited number of special characters. For example, : and / are common characters you’ll find in URLs. Meanwhile spaces are not allowed, but instead are represented as %20 when encoded. There are other special characters that will need to be encoded.&lt;/p&gt;</description></item><item><title>aws transit vpcs</title><link>http://uly.me/posts/aws-transit-vpcs/</link><pubDate>Tue, 24 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-transit-vpcs/</guid><description>&lt;p&gt;If you have multiple VPCs located in geographically diverse regions, you can connect them together using a new service called Transit VPCs. It’s a logically isolated VPC which can act as a bridge for launching and transferring data between regions. It can work as global transit center between other VPCs within your organization. Learn more by reading about it from AWS &lt;a href="https://aws.amazon.com/blogs/aws/aws-solution-transit-vpc/"&gt;announcement&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>gke on-prem</title><link>http://uly.me/posts/gke-on-prem/</link><pubDate>Tue, 24 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gke-on-prem/</guid><description>&lt;p&gt;How about running GKE (Google Kubernetes Engine) on your own data center. Why would anyone do that while everyone else is moving to the cloud. Well, Google is creating a stepping stone to move enterprises to the cloud. What a better way than to build a bridge that will shorten the gap. &lt;a href="https://cloud.google.com/gke-on-prem/"&gt;GKE On-Prem&lt;/a&gt; service will include access to all GKE cloud features, including the ability to register, manage clusters and monitoring via a service called Stackdriver. GKE On-Prem will include a direct line to the GCP Marketplace, which has support for Kubernetes-based applications.&lt;/p&gt;</description></item><item><title>create a repository in codecommit</title><link>http://uly.me/posts/create-a-repository-in-codecommit/</link><pubDate>Sun, 22 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/create-a-repository-in-codecommit/</guid><description>&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html"&gt;CodeCommit&lt;/a&gt; is a version control system hosted in AWS that you can use privately to store and manage your source code, documents or binary files. You can get free (as in beer) unlimited repositories, if you have less than 5 users, and if your storage is less than 50 GB-month, and you have less than 10,000 git requests per month. If you have more than 5 users, it’s $1 a month per user. Still not bad. Here’s CodeCommit &lt;a href="https://aws.amazon.com/codecommit/pricing/"&gt;pricing&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>ssh to codecommit</title><link>http://uly.me/posts/ssh-to-codecommit/</link><pubDate>Sun, 22 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ssh-to-codecommit/</guid><description>&lt;p&gt;Although you can access CodeCommit from the AWS Console, the most efficient way to access it, is via SSH. Assuming you already have an IAM user, as well as Git installed on your local machine, it’s time to setup a SSH connection to CodeCommit by performing the following commands.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Generate a RSA key pair&lt;/li&gt;
&lt;li&gt;Copy the public key to the clipboard.&lt;/li&gt;
&lt;li&gt;Upload the SSH public key to the AWS IAM Console.&lt;/li&gt;
&lt;li&gt;You’ll receive a SSH Key ID.&lt;/li&gt;
&lt;li&gt;Create a config file&lt;/li&gt;
&lt;li&gt;chmod 600 config&lt;/li&gt;
&lt;li&gt;Test connection&lt;/li&gt;
&lt;li&gt;Clone repo&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To get more details regarding SSH access to CodeCommit, visit the AWS &lt;a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html"&gt;docs&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>amazon polly</title><link>http://uly.me/posts/amazon-polly/</link><pubDate>Thu, 19 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/amazon-polly/</guid><description>&lt;p&gt;AWS has a service that turns text into speech called &lt;a href="https://aws.amazon.com/polly/"&gt;Polly&lt;/a&gt;. You can choose what type of voice, language and gender. AWS recently added a simple form, for an easy text to speech conversion and download. The form is limited to 3000 characters or less. The converted file is a MP3 format. For larger texts, the converted audio file will be stored in a S3 bucket for later retrieval. Using Amazon Polly along with Translate will be a cool experiment. AWS Translate is a natural language translation service.&lt;/p&gt;</description></item><item><title>amazon selling routers</title><link>http://uly.me/posts/amazon-selling-routers/</link><pubDate>Sun, 15 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/amazon-selling-routers/</guid><description>&lt;p&gt;Amazon tends to be dipping in their toes into everything. Remember Whole Foods. If that wasn’t enough, Amazon started competing with drugstores six months ago when it acquired Pillpack. Shares of Walgreens and CVS went down 9 percent as a result. Now, Amazon is saying that they want to compete with network companies like Cisco, Juniper and Arista. Potentially, Amazon can sell networking data switches at deep discounts ranging anywhere from 50% up to 80% discount. That’s bad news for some networking companies.&lt;/p&gt;</description></item><item><title>aws rds patching</title><link>http://uly.me/posts/aws-rds-patching/</link><pubDate>Sun, 15 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-rds-patching/</guid><description>&lt;p&gt;RDS is a managed service by AWS. Patching is performed infrequently. Sometimes, it takes a few months. AWS performs these updates during the maintenance period. If no maintenance period was specified during DB creation, it will be assigned a default period. When patching is performed, AWS may need to stop and reboot your RDS instance right after patches are applied. To avoid potential downtime, make sure your RDS instances are configured in a Multi-AZ environment. Patching will be applied on each RDS instance separately, therefore avoiding downtime for your application.&lt;/p&gt;</description></item><item><title>deleting aws security groups</title><link>http://uly.me/posts/deleting-aws-security-groups/</link><pubDate>Sun, 15 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/deleting-aws-security-groups/</guid><description>&lt;p&gt;Every once in a while, you may need to do some cleanup and perform maintenance in AWS. One area where you can do some cleanup is the security groups. To check if security groups are in-used, is by way of the AWS Console. You can filter the security group via Instances. But that is not going to be enough. Security groups are also used in RDS as well as in load balancers. Overall, you have to be extra careful not to delete a security group that’s in-use. Fortunately, AWS will prompt you if you try to delete a security group that is still in-use. It’s a safety feature that can potentially save you from headaches.&lt;/p&gt;</description></item><item><title>snap packages</title><link>http://uly.me/posts/snap-packages/</link><pubDate>Fri, 13 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/snap-packages/</guid><description>&lt;p&gt;Ubuntu 16.04 has a feature called Snap packaging. Snaps are containerized software packages that are simple to create, and easy to install on all major Linux systems. Snap packages are self-contained and separate from your system files. There are no complex dependencies or interference. The packages are safe to run since snap packages and their data are separate from your system files. Updates are automatic and only download what has changed. You can revert to a previous version at any time. Any updates can also be reversed.&lt;/p&gt;</description></item><item><title>gcp billing issues</title><link>http://uly.me/posts/gcp-billing-issues/</link><pubDate>Sun, 01 Jul 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gcp-billing-issues/</guid><description>&lt;p&gt;This is what happens when AI takes over billing issues. The element of leniency, fairness and humanity goes out the window. Such is the case when servers were automatically shut down by Google Cloud due to a billing issue. Services were shut down because of a credit card problem. The email sent by Google to the company even threatened to delete the project if the billing issue is not resolved in three days. Read &lt;a href="https://medium.com/@serverpunch/why-you-should-not-use-google-cloud-75ea2aec00de"&gt;article&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>gitlab moves to gcp</title><link>http://uly.me/posts/gitlab-moves-to-gcp/</link><pubDate>Tue, 26 Jun 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gitlab-moves-to-gcp/</guid><description>&lt;p&gt;Gitlab is moving from Microsoft Azure to Google Cloud Platform mainly due to its integration with Google Kubernetes Engine. Gitlab believes Kubernetes is the future and makes their platform to massively scale as it grows. The move is scheduled on July 28. Gitlab plans to use their Geo product for the migration of Gitlab.com. For more, read the &lt;a href="https://about.gitlab.com/2018/06/25/moving-to-gcp/"&gt;article&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>failover test</title><link>http://uly.me/posts/failover-test/</link><pubDate>Sun, 24 Jun 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/failover-test/</guid><description>&lt;p&gt;How to failover a website without actually doing a failover? It’s actually easier than you think. The key is to trick your computer that it’s pointing to a failover website. You can easily do this by editing your hosts file and adding a DNS entry. In both Linux and MacOS, you can edit the /etc/hosts file and add the failover site like the following below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# /etc/hosts
# failover site
# xxx.xxx.xxx.xxx yourdomain.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;xxx.xxx.xxx.xxx is the IP address of your failover site.&lt;br&gt;
If you need to test the failover site, just uncomment the IP address.&lt;br&gt;
Replace a comment if you’re done testing.&lt;/p&gt;</description></item><item><title>the enigma machine</title><link>http://uly.me/posts/the-enigma-machine/</link><pubDate>Sun, 24 Jun 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/the-enigma-machine/</guid><description>&lt;p&gt;It took about 2,000 Digital Ocean droplets, 13 minutes of compute time, and about $7 dollars worth of cloud resources, to break the Enigma code which were used by the Nazis in World War 2. The code was written in Python and ran as minions. The minions did the 99% of the grunt work. The droplets ran 41 million password combinations per second. What took years for Allied forces to break the code can now be decoded in just 13 minutes. Read the &lt;a href="https://blog.digitalocean.com/how-2000-droplets-broke-the-enigma-code-in-13-minutes/"&gt;article&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>restrict bucket to users</title><link>http://uly.me/posts/restrict-bucket-to-users/</link><pubDate>Sat, 23 Jun 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/restrict-bucket-to-users/</guid><description>&lt;p&gt;How to restrict a S3 bucket to certain group of users. Edit the bucket policy and add the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
&amp;#34;Version&amp;#34;: &amp;#34;2012-10-17&amp;#34;,
&amp;#34;Id&amp;#34;: &amp;#34;bucketPolicy&amp;#34;,
&amp;#34;Statement&amp;#34;: [
{
&amp;#34;Effect&amp;#34;: &amp;#34;Deny&amp;#34;,
&amp;#34;NotPrincipal&amp;#34;: {
&amp;#34;AWS&amp;#34;: &amp;#34;arn:aws:iam::xxxxxxxxxx:user/username&amp;#34;,
&amp;#34;AWS&amp;#34;: &amp;#34;arn:aws:iam::xxxxxxxxxx:root&amp;#34;,
},
&amp;#34;Action&amp;#34;: &amp;#34;s3:*&amp;#34;,
&amp;#34;Resource&amp;#34;: [
&amp;#34;arn:aws:s3:::bucketname&amp;#34;,
&amp;#34;arn:aws:s3:::bucketname/*&amp;#34;
]
}
]
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Replace xxxxxxxxxx with your AWS account number.&lt;br&gt;
Replace bucketname with your S3 bucket.&lt;br&gt;
Replace username with your IAM user.&lt;br&gt;
Root is your AWS root account.&lt;br&gt;
Accounts must be valid.&lt;/p&gt;</description></item><item><title>multiple txt dns records</title><link>http://uly.me/posts/multiple-txt-dns-records/</link><pubDate>Sun, 10 Jun 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/multiple-txt-dns-records/</guid><description>&lt;p&gt;I recently moved my website hosting from Linode to AWS LightSail. Part of the move was working with Route 53 for DNS, as well as setting up my domain’s email, e.g. the MX record. I’m using ProtonMail for email and they require that I add multiple TXT records. Part of the problem is Route 53 will not allow duplicate TXT records. After a few searches, I learned that you can enter in multiple values in the TXT record as long as you place them on multiple lines. That solved the problem for me.&lt;/p&gt;</description></item><item><title>certbot</title><link>http://uly.me/posts/certbot/</link><pubDate>Mon, 04 Jun 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/certbot/</guid><description>&lt;p&gt;Certbot is an easy-to-use automatic client that fetches and deploys SSL/TLS certificates for your webserver. Certbot was developed by EFF and others as a client for Let’s Encrypt and was previously known as “the official Let’s Encrypt client” or “the Let’s Encrypt Python client.” Certbot will also work with any other CAs that support the ACME protocol.&lt;/p&gt;
&lt;p&gt;Just choose your webserver, e.g. Apache, Nginx or IIS, as well as your operating system. Here’s the instruction for Ubuntu 16.04 LTS.&lt;/p&gt;</description></item><item><title>github acquired by microsoft</title><link>http://uly.me/posts/github-acquired-by-microsoft/</link><pubDate>Mon, 04 Jun 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/github-acquired-by-microsoft/</guid><description>&lt;p&gt;Microsoft acquired Github today for $7.5 billion. &lt;a href="http://github.com"&gt;Github&lt;/a&gt; was founded in 2008. It stores and manages code in repositories using Git, a distributed version control software developed by Linus Torvalds. It has 28 million users and 85 million projects. Github public repositories are free. Private repositories start at $7 per month for developers. For teams, it starts at $9 per user/month and up to $21 per user/month. If you like to run your own Git repository, check out &lt;a href="https://about.gitlab.com/"&gt;GitLab&lt;/a&gt;. Just install it on a Linux server.&lt;/p&gt;</description></item><item><title>reset pam_tally2</title><link>http://uly.me/posts/reset-pam_tally2/</link><pubDate>Fri, 25 May 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/reset-pam_tally2/</guid><description>&lt;p&gt;To unlock a locked account, you need to run pam_tally2, which is a tool that keeps tracked of failed logins. Pam_tally2 is installed on most Linux systems. To unlock an account, just run the following commands:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pam_tally2 --user=ulysses --reset
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Have the user login again. It should work.&lt;/p&gt;
&lt;p&gt;Some systems might be using an older pam_tally. The command for that will be.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;pam_tally --user=ulysses --reset=0
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>free ssl certificates</title><link>http://uly.me/posts/free-ssl-certificates/</link><pubDate>Tue, 22 May 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/free-ssl-certificates/</guid><description>&lt;p&gt;I picked up a free SSL certificate from SSLForFree.com. It’s good for 90 days. Not a bad deal. Wished it was longer. Without further ado, the site is now running on https! Check out the secure lock next to my domain! I’ve added a redirect to force visitors to use https instead. It’s a good exercise on how to convert any site from http to https. I learned how to configure Apache and how to use certificates. Anyways, plan to do them for my other websites.&lt;/p&gt;</description></item><item><title>random salt</title><link>http://uly.me/posts/random-salt/</link><pubDate>Wed, 09 May 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/random-salt/</guid><description>&lt;p&gt;Occasionally, I’m asked to provide a random list of characters that will be used as a salt for hashing a password or some data of some sort. The primary function of salts are to create a random one-way function typically used to fight against dictionary or rainbow table attacks. Here’s a neat command that you can generate from the Bash shell. It will generate a 32 random character string.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ tr -c -d &amp;#39;0123456789abcdefghijklmnopqrstuvwxyz&amp;#39; /urandom | dd bs=32 count=1 2&amp;gt;/dev/null;echo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result is: ynhgunq3ppnirhhp3vxpmvdw5b2uuc2f&lt;/p&gt;</description></item><item><title>cronjob not running</title><link>http://uly.me/posts/cronjob-not-running/</link><pubDate>Mon, 16 Apr 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cronjob-not-running/</guid><description>&lt;p&gt;I had issues with cron. The jobs were not running, so it seemed. It turned out that they were in fact running. The jobs were firing off based on schedule. The problem was, cron didn’t have the correct path to the commands. I realized this when I looked at a couple of log files, in /var/mail and /var/log/syslog to look for clues. The fix was to include the path in cron.&lt;/p&gt;</description></item><item><title>password expiry</title><link>http://uly.me/posts/password-expiry/</link><pubDate>Sun, 08 Apr 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/password-expiry/</guid><description>&lt;p&gt;If you’re asked to change the password expiry or password inactivity for a Linux user, the following command will fix it. It’s ideal in situations where you don’t want the password to expire or you don’t want a user to go inactive. It’s also useful if you want a user to be running automated scripts. Here’s the chage command and its available options.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# chage -m 0 -M 99999 -I -1 -E -1 johndoe
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;-m 0 will set the minimum number of days between password change to 0&lt;br&gt;
-M 99999 will set the maximum number of days between password change to 99999&lt;br&gt;
-I -1 (number minus one) will set the “Password inactive” to never&lt;br&gt;
-E -1 (number minus one) will set “Account expires” to never.&lt;/p&gt;</description></item><item><title>multiple virtualhosts</title><link>http://uly.me/posts/multiple-virtualhosts/</link><pubDate>Sat, 10 Mar 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/multiple-virtualhosts/</guid><description>&lt;p&gt;Here’s the proper way to host multiple websites (domains) on single host with a single IP address. Technically, you can have multiple Apache configuration files that you can enable within Apache, but you can easily simplify and combine them into a single Apache configuration file. You can separate each domain by creating multiple virtualhost sections as shown in the example below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;virtualhost&amp;gt;
DocumentRoot &amp;#34;/www/example1&amp;#34;
ServerName www.example.com
# Other directives here
&amp;lt;/virtualhost&amp;gt;
&amp;lt;virtualhost&amp;gt;
DocumentRoot &amp;#34;/www/example2&amp;#34;
ServerName www.example.org
# Other directives here
&amp;lt;/virtualhost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you’re interested, read up on Apache’s website about &lt;a href="https://httpd.apache.org/docs/2.4/vhosts/examples.html"&gt;virtual hosts&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>extend an ebs volume</title><link>http://uly.me/posts/extend-an-ebs-volume/</link><pubDate>Mon, 05 Mar 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/extend-an-ebs-volume/</guid><description>&lt;p&gt;As a Cloud Engineer, I get a few requests to extend an EBS volume. For example, the application owner wants to double the size of the /data volume from 10GB to 20GB. The nice part about extending an EBS volume is that it can all be done on the fly without bringing down the instance. Adding more storage can be done via the AWS Console. Check out this &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/console-modify.html"&gt;article&lt;/a&gt; from AWS about modifying an EBS volume. But that’s just the first part. Although you’ve doubled the disk space, you still have to let the system know it now has doubled it’s disk space. The second part is to grow or resize the file system. Here’s the other &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html"&gt;article&lt;/a&gt; on how to extend a file system.&lt;/p&gt;</description></item><item><title>convert json to yaml</title><link>http://uly.me/posts/convert-json-to-yaml/</link><pubDate>Tue, 30 Jan 2018 00:00:00 +0000</pubDate><guid>http://uly.me/posts/convert-json-to-yaml/</guid><description>&lt;p&gt;JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. YAML is a flexible, human readable file format that is ideal for storing object trees. YAML stands for “YAML Ain’t Markup Language”. It is easier to read than JSON, and can contain richer meta data. If you would like to switch formats, for example from JSON to YAML or vice versa, there are numerous website out there that can convert your code from one format to another. Check out this &lt;a href="https://www.json2yaml.com/"&gt;json2yaml&lt;/a&gt; converter.&lt;/p&gt;</description></item><item><title>cron allow</title><link>http://uly.me/posts/cron-allow/</link><pubDate>Thu, 21 Dec 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cron-allow/</guid><description>&lt;p&gt;Some Linux distributions don’t turn on cron automatically for users. To give certain users access to cron, add them to cron.allow.&lt;/p&gt;
&lt;p&gt;Edit cron.allow.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo nano /etc/cron.allow
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add one user per line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;johndoe
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Save and close.&lt;/p&gt;</description></item><item><title>empty a file</title><link>http://uly.me/posts/empty-a-file/</link><pubDate>Thu, 21 Dec 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/empty-a-file/</guid><description>&lt;p&gt;If you work with vi, nano or any other command line editor, deleting a line is a fairly easy thing to do. If the file is too large, deleting the content line by line is not fun. There’s a better way to empty a file without deleting it. Here are several ways.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ &amp;gt; filename
$ truncate -s 0 filename
$ echo &amp;#34;&amp;#34; &amp;gt; filename
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>sudoers</title><link>http://uly.me/posts/sudoers/</link><pubDate>Thu, 21 Dec 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sudoers/</guid><description>&lt;p&gt;The /etc/sudoers file gives users the ability to run commands that are typically reserved for administrators. The commands require a password or no password, depending on how you set them up in the sudoers file. The sudoers file can’t be edited using any text editor. You have to use visudo.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ visudo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add groups to access sudo.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Allow users in techgroup to run all commands
%techgroup ALL=(ALL) NOPASSWD: ALL
# Allow users in techgroup without a password
%techgroup ALL=(ALL) NOPASSWD: ALL
# Allow users in techgroup to shutdown the system
%techgroup localhost=/sbin/shutdown -h now
#includedir /etc/sudoers.d
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Typically you have to add your groups in the sudoers file. Notice the last line. Sudoers will include config files found under the /etc/sudoers.d directory. In certain circumstances, there are others pieces of software such as compliance software CFEngine that writes over changes in the sudoers file. If this is the case, then you have to add your groups in a file inside the /etc/sudoers.d directory.&lt;/p&gt;</description></item><item><title>check db connection on aws</title><link>http://uly.me/posts/check-db-connection-on-aws/</link><pubDate>Sun, 03 Dec 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-db-connection-on-aws/</guid><description>&lt;p&gt;When setting up your cloud infrastructure, you can check if your instances have access to the database by performing this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ nc -zv 10.0.0.45 3306
$ nc -zv domain.com 3306
$ nc -zv endpoint.amazonaws.com 3306
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If connection has succeeded, you’ll get a message like this in Linux and MacOS …&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Connection to endpoint.amazonaws.com 3306 port [tcp/mysql] succeeded!
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;On Windows, you can use Telnet to test your DB connection.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;C:\&amp;gt;telnet endpoint.amazonaws.com 3306
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If connection has succeeded, the result is “no message.” If there’s a problem, you’ll get this ….&lt;/p&gt;</description></item><item><title>comment multiple lines in bash</title><link>http://uly.me/posts/comment-multiple-lines-in-bash/</link><pubDate>Tue, 28 Nov 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/comment-multiple-lines-in-bash/</guid><description>&lt;p&gt;If you find yourself commenting out multiple lines in BASH, there is a simple way of commenting them out using the HERE DOCUMENT feature. Typically you use the hash (#) tag to comment out each line, but that can get tiresome especially if have hundreds of lines. Here’s a better option. Use the HERE DOCUMENT feature in BASH. Anything in between the HERE DOCUMENT will be ignored by BASH and treated as comments.&lt;/p&gt;</description></item><item><title>install laravel 5.5 on ubuntu 16.04</title><link>http://uly.me/posts/install-laravel-5-5-on-ubuntu-16-04/</link><pubDate>Tue, 28 Nov 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-laravel-5-5-on-ubuntu-16-04/</guid><description>&lt;p&gt;Laravel is a MVC framework for PHP. The latest Laravel release is version 5.5 in July 2017. Laravel 5.5 requires PHP 7 and higher. The latest stable release of PHP is 7.1. The following instructions walks you through how to install Laravel 5.5 on Ubuntu 16.04 LTS.&lt;/p&gt;
&lt;p&gt;Update&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get update
sudo apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install Apache&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# install apache
sudo apt-get install apache2
# start apache
sudo systemctl start apache2
# enable on startup
sudo systemctl enable apache2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install PHP 7&lt;/p&gt;</description></item><item><title>delete linux mail from terminal</title><link>http://uly.me/posts/delete-linux-mail-from-terminal/</link><pubDate>Mon, 27 Nov 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/delete-linux-mail-from-terminal/</guid><description>&lt;p&gt;If you’re getting tired of seeing this …&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ You have new mail in /var/spool/mail/username
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can delete by running this command from the Terminal&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ &amp;gt; /var/spool/mail/username
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>aws s3 killedted</title><link>http://uly.me/posts/aws-s3-killedted/</link><pubDate>Sun, 29 Oct 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-s3-killedted/</guid><description>&lt;p&gt;I was trying to copy a large file from AWS S3 bucket to the smallest Amazon Lightsail instance using the AWS CLI. It was throwing out an error saying “Killedted 3.8 Mib/113.4 Mib (5.0 Mib/s) with 1 file(s) remaining.” For some reason, the copy was being killed or terminated. I was thinking that maybe the small instance was not enough to copy or move large files. I’m glad I found a &lt;a href="https://github.com/aws/aws-cli/issues/1775"&gt;workaround&lt;/a&gt;. Here’s the command I was doing, and the fix.&lt;/p&gt;</description></item><item><title>exfat compatibility</title><link>http://uly.me/posts/exfat-compatibility/</link><pubDate>Mon, 07 Aug 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/exfat-compatibility/</guid><description>&lt;p&gt;When formatting thumb drives, Windows give you the flexibility to choose which format to use, whether it’s NTFS, FAT32, and exFAT. Windows will support all three formats. There are advantages and disadvantages to each format. I’m not going to cover in detail the differences between all three. You can read them &lt;a href="https://www.howtogeek.com/235596/whats-the-difference-between-fat32-exfat-and-ntfs/"&gt;here&lt;/a&gt;. Here is where it makes sense though. If you need full compatibility, especially if you’re switching between Windows and Mac, then I recommend that you use the exFAT format. It’s readable and writeable on both Windows and MacOS. The only downside is Linux. For full compatibility, you need to install a couple of packages called exfat-fuse and exfat-utils in your Linux distro. You can use this &lt;a href="https://www.howtogeek.com/235655/how-to-mount-and-use-an-exfat-drive-on-linux/"&gt;guide&lt;/a&gt;. Hopefully, this short article and the linked articles, benefits you, in terms of choosing the correct format that’s best for your needs.&lt;/p&gt;</description></item><item><title>serverless jekyll on aws</title><link>http://uly.me/posts/serverless-jekyll-on-aws/</link><pubDate>Fri, 21 Jul 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/serverless-jekyll-on-aws/</guid><description>&lt;p&gt;I recently started playing around with &lt;a href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Jekyll is a flat-file CMS that doesn’t need a database. You don’t even need to know HTML to work with it. You just write your content using the Markdown language on any text editor. Once you’re done editing, you run “jekyll build” and Jekyll takes care of the rest. Since Jekyll files are stored on flat-files, you have quite a few choices where to host your website. You can host it on just about any hosting provider. You can have it hosted on &lt;a href="http://github.com"&gt;Github&lt;/a&gt; for free, or better yet can run it as a serverless website on &lt;a href="https://aws.amazon.com/s3/"&gt;Amazon S3&lt;/a&gt;. Serverless meaning, it’s not running on a web server since S3 can host static files. In addition, you can take advantage of &lt;a href="https://aws.amazon.com/cloudfront/?nc2=h_m1"&gt;Cloudfront&lt;/a&gt; for its content distribution to speed up your website, and give it high availability.&lt;/p&gt;</description></item><item><title>aws and vmware</title><link>http://uly.me/posts/aws-and-vmware/</link><pubDate>Wed, 19 Jul 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/aws-and-vmware/</guid><description>&lt;p&gt;AWS plans to run VMWare virtualization software on top of AWS cloud sometime in the near future. Some reports the joint project to start in mid-2017, but others are saying as late as early 2018. The project is the result of the hybrid cloud partnership announced in the fall of last year. The deal will bolster both companies with AWS most likely attracting more customers and VMWare retaining its customer base as the partnership becomes a reality in the next few months.&lt;/p&gt;</description></item><item><title>ssh to a docker container</title><link>http://uly.me/posts/ssh-to-a-docker-container/</link><pubDate>Wed, 24 May 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ssh-to-a-docker-container/</guid><description>&lt;p&gt;Docker containers are awesome. Docker allows you to quickly create development environments in a matter of minutes. Docker gives you the ability to package, ship and share your docker image to anyone. Once your docker image is on the Docker repository, anyone can pull it down and run it on their own operating system.&lt;/p&gt;
&lt;p&gt;To keep track of running containers on your system, you can type ‘docker ps -a’ on your terminal.&lt;/p&gt;</description></item><item><title>start ec2 ami from aws cli</title><link>http://uly.me/posts/start-ec2-ami-from-aws-cli/</link><pubDate>Wed, 24 May 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/start-ec2-ami-from-aws-cli/</guid><description>&lt;p&gt;Amazon Web Services has an API via a CLI (command line interface) which give users the ability to manage servers from a remote host. The AWS CLI must be installed and authenticated to AWS on the host computer. Once a user is logged in to AWS, they can perform certain management tasks such as starting and stopping EC2 instances.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How to start EC2 instance from AWS CLI&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Requires an image id, instance count, instance type, key and security group.&lt;/p&gt;</description></item><item><title>jq proccessor</title><link>http://uly.me/posts/jq-proccessor/</link><pubDate>Fri, 19 May 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/jq-proccessor/</guid><description>&lt;p&gt;The AWS CLI spits out a JSON output after each successful execution. If you need to grab the result, assign it to a variable, and use it for your subsequent scripts, you need some kind of JSON parser. You can use a tool like jq which will process or filter out the result for you. From jq’s &lt;a href="https://stedolan.github.io/jq/"&gt;website&lt;/a&gt;,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;jq is a tool for processing JSON inputs, applying the given filter to its JSON text inputs and producing the filter’s results as JSON on standard output. The simplest filter is ., which is the identity filter, copying jq’s input to its output unmodified (except for formatting).&lt;/p&gt;</description></item><item><title>install boto3 aws sdk for python</title><link>http://uly.me/posts/install-boto3-aws-sdk-for-python/</link><pubDate>Thu, 18 May 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-boto3-aws-sdk-for-python/</guid><description>&lt;p&gt;Boto3 is the Amazon Web Services (AWS) SDK for Python, which allows Python developers to write software that makes use of Amazon services like S3 and EC2. Boto provides an easy to use, object-oriented API as well as low-level direct service access.&lt;/p&gt;
&lt;p&gt;To install on Mac&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo easy_install pip
sudo pip install —ignore-installed six boto3
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You need to set up your credentials and config file to authenticate to AWS first. The files are:&lt;/p&gt;</description></item><item><title>multisite to single site</title><link>http://uly.me/posts/multisite-to-single-site/</link><pubDate>Wed, 10 May 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/multisite-to-single-site/</guid><description>&lt;p&gt;I have a couple of WordPress blogs that are running multisite. I decided I don’t need the other blogs. So, I converted both sites to the standard or single WordPress site. The good news is that there’s no need to reinstall WordPress. It requires just a simple edit of a couple of WordPress files. The conversion was not as bad as I initially thought. Just follow the steps below.&lt;/p&gt;
&lt;p&gt;5 Easy Steps&lt;/p&gt;</description></item><item><title>starting and stopping services</title><link>http://uly.me/posts/starting-and-stopping-services/</link><pubDate>Wed, 10 May 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/starting-and-stopping-services/</guid><description>&lt;p&gt;Linux is quite stable, but there are times that you may have to restart an application or a service after a configuration change. For the change to take effect, a restart of a service is required. The good news is starting and stopping services in Linux are quite easy.&lt;/p&gt;
&lt;p&gt;The old way.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Starting and stopping MySQL
$ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql restart
# Starting and stopping Apache
$ sudo /etc/init.d/apache2 start
$ sudo /etc/init.d/apache2 stop
$ sudo /etc/init.d/apache2 restart
# Starting and stopping the network
$ sudo /etc/init.d/networking start
$ sudo /etc/init.d/networking stop
$ sudo /etc/init.d/networking restart
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Via service for Debian|Ubuntu distros&lt;/p&gt;</description></item><item><title>comparing time</title><link>http://uly.me/posts/comparing-time/</link><pubDate>Tue, 09 May 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/comparing-time/</guid><description>&lt;p&gt;Here’s a neat little PHP script that compares a set date/time to the current time. The time() function sets the $now variable to the current Unix timestamp. The strtotime() function converts a date string to a Unix timestamp. The result is assigned to the $setdate variable. The two variables containing Unix timestamps are then compared. A simple if-then statement determines if the date is in the past or future.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;date_default_timezone_set(&amp;#39;America/Los_Angeles&amp;#39;);
$setdate = strtotime(&amp;#34;May 9, 2017 12:27PM&amp;#34;);
$now = time();
if ( $setdate &amp;gt; $now ) : echo &amp;#39;Future date&amp;#39;; else : echo &amp;#39;Past date&amp;#39;; endif;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You may have to change the default timezone if your server is in a different timezone.&lt;/p&gt;</description></item><item><title>resize window to any resolution</title><link>http://uly.me/posts/resize-window-to-any-resolution/</link><pubDate>Tue, 09 May 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/resize-window-to-any-resolution/</guid><description>&lt;p&gt;If you record videos of your desktop, especially the Terminal, it’s a challenge to get your window to fit properly in a 16:9 format. Without the proper tool, eyeballing a window to fit a certain resolution is a difficult task to do.&lt;/p&gt;
&lt;p&gt;One of the tools I use to set my window to a resolution that I want is to use my browser as a guide. There are several websites out there that allow you to set your browser to any size or resolution. Head over to &lt;a href="http://resizemybrowser.com/"&gt;resizemybrowser.com&lt;/a&gt;. They have several presets in varying resolutions.&lt;/p&gt;</description></item><item><title>install aws cli on ubuntu</title><link>http://uly.me/posts/install-aws-cli-on-ubuntu/</link><pubDate>Mon, 24 Apr 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-aws-cli-on-ubuntu/</guid><description>&lt;p&gt;The advantage of running Amazon Linux on AWS is that you already have the AWS CLI (command line interface) loaded as part of the image. In addition, Amazon Linux has rolling updates. It means you don’t have to perform major upgrades as you go to from one version to another. It’s all part of the process when you perform periodical updates. However, if you’re running Ubuntu, it’s no slouch. It’s a popular distro which many administrators have chosen to use due to its simplicity and robust repository. So, if you’re running Ubuntu, you might want to install the AWS CLI to give you the tools you need similar to what Amazon Linux has. Here’s how to install AWS CLI on Ubuntu.&lt;/p&gt;</description></item><item><title>ubuntu server timezone</title><link>http://uly.me/posts/ubuntu-server-timezone/</link><pubDate>Mon, 24 Apr 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ubuntu-server-timezone/</guid><description>&lt;p&gt;If you want to run a couple of cron jobs, you may need to check if your server is using your timezone. You can determine the server’s timezone by simply typing the system’s date command. You’ll see right away if your server is using the same timezone.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ date
Sun Apr 23 21:21:24 PDT 2017
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If it isn’t, then you need to change it so it’s in sync with cron jobs. To change timezone, run dpkg-reconfigure tzdata. You’ll be asked to choose a region and the nearest city. In this example, I’m picking the Americas/Los Angeles combination. Choose your own region and city.&lt;/p&gt;</description></item><item><title>sass basics</title><link>http://uly.me/posts/sass-basics/</link><pubDate>Thu, 06 Apr 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sass-basics/</guid><description>&lt;p&gt;If you use CSS, it can sometimes get repetitive. One way of streamlining your code is to use Sass. Sass is a CSS extension that gives users power and elegance. Sass allows the use of variables, nested rules, mixins, inline imports, and many more in your code by cutting down on some repetitive tasks. Let me show you how it’s done. Below is an example of how to use Sass using variables.&lt;/p&gt;</description></item><item><title>ubuntu switching to gnome</title><link>http://uly.me/posts/ubuntu-switching-to-gnome/</link><pubDate>Wed, 05 Apr 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ubuntu-switching-to-gnome/</guid><description>&lt;p&gt;Canonical made announcement today that it’s planning to do away with its Unity Desktop starting with the Ubuntu 18.04 release. Don’t worry, Canonical is not doing away with its own Linux Desktop. This means they are not going to develop anymore of its Unity Desktop environment. The Ubuntu desktop will be switching back to the Gnome desktop, which was its default desktop environment before going with Unity six years ago.&lt;/p&gt;</description></item><item><title>nextcloud install</title><link>http://uly.me/posts/nextcloud-install/</link><pubDate>Thu, 23 Mar 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nextcloud-install/</guid><description>&lt;p&gt;NextCloud is an open-source next-generation file sharing and file synching web-application that you can run and install on your own Linux server. It’s similar to Dropbox, the file-sharing cloud application. The big difference between Dropbox and NextCloud is that you get to run your own cloud storage on your own server. The following are instructions on how to install NextCloud on an Ubuntu Server 16.04 LTS server.&lt;/p&gt;
&lt;p&gt;Run Updates First&lt;/p&gt;</description></item><item><title>quick database check</title><link>http://uly.me/posts/quick-database-check/</link><pubDate>Fri, 17 Mar 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/quick-database-check/</guid><description>&lt;p&gt;Here’s a quick PHP script to check if your web server can connect to your MySQL database. It’s a neat little script if you don’t have any application installed yet, and you just want to see if your web server setup can quickly connect to the database. All you have to do is create a new file called connect.php, and place the following code inside. Just change the username, password and database. Most likely the hostname will be localhost.&lt;/p&gt;</description></item><item><title>laravel 5.4 install</title><link>http://uly.me/posts/laravel-5-4-install/</link><pubDate>Thu, 16 Mar 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/laravel-5-4-install/</guid><description>&lt;p&gt;This is the installation of Laravel 5.4 on an Ubuntu Server 16.04 LTS. Laravel requires that you run Apache, MySQL and PHP. In this installation, I’m using the following versions: Apache 2.4.18, MySQL 5.7.17 and PHP 7.0.15. The installation of Laravel has changed over the years. I wished the installation was simpler. You can try Forge, but it’s not free. It also requires that you have an account at Linode, Digital Ocean or AWS. Forge costs $15 per month and Forge Plus is $30 per month. If you don’t want to pay, I’m afraid you are going to have to install Laravel yourself. Laravel installation may vary based on the distro you’re using. These instructions are for the Ubuntu Server 16.04 LTS.&lt;/p&gt;</description></item><item><title>working with aws lightsail</title><link>http://uly.me/posts/working-with-aws-lightsail/</link><pubDate>Tue, 14 Mar 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/working-with-aws-lightsail/</guid><description>&lt;p&gt;Just a quick demo how to work with AWS LightSail. LightSail is AWS lightweight VPS at a fixed price point. You can install just the OS. You can choose either Amazon Linux or Ubuntu OS. If you prefer, you can install any of the several ready-made applications provided by AWS in conjunction with Bitnami. In this example, I installed Ubuntu and Apache just demonstrate how to easy it is to work with LightSail.&lt;/p&gt;</description></item><item><title>where featured images are stored</title><link>http://uly.me/posts/where-featured-images-are-stored/</link><pubDate>Fri, 10 Mar 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/where-featured-images-are-stored/</guid><description>&lt;p&gt;The WordPress Genesis theme uses featured images on its posts on several of its themes. If you’re curious as to where the Genesis theme stores the image links on the database, you’ll need to go to a couple of WordPress tables to find them. First and foremost, you’ll need to get the ID of your WordPress post. You can easily find this by hovering over the edit link and checking the ID number.&lt;/p&gt;</description></item><item><title>mass find and replace</title><link>http://uly.me/posts/mass-find-and-replace/</link><pubDate>Thu, 09 Mar 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mass-find-and-replace/</guid><description>&lt;p&gt;There are situations when you have to do a mass find and replace on your database. Let’s say you’re really, really bad speller. You just recently found out that you’ve been spelling a word for wrongly for years. To avoid embarrassment, you decide to do a search and replace. Unfortunately, you found out that there are hundreds of posts that contains that misspelled word. Instead of editing each post which is time consuming, you decide to run a mass find and replace against the database. In this example, we will replace the word ‘dawg’ with ‘dog.’&lt;/p&gt;</description></item><item><title>wordpress mobile detect</title><link>http://uly.me/posts/wordpress-mobile-detect/</link><pubDate>Thu, 09 Mar 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-mobile-detect/</guid><description>&lt;p&gt;I found this little nugget in the &lt;a href="https://codex.wordpress.org/Function_Reference/wp_is_mobile"&gt;WordPress Codex&lt;/a&gt; called wp_is_mobile(). It will detect the user browser’s agent and will return a true or a false if it’s a mobile device. This is helpful if you would like to customized code specifically for a mobile device. Let’s say you have a media player and you want it to have a specific width for desktops and another width for mobile devices. So, here’s the code to detect if it’s a mobile device.&lt;/p&gt;</description></item><item><title>not marked for formatting</title><link>http://uly.me/posts/not-marked-for-formatting/</link><pubDate>Wed, 01 Mar 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/not-marked-for-formatting/</guid><description>&lt;p&gt;I have a Linux box with a 1TB drive. I divided it into 4 different partitions at 250GB each. It’s currently running Linux Mint, Gitlab, Nextcloud and the Unifi Cloud Controller on each partition. Obviously, I can’t run all 4 partitions at the same time. I have to choose one from a selection in the Grub, a multi-boot loader. It would have been easier to run Virtualbox on just one Linux install, but it’s older CPU. I don’t think it could handle multiple OS running at the same time.&lt;/p&gt;</description></item><item><title>display octal permissions</title><link>http://uly.me/posts/display-octal-permissions/</link><pubDate>Sun, 26 Feb 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-octal-permissions/</guid><description>&lt;p&gt;If you’re working on the command line, listing a directory to display permissions of files is not always the most user-friendly. Here’s an example of listing the files in a directory using the ‘ls -al’ command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ ls -al
total 20
drwxrwsr-x 2 ulysses www-data 4096 Feb 26 13:31 .
drwxrwsr-x 10 ulysses www-data 4096 Feb 26 02:30 ..
-rw-rw-r-- 1 ulysses www-data 0 Feb 26 13:31 display.txt
-rwxrwxr-x 1 ulysses ulysses 659 Dec 3 06:40 sync_com.sh
-rw-r--r-- 1 ulysses ulysses 181 Feb 26 13:26 sync_db.sh
-rwxrwxr-x 1 ulysses ulysses 244 Feb 26 13:23 sync_s3.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There has to be a better way to display permissions?&lt;/p&gt;</description></item><item><title>how to rotate apache logs</title><link>http://uly.me/posts/how-to-rotate-apache-logs/</link><pubDate>Wed, 15 Feb 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/how-to-rotate-apache-logs/</guid><description>&lt;p&gt;Apache comes with a logrotate utility. You can customize the way logrotate behaves by editing the /etc/logrotate.d/apache file. The logrotate utility has many options. In this example, we are rotating the log files that are located at the /var/www/domain.com/log/ directory. We are instructing the log files to rotate monthly for a total of 24 times. We are compressing the files by zipping them. We are using the date extension as part of the filename. We are also delaying the compression until the log has been rotated at least twice. Finally, Apache is restarted.&lt;/p&gt;</description></item><item><title>php vs node.js</title><link>http://uly.me/posts/php-vs-node-js/</link><pubDate>Thu, 09 Feb 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/php-vs-node-js/</guid><description>&lt;p&gt;If you would like to launch a new career as a front-end developer, which programming language would you choose? You have multiple options, but nothing could be as popular as PHP and Node.js. An &lt;a href="http://www.computerworld.com/article/3167857/application-development/php-vs-nodejs-epic-battle-for-developer-mind-share.html"&gt;article&lt;/a&gt; from ComputerWorld examines the strengths and weaknesses of both languages. Each language has their own pluses and minuses. PHP is simpler, with a deeper code base, easy access to databases, and it’s boosted by HHVM and the Hack language. Node.js is based on Javascript with thinner service calls. It works with JSON, and raw speed is unparalleled. Both languages has it’s own MVC frameworks. Perhaps, a hybrid solution of PHP and Node.js might be the best approach on some projects. It really depends on what you’re trying to achieve. If you want to code fast, you may choose PHP. If application raw speed is in order, then you may want to consider using Node.js.&lt;/p&gt;</description></item><item><title>grub customizer</title><link>http://uly.me/posts/grub-customizer/</link><pubDate>Wed, 08 Feb 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/grub-customizer/</guid><description>&lt;p&gt;Grub is a menu program that allows Linux users the ability to choose from a multi-boot system. The original Grub program allowed administrators the ability to edit the menu listing from the command line. Sadly, when Grub 2 was implemented, editing files no longer had the same effect. The files are being overwritten by the system. Any changes to the menu listing file is discarded.&lt;/p&gt;
&lt;p&gt;What’s the fix?&lt;/p&gt;
&lt;p&gt;One of the easiest way customize the Grub 2 menu listing is to use an application called Grub Customizer.&lt;/p&gt;</description></item><item><title>gitlab community edition</title><link>http://uly.me/posts/gitlab-community-edition/</link><pubDate>Tue, 07 Feb 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gitlab-community-edition/</guid><description>&lt;p&gt;&lt;a href="https://git-scm.com/"&gt;Git&lt;/a&gt; is the most popular version control software for managing your code. If you’re looking for the best version control system out there, Git is the pretty much the de-facto standard of version control. Although you can run Git locally without a server, you’ll need some kind of repository to share your code with others.&lt;/p&gt;
&lt;p&gt;Enter &lt;a href="http://github.com"&gt;Github&lt;/a&gt;. Github provide free and paid Git repositories. Github public repositories are free, while private ones require subscription. For $7 dollars a month, you can have up to 5 private repositories. For $50 per month, you can use up to 50 repositories.&lt;/p&gt;</description></item><item><title>fix wordpress permissions</title><link>http://uly.me/posts/fix-wordpress-permissions/</link><pubDate>Wed, 25 Jan 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fix-wordpress-permissions/</guid><description>&lt;p&gt;Here’s the recommended permissions for &lt;a href="https://codex.wordpress.org/Hardening_WordPress"&gt;WordPress&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id="permissions"&gt;Permissions&lt;/h4&gt;
&lt;p&gt;Directories = 755&lt;br&gt;
Files = 644&lt;/p&gt;
&lt;h4 id="install-from-scratch"&gt;Install From Scratch&lt;/h4&gt;
&lt;p&gt;If you’re starting from scratch, follow the instructions below.&lt;/p&gt;
&lt;p&gt;Assuming you’re logged in as normal user. Use sudo to execute commands as superuser.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
sudo chown -R www-data:www-data wordpress
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id="fix-current"&gt;Fix Current&lt;/h4&gt;
&lt;p&gt;If your permissions are wrong, then perform the following.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \
sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>nextcloud</title><link>http://uly.me/posts/nextcloud/</link><pubDate>Tue, 24 Jan 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nextcloud/</guid><description>&lt;p&gt;Nextcloud is the next generation open source file storage and file synching platform. It’s similar to Dropbox, Google Drive and Microsoft OneDrive. The main difference is that you run the software on your own server. This is a perfect solution if you’re worried about mass surveillance. It’s safe enough to place on the cloud. Better yet, you can run it on your local network at home. It behaves somewhat similar to a NAS (Network Attached Storage) but with a better web interface, and a few more apps.&lt;/p&gt;</description></item><item><title>packages have been kept back</title><link>http://uly.me/posts/packages-have-been-kept-back/</link><pubDate>Tue, 24 Jan 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/packages-have-been-kept-back/</guid><description>&lt;p&gt;What do you do when you get this message “the following packages are being kept back.” And what exactly does it mean?&lt;/p&gt;
&lt;p&gt;When performing updates in Ubuntu, you typically run these two commands from the command line.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo apt-get update
$ sudo apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If there are updates, it will sometimes ask you to type “Y” or “yes.”&lt;/p&gt;
&lt;p&gt;Sometimes you get this message.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-headers-server linux-image-server linux-server
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This means that these packages were not installed or kept back because they have additional packages that are introduced, and the upgrades depend on them.&lt;/p&gt;</description></item><item><title>how to live stream using ffmpeg</title><link>http://uly.me/posts/how-to-live-stream-using-ffmpeg/</link><pubDate>Mon, 09 Jan 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/how-to-live-stream-using-ffmpeg/</guid><description>&lt;p&gt;FFmpeg is a complete cross-platform command-line tool for recording, converting and streaming audio and video files. FFmpeg is widely used for converting files from one format to another. It also used by some to record videos from the screen or camera. It’s also used by others to live stream a recorded file or camera to a RTMP streaming server such as Wowza, YouTube or Facebook Live.&lt;/p&gt;
&lt;p&gt;How to record your camera to a video file.&lt;/p&gt;</description></item><item><title>homebrew</title><link>http://uly.me/posts/homebrew/</link><pubDate>Sun, 08 Jan 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/homebrew/</guid><description>&lt;p&gt;Homebrew is the missing package manager for the Mac OS. It’s missing because the MacOS doesn’t have one. Homebrew is the MacOS equivalent of apt-get or aptitude in Ubuntu Linux. With Homebrew installed on your MacOS, you can easily install and uninstall programs, packages, and utilities via the command line. For example, to install the wget, apache, git and ffmpeg, you can run the following commands from the Terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ brew install wget
$ brew install apache
$ brew install git
$ brew install ffmpeg
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you don’t have Homebrew installed, run the following command from the Terminal.&lt;/p&gt;</description></item><item><title>the in_category function</title><link>http://uly.me/posts/the-in_category-function/</link><pubDate>Sun, 08 Jan 2017 00:00:00 +0000</pubDate><guid>http://uly.me/posts/the-in_category-function/</guid><description>&lt;p&gt;If you’re looking for a simple way to detect if a WordPress page belongs to a certain category, you can use a WordPress function called in_category(). In this example code below, the script will detect if a post belongs to the “news” category. If it does, it will send an output to the WordPress header. If it isn’t, it will send an alternate output.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function urr_add_to_header()
{
if ( in_category( &amp;#39;news&amp;#39; ))
{
echo &amp;#39;&amp;lt;script&amp;gt;Add your news Javascript here&amp;lt;/script&amp;gt;&amp;#39;;
} else {
echo &amp;#39;&amp;lt;script&amp;gt;Add your alternate Javascript here&amp;lt;/script&amp;gt;&amp;#39;;
}
}
add_action( &amp;#39;wp_head&amp;#39;, &amp;#39;urr_add_to_header&amp;#39;, 100 );
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It’s a simple function that has many uses. You can accomplish quite a bit with the in_category() function along with a few WordPress hooks.&lt;/p&gt;</description></item><item><title>secure copy</title><link>http://uly.me/posts/secure-copy/</link><pubDate>Fri, 30 Dec 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/secure-copy/</guid><description>&lt;p&gt;If you’re logged in to a server via SSH, you can securely copy a file using SCP command tool or also known as “secure copy” to your local desktop, and vice versa. SCP uses SSH for data transfer, authentication and security. Here are several examples on how to use the SCP command line tool if you would like to securely transfer a file to and from your server. You’ll be asked for the user’s password for authentication.&lt;/p&gt;</description></item><item><title>install s3cmd on mac</title><link>http://uly.me/posts/install-s3cmd-on-mac/</link><pubDate>Thu, 29 Dec 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-s3cmd-on-mac/</guid><description>&lt;p&gt;Previously, I wrote about installing and accessing Amazon S3 (Simple Storage Service) from &lt;a href="http://uly.me/install-s3cmd-on-ubuntu/"&gt;Ubuntu&lt;/a&gt; using s3cmd command line tool. Interestingly enough, the S3cmd command line tool is also available on the Mac, since MacOS is based on NeXT, which was based on BSD, which is a major variant of Unix. Anyways, you can install s3cmd on the Mac so you can access to Amazon S3 via the command line.&lt;/p&gt;
&lt;p&gt;How to Install&lt;/p&gt;</description></item><item><title>override wordpress video dimensions</title><link>http://uly.me/posts/override-wordpress-video-dimensions/</link><pubDate>Fri, 23 Dec 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/override-wordpress-video-dimensions/</guid><description>&lt;p&gt;WordPress comes with its own media player. It supports M4a, MP4, OGG, WebM, FLV, WMV, MP3, WAV and WMA formats. In addition, you can also embed videos from a dozen external sites such as YouTube, Vimeo, etc. WordPress will automatically embed the video when you add it to your post. You can change the dimensions of your videos by overriding the width and the height of the media player.&lt;/p&gt;
&lt;p&gt;Edit the functions.php file, and add the following code.&lt;/p&gt;</description></item><item><title>ghost blogging platform</title><link>http://uly.me/posts/ghost-blogging-platform/</link><pubDate>Sun, 04 Dec 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ghost-blogging-platform/</guid><description>&lt;p&gt;I wanted to try Ghost, a CMS and blogging platform, which is an alternative for WordPress. Unlike WordPress which runs on PHP, Ghost runs on top of Node.js, a fast, scalable and extremely efficient Javascript runtime platform. Ember.js is used for the administration area making for a slick and smooth user experience. Ghost uses Handlebars, a powerful and logicless templating language.&lt;/p&gt;
&lt;p&gt;Installation of Ghost on Digital Ocean is a breeze since there’s already a one-click Ghost app available from a list of ready-to-made list of app images. You can get a Ghost site up and running in less than 2 minutes.&lt;/p&gt;</description></item><item><title>wordpress on docker</title><link>http://uly.me/posts/wordpress-on-docker/</link><pubDate>Mon, 28 Nov 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-on-docker/</guid><description>&lt;p&gt;WordPress is a content management system for running blogs or websites. Meanwhile, Docker is a software container platform for building, shipping and running applications or utilities. Since there are thousands of Docker images already built, installing an application such as WordPress is fairly easy. In this article, I will show you how to install WordPress, MySQL, PHPMyadmin in a Docker environment. First things first, install Docker. Docker is agnostic, meaning it really doesn’t matter what platform you use, whether you’re on Windows, Linux or the Mac. Download Docker &lt;a href="https://www.docker.com/products/overview"&gt;Docker&lt;/a&gt;. Install.&lt;/p&gt;</description></item><item><title>missing add-apt-repository command</title><link>http://uly.me/posts/missing-add-apt-repository-command/</link><pubDate>Sun, 13 Nov 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/missing-add-apt-repository-command/</guid><description>&lt;p&gt;When adding a new repository in Ubuntu, you can go the PPA route by using the add-apt-repository command. If you’re getting a missing add-apt-repository command, it’s probably not installed. You need to install the “software-properties-common” and “python-software-properties” packages from the Terminal. By the way, if you’re curious, PPA means personal package archive. PPAs are repositories hosted on Launchpad which you can use to install or upgrade packages that are not available in the official Ubuntu repositories. Just think of them as extended repositories.&lt;/p&gt;</description></item><item><title>check open ports</title><link>http://uly.me/posts/check-open-ports/</link><pubDate>Wed, 09 Nov 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/check-open-ports/</guid><description>&lt;p&gt;If you’re running a Linux server, here’s one way of checking as to which ports are open to the public. You can use netstat for that purpose. Netstat is a command-line network utility tool that displays network connections for tcp, routing tables, and a number of network interfaces. It’s available on Linux, MacOS and Windows.&lt;/p&gt;
&lt;p&gt;In Linux and MacOS, type the following via the Terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;netstat -tupln
#
# -l = only services which are listening on some port
# -n = show port number, don&amp;#39;t try to resolve the service name
# -t = tcp ports
# -u = udp ports
# -p = name of the program
#
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you’re in Windows, open up Powershell and type in:&lt;/p&gt;</description></item><item><title>could not empty the trash can</title><link>http://uly.me/posts/cant-empty-the-trash-can/</link><pubDate>Wed, 09 Nov 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cant-empty-the-trash-can/</guid><description>&lt;p&gt;If you have trouble emptying the trash this morning, here’s a helpful tip.&lt;/p&gt;
&lt;p&gt;Your OS is essentially telling you the file is in use, but the application is close.&lt;/p&gt;
&lt;p&gt;Nothing like running rm -rf on the trash folder.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Go the trash directory and delete all!
cd ~/.Trash
rm -rf *
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The file is gone!&lt;/p&gt;</description></item><item><title>implementing surfcali.com</title><link>http://uly.me/posts/implementing-surfcali-com/</link><pubDate>Sun, 06 Nov 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/implementing-surfcali-com/</guid><description>&lt;p&gt;I have a website called Surfcali.com. It’s a website that provides tide table information for select California beaches. The tide information on the website is auto-generated by the xtide program which is available on most Linux distributions.&lt;/p&gt;
&lt;p&gt;You can install xtide on Ubuntu by typing this command from the Terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get install xtide
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Instead of explaining how the website is implemented using lots of words, it’s probably much easier to explain it via video.&lt;/p&gt;</description></item><item><title>optimize your videos for the web</title><link>http://uly.me/posts/optimize-your-videos-for-the-web/</link><pubDate>Sun, 06 Nov 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/optimize-your-videos-for-the-web/</guid><description>&lt;p&gt;If you have a video that you would like to share with others, how do you optimize it for the web. I’m using a simple open-source program called Handbrake which you can download for free. It’s available from &lt;a href="http://handbrake.fr"&gt;handbrake.fr&lt;/a&gt;. Handbrake is available on Windows, Mac and Linux. Based on my experience with working with Handbrake, I was able to shrink my videos to less than 10% of the original size without sacrificing quality.&lt;/p&gt;</description></item><item><title>app store blank screen</title><link>http://uly.me/posts/app-store-blank-screen/</link><pubDate>Thu, 13 Oct 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/app-store-blank-screen/</guid><description>&lt;p&gt;The App Store on my iPad was displaying a white blank screen. I’m not sure what caused it.&lt;/p&gt;
&lt;p&gt;It may have been my router. It stopped giving out dynamic IP addresses. For some reason it affected the App Store.&lt;/p&gt;
&lt;p&gt;The only way I was able to fix it, was to go to my iPad’s &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; and select &lt;strong&gt;iTunes &amp;amp; App Store&lt;/strong&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Click on the Apple ID (email address) and then &lt;strong&gt;Sign Out&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reboot&lt;/strong&gt; the iPad.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Once the iPad has rebooted, the App Store started working again. Weird.&lt;/p&gt;</description></item><item><title>css white-space property</title><link>http://uly.me/posts/css-white-space-property/</link><pubDate>Tue, 20 Sep 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/css-white-space-property/</guid><description>&lt;p&gt;Whitespace, line breaks, spaces and tabs are collapsed by default in HTML documents. To add space, we can add “&amp;amp;nbsp;” which translates to space, to add some separation between elements. In addition &amp;lt;br/&amp;gt; or line breaks can also be utilized to add space. There is a HTML property called &lt;strong&gt;white-space&lt;/strong&gt; which can be used to configure how the whitespace inside the element is displayed. The following is a list of whitespace options.&lt;/p&gt;</description></item><item><title>how to zebra stripe a table</title><link>http://uly.me/posts/how-to-zebra-stripe-a-table/</link><pubDate>Sun, 18 Sep 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/how-to-zebra-stripe-a-table/</guid><description>&lt;p&gt;A HTML table can be difficult to read, especially if there are hundreds of rows. Reading across a row can sometimes be a challenge. One way of making the table more legible is to alternate the background color of each row. By the way, the plugin used on this blog to display code uses zebra stripes. Zebra stripping can be done by toggling a variable and alternately displaying an odd or even CSS class as it goes through the loop.&lt;/p&gt;</description></item><item><title>wp-cli</title><link>http://uly.me/posts/wp-cli/</link><pubDate>Wed, 14 Sep 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wp-cli/</guid><description>&lt;p&gt;WP-CLI is a set of command-line tools for managing WordPress websites. With just a few simple commands, you can manage WordPress from the command line without the need to login to the Admin Dashboard and navigate the pages. You can install, update and delete plugins and themes, perform backups, configure standard and multisite installs and much more — all without ever using a web browser.&lt;/p&gt;
&lt;p&gt;How to install WP-CLI&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Make WP-CLI Executable&lt;/p&gt;</description></item><item><title>password protect phpmyadmin</title><link>http://uly.me/posts/password-protect-phpmyadmin/</link><pubDate>Fri, 09 Sep 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/password-protect-phpmyadmin/</guid><description>&lt;p&gt;phpMyAdmin is an open-source MySQL database administration application written in PHP. The software allows database administrators, web administrators, application programmers to perform several database functions via the browser. Functions such as browse and drop databases and tables, views fields and indexes, create, copy, drop, rename and alter databases, tables, fields and indexes, perform queries, update and delete, to name just a few.&lt;/p&gt;
&lt;p&gt;Since phpMyAdmin has direct access to your database, it needs to be secure. By default, phpMyAdmin is secured using it’s built-in login feature. If you like to make it even more secure, you can add .htaccess password protection to it by simply adding .htaccess file to the phpmyadmin pages and creating username and password file to go along with it. The following instructions will show you how to add .htaccess protection to phpMyAdmin.&lt;/p&gt;</description></item><item><title>passing variables using session</title><link>http://uly.me/posts/passing-variables-using-session/</link><pubDate>Thu, 18 Aug 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/passing-variables-using-session/</guid><description>&lt;p&gt;Passing variables via the URL in PHP can be dangerous. This is the case if you don’t properly filter and sanitize your inputs. This could lead to potential database exploits via SQL injections. If you are using a download script, someone might be able traverse your directories and gain access to your system files. After all, you don’t want anyone looking at your passwd file. Back to PHP, it’s ideal if that we avoid passing variables via URL. We can use sessions.&lt;/p&gt;</description></item><item><title>viewable by admin only</title><link>http://uly.me/posts/viewable-by-admin-only/</link><pubDate>Mon, 08 Aug 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/viewable-by-admin-only/</guid><description>&lt;p&gt;This article will show you how to make a WordPress Page viewable by the admin only. This is really quite handy if you’re creating a custom WordPress Template. You can make certain parts or the entire page viewable by the admin only by placing the code below in your WordPress Page Template.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if ( current_user_can( &amp;#39;manage_options&amp;#39; ) ) {
// display text here for user with admin privilege
} else {
// display text here for user without admin privilege
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There has been some confusion whether to use &lt;a href="https://codex.wordpress.org/Function_Reference/is_admin"&gt;is_admin()&lt;/a&gt; instead of &lt;a href="https://codex.wordpress.org/Function_Reference/current_user_can"&gt;current_user_can(‘manage_options’)&lt;/a&gt;. is_admin() is a conditional to check if the user is in the Dashboard or in the Administration Panel. It’s just a boolean conditional that will return true if the URL being accessed is in the admin section.&lt;/p&gt;</description></item><item><title>dual booting ubuntu and mint</title><link>http://uly.me/posts/dual-booting-ubuntu-and-mint/</link><pubDate>Fri, 05 Aug 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/dual-booting-ubuntu-and-mint/</guid><description>&lt;p&gt;I’ve been using the Mac OS for six years now. Prior to that, I was an Ubuntu user for 10 years. I do miss working with Linux. Part of the reason I switched, I was tired of constantly fixing the Ubuntu desktop. Every time there was a new release, something was broken and I needed to fix it. Then Ubuntu Unity desktop came along. That essentially was the last straw. I dabbled with Mint a little bit, but it only lasted for a couple of months.&lt;/p&gt;</description></item><item><title>how to force downloads</title><link>http://uly.me/posts/how-to-force-downloads/</link><pubDate>Sun, 24 Jul 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/how-to-force-downloads/</guid><description>&lt;p&gt;Browsers behave differently when it comes to linking media files. Sometimes it will play them directly on the browser. Sometimes it will download them. Each browser seems to have their own rules. So, how do we force all browsers to download media files with just a click of a link.&lt;/p&gt;
&lt;p&gt;A simple link like the one below simply won’t work.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;a href=&amp;#34;video.mp4&amp;#34;&amp;gt;Download&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;One way of forcing downloads is to use a &lt;a href="http://php.net"&gt;PHP&lt;/a&gt; function called &lt;a href="http://php.net/manual/en/function.readfile.php"&gt;readfile&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>install exim4 on ubuntu server</title><link>http://uly.me/posts/install-exim4-on-ubuntu-server/</link><pubDate>Fri, 22 Jul 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-exim4-on-ubuntu-server/</guid><description>&lt;p&gt;Exim4 is a MTA or message transfer agent that runs on Linux systems. It’s freely available under GNU Linux. If you need to run mail from a server or send an email through an app, you’ll need to install Exim4. It can be installed in place of Sendmail or Postfix.&lt;/p&gt;
&lt;p&gt;To install Exim4, open up your Terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo apt install exim4
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Configure Exim4.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo dpkg-reconfigure exim4-config
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You’ll be asked several questions.&lt;/p&gt;</description></item><item><title>remove cleanmymac</title><link>http://uly.me/posts/remove-cleanmymac/</link><pubDate>Tue, 19 Jul 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-cleanmymac/</guid><description>&lt;p&gt;Several months ago, I’ve installed an app called &lt;a href="http://macpaw.com/cleanmymac"&gt;CleanMyMac&lt;/a&gt;. Big mistake. I didn’t like it much. I deleted it shortly after. The uninstall didn’t quite exactly remove everything. This morning, I updated my computer with the latest Mac updates. It required a reboot. Sure enough, the CleanMyMac notifications came back. Apparently, there’s some pieces of the app that are still running on my machine.&lt;/p&gt;
&lt;p&gt;The only way I was able to delete anything related to the CleanMyMac app was to use a couple of tools. One is called &lt;a href="http://apps.tempel.org/FindAnyFile/"&gt;Find Any File&lt;/a&gt;, a handy utility for finding obscure files in your OS. The other is the handy tool called the &lt;a href="https://en.wikipedia.org/wiki/Terminal_(OS_X)"&gt;Terminal&lt;/a&gt;. Start with the Find Any File app and search for files that contain the words “CleanMyMac” and “macaw.” The Find Any File app will show you a list of files and their locations. You should be able to delete the files directly from the app. However, there are some files that are write-protected. They can be deleted using a sudo account on the Terminal.&lt;/p&gt;</description></item><item><title>the return of the linux desktop</title><link>http://uly.me/posts/the-return-of-the-linux-desktop/</link><pubDate>Tue, 19 Jul 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/the-return-of-the-linux-desktop/</guid><description>&lt;p&gt;I’m thinking about using the Linux desktop again after 4 years of inactivity. The &lt;a href="http://www.apple.com/osx/"&gt;MacOS&lt;/a&gt; was the desktop of choice. I’ve been happy with the switch. I don’t anticipate abandoning it any time soon. Lately I thought about sharpening up my Linux skills after having been dormant for years. I need a Linux platform that I can work with. &lt;a href="http://ubuntu.com"&gt;Ubuntu&lt;/a&gt; is my default, but there are other distros equally interesting. &lt;a href="https://www.linuxmint.com/"&gt;Mint&lt;/a&gt;, &lt;a href="https://www.debian.org/"&gt;Debian&lt;/a&gt; and &lt;a href="https://getfedora.org/"&gt;Fedora&lt;/a&gt; come to mind. Instead of having multiple boot partitions, I might install Ubuntu as the base distro and install &lt;a href="https://www.virtualbox.org/"&gt;Virtualbox&lt;/a&gt;. Other distros can be fired up as virtual machines. In that way, it’s simple to manage. I just need a heftier machine that can handle several VMs running at the same time. That’s the plan for the next several weeks.&lt;/p&gt;</description></item><item><title>change wordpress password</title><link>http://uly.me/posts/change-wordpress-password/</link><pubDate>Mon, 18 Jul 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-wordpress-password/</guid><description>&lt;p&gt;One of the worst things that could happen to your blog is losing your login credentials. It’s a rare event, but it does happen occasionally. This is particularly true if you run hundreds of blogs and websites. Keeping track of all usernames and passwords can be a bit of a challenge.&lt;/p&gt;
&lt;p&gt;If you have forgotten your WordPress password, you can quickly recover it, by using the “Lost your password” link underneath the login form. In my case, WordPress mail was not working. So, not only I can’t remember my password, but I also can’t send out lost passwords via email.&lt;/p&gt;</description></item><item><title>upgrading icecast2</title><link>http://uly.me/posts/upgrading-icecast2/</link><pubDate>Wed, 13 Jul 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/upgrading-icecast2/</guid><description>&lt;p&gt;The following instructions will perform the latest Icecast2 server upgrade on your Ubuntu Server via the PPA route.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Login to your Ubuntu Server via SSH. Substitute your own username and server.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ ssh ulysses@server.com
&lt;/code&gt;&lt;/pre&gt;&lt;ol start="2"&gt;
&lt;li&gt;Add Icecast2 PPA to your sources list. Since I’m running Ubuntu 12.04, I’ll use the 12.04 repository here.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo sh -c &amp;#34;echo deb http://download.opensuse.org/repositories/home:/dm8tbr/xUbuntu_12.04 ./ &amp;gt; /etc/apt/sources.list.d/icecast.list&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;ol start="3"&gt;
&lt;li&gt;Add the GPG key to the apt sources keyring. I’ll use the 12.04 release key here as well.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ wget -qO - http://download.opensuse.org/repositories/home:/dm8tbr/xUbuntu_12.04/Release.key | sudo apt-key add -
&lt;/code&gt;&lt;/pre&gt;&lt;ol start="4"&gt;
&lt;li&gt;Run Update to begin the upgrade process to the latest version of Icecast2.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ sudo apt-get update
$ sudo apt-get upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;ol start="5"&gt;
&lt;li&gt;
&lt;p&gt;The Icecast2 install script will run and ask you to overwrite your previous configuration. It’s up to you to keep or overwrite the file.&lt;/p&gt;</description></item><item><title>restarting nginx</title><link>http://uly.me/posts/restarting-nginx/</link><pubDate>Fri, 01 Jul 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/restarting-nginx/</guid><description>&lt;p&gt;Niginx is primarily a web server, but it can also run as a proxy server, load balancer and a HTTP cache.&lt;/p&gt;
&lt;p&gt;If you’re running on Debian, Ubuntu, Red Hat or CentOS, the following are several ways of restarting Nginx.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# /etc/init.d/nginx restart
# /etc/init.d/nginx reload
# service nginx restart
# service nginx reload
# nginx -s reload
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The last example is more universal and will run in any Linux flavor.&lt;/p&gt;</description></item><item><title>add files in wordpress without ftp</title><link>http://uly.me/posts/add-files-in-wordpress-without-ftp/</link><pubDate>Tue, 22 Mar 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-files-in-wordpress-without-ftp/</guid><description>&lt;p&gt;I’m working on a client site running WordPress but without any access to FTP. It’s an interesting dilemma because WordPress will allow you to add new themes and plugins via its interface. It does so by allowing you to upload zipped files of the themes and plugins. Obviously, you don’t want to keep doing this especially you want to add just one file to the theme.&lt;/p&gt;
&lt;p&gt;I needed to create a new page template on the Genesis platform. My client is using the Enterprise Pro child theme. There’s a command in PHP called ‘touch’ which allows you to create a new file. You can insert this command on the top of your theme’s header file in WordPress. Since I’m using Genesis, the child theme doesn’t have a header, therefore I had to do insert the command in the parent theme.&lt;/p&gt;</description></item><item><title>update php stable release on mac</title><link>http://uly.me/posts/update-php-stable-release-on-mac/</link><pubDate>Mon, 07 Mar 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/update-php-stable-release-on-mac/</guid><description>&lt;p&gt;PHP is installed by default on all Macs since OS X version 10.0.0. You can install and use MAMP, but if you prefer to use the pre-loaded version of PHP, then you may need to update it to the latest stable release. Fortunately, there’s a binary package out there that will simplify your life.&lt;/p&gt;
&lt;p&gt;If you like to install PHP 5.6 stable release, all you need to do is run the following from the command line:&lt;/p&gt;</description></item><item><title>editing a blob in phpmyadmin</title><link>http://uly.me/posts/editing-a-blob-in-phpmyadmin/</link><pubDate>Tue, 01 Mar 2016 00:00:00 +0000</pubDate><guid>http://uly.me/posts/editing-a-blob-in-phpmyadmin/</guid><description>&lt;p&gt;One of my projects this week requires editing a blob. A blob is a binary large object used primarily for storing images, audio and other media types in the database. Unfortunately, the application didn’t allow me to edit a blob. So off to the PHPMyAdmin I went. PHPMyAdmin is a MySQL administration tool.&lt;/p&gt;
&lt;p&gt;By default, the blob entries in PHPMyAdmin can’t be edited. Simple texts in blobs are sometimes scrambled. In order to make changes to the blob entries, we need to reconfigure PHPMyAdmin by editing the configuration file.&lt;/p&gt;</description></item><item><title>counting down the days</title><link>http://uly.me/posts/counting-down-the-days/</link><pubDate>Wed, 18 Nov 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/counting-down-the-days/</guid><description>&lt;p&gt;Today, I would like to share with you how to create a WordPress countdown plugin of a future date and time. The plugin output displays the number of days, hours, minutes and seconds left. The plugin uses a WordPress shortcode that you can insert inside your post. A Shortcode makes it easier to display results in WordPress.&lt;/p&gt;
&lt;p&gt;Output: [counting_down_the_days]&lt;/p&gt;
&lt;p&gt;Here’s the plugin code:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/*
Plugin Name: Counting Down the Days
Plugin URI: http://uly.me
Description: php countdown
Version: 1.0
Author: Ulysses Ronquillo
Author URI: http://uly.me
*/
// place your php code here
function urr_countdown_days() {
date_default_timezone_set(&amp;#39;Americas/New_York&amp;#39;);
$date = strtotime(&amp;#34;January 27, 2017 7:15 PM&amp;#34;);
$remaining = $date - time();
$days_remaining = floor($remaining / 86400);
$hours_remaining = floor(($remaining % 86400) / 3600);
$minutes_remaining = floor(($remaining-($days_remaining*60*60*24)-($hours_remaining*60*60))/60);
$seconds_remaining = floor(($remaining-($days_remaining*60*60*24)-($hours_remaining*60*60))-($minutes_remaining*60));
return &amp;#39;There are &amp;#39;.$days_remaining.&amp;#39; days and &amp;#39;.$hours_remaining.&amp;#39; hours and &amp;#39;.$minutes_remaining.&amp;#39; minutes and &amp;#39;.$seconds_remaining.&amp;#39; seconds left.&amp;#39;;
}
add_shortcode(&amp;#39;counting_down_the_days&amp;#39;,&amp;#39;urr_countdown_days&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The PHP date function is used to calculate the days, hours, minutes and seconds remaining and returns the output. The script is one of many PHP examples online on how to perform countdowns. This was one of the more popular ones. The script also uses the PHP floor function to get the lowest integer while ignoring the leftover fraction or remainder. To use the plugin, place the shortcode ‘counting_down_the_days’ (wrap it in square brackets) anywhere inside your WordPress post.&lt;/p&gt;</description></item><item><title>ubiquiti ubuntu repository</title><link>http://uly.me/posts/ubiquiti-ubuntu-repository/</link><pubDate>Sun, 25 Oct 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/ubiquiti-ubuntu-repository/</guid><description>&lt;p&gt;I’m running Ubiquiti’s Unifi Cotroller on one of my websites. I did the sudo apt-get update to perform an update recently and found out that the Ubiquiti’s repository is broken. As it turns out, Ubiquiti has changed the location of their repository to the following location:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You have to edit the /etc/apt/sources.list file to change the previous entry with the one above.&lt;/p&gt;
&lt;p&gt;After the change, the update and upgrade went very well.&lt;/p&gt;</description></item><item><title>change mysql password</title><link>http://uly.me/posts/change-mysql-password/</link><pubDate>Thu, 08 Oct 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/change-mysql-password/</guid><description>&lt;p&gt;The following are instructions on how to change your MySQL password from the Unix command line.&lt;/p&gt;
&lt;p&gt;Login to MySQL and access MySQL table.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;mysql -u root -p
use mysql;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change the password for any user, flush privileges and quit.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;update user set password=PASSWORD(&amp;#39;new_password&amp;#39;) where User=&amp;#39;root&amp;#39;;
flush privileges;
quit
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Make sure to make password changes on your applications as well.&lt;/p&gt;
&lt;p&gt;In WordPress, edit the wp-config.php file to change database password.&lt;/p&gt;</description></item><item><title>limit text on wordpress</title><link>http://uly.me/posts/limit-text-on-wordpress/</link><pubDate>Fri, 18 Sep 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/limit-text-on-wordpress/</guid><description>&lt;p&gt;There are times when we need to limit text to a certain length. For example, we want to limit the length of the titles in the footer section. If we don’t limit the length, the text spills over to the next line and screws up the formatting and the look of the website. To limit the text length, we will use CSS3.&lt;/p&gt;
&lt;p&gt;Let’s say, we have a div class called footer-widgets. Inside, we have an unordered list. We can limit the text to just 245 characters. If the design is responsive, the footer section could reconfigure itself and at times be greater than 245px. If that’s the case, we will display the entire string instead. We will set the minimum width to 245px, overflow to hidden, white-space to nowrap, and text overflow to ellipsis.&lt;/p&gt;</description></item><item><title>wordpress 4.3.1</title><link>http://uly.me/posts/wordpress-4-3-1/</link><pubDate>Tue, 15 Sep 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-4-3-1/</guid><description>&lt;p&gt;WordPress 4.3.1 is a security fix for some cross-site scripting vulnerabilities and a potential privilege issue.&lt;/p&gt;
&lt;p&gt;Per &lt;a href="https://wordpress.org/news/2015/09/wordpress-4-3-1/"&gt;WordPress.org&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;WordPress versions 4.3 and earlier are vulnerable to a cross-site scripting vulnerability when processing shortcode tags (CVE-2015-5714). Reported by Shahar Tal and Netanel Rubin of Check Point. A separate cross-site scripting vulnerability was found in the user list table. Reported by Ben Bidner of the WordPress security team. Finally, in certain cases, users without proper permissions could publish private posts and make them sticky (CVE-2015-5715). Reported by Shahar Tal and Netanel Rubin of Check Point.&lt;/p&gt;</description></item><item><title>using like in sql</title><link>http://uly.me/posts/using-like-in-sql/</link><pubDate>Fri, 11 Sep 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/using-like-in-sql/</guid><description>&lt;p&gt;I was looking at my SQL statements the other day. I was doing a bunch of comparisons with a certain field that contain a pattern of words. My original SQL was quite tedious as displayed below. After much thought, I was able to pare it down to something much simpler. The newer SQL statement is much shorter and to the point. It uses the operator LIKE to search for a pattern.&lt;/p&gt;</description></item><item><title>modify header on genesis themes</title><link>http://uly.me/posts/modify-header-on-genesis-themes/</link><pubDate>Thu, 10 Sep 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/modify-header-on-genesis-themes/</guid><description>&lt;p&gt;The Genesis theme is a WordPress theme from StudioPress. I recently worked on a project where there was a need to redirect the URL title to another URL. Essentially, there are two separate WordPress installs on the server, one install had WordPress on the root directory, the other on a sub-directory. The URL title of the WordPress on a sub-directory needed to point to the root directory. So, here’s the fix that you need to add in the functions.php for Genesis themes.&lt;/p&gt;</description></item><item><title>chrome bug with wordpress dashboard</title><link>http://uly.me/posts/chrome-bug-with-wordpress-dashboard/</link><pubDate>Wed, 09 Sep 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/chrome-bug-with-wordpress-dashboard/</guid><description>&lt;p&gt;There’s a bug on Google Chrome with the latest WordPress Dashboard. The bug has been submitted to WordPress’ bug tracker. However, the &lt;a href="https://core.trac.wordpress.org/ticket/33784"&gt;case is closed&lt;/a&gt; since the error occurs only in Chrome. Other browsers are rendering it just fine. There is a workaround by disabling “slimming paint” in Chrome.&lt;/p&gt;
&lt;p&gt;Place this text in the URL of your Chrome browser:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;chrome://flags/#disable-slimming-paint
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Disable it.&lt;/p&gt;
&lt;p&gt;The bug will remain until you restart Chrome.&lt;/p&gt;</description></item><item><title>mobile friendly test</title><link>http://uly.me/posts/mobile-friendly-test/</link><pubDate>Mon, 20 Jul 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mobile-friendly-test/</guid><description>&lt;p&gt;Back in February of 2015, Google added &lt;a href="http://googlewebmastercentral.blogspot.in/2015/02/finding-more-mobile-friendly-search.html"&gt;mobile-friendly sites&lt;/a&gt; as a criteria to their page rankings. Google have updated their algorithms, and mobile-friendly design will have significant impact to search results. To test and make sure your site is mobile-friendly, here’s a website that will analyze your website design and display the results.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.google.com/webmasters/tools/mobile-friendly/"&gt;Mobile-Friendly Test&lt;/a&gt;&lt;/p&gt;</description></item><item><title>getting to know bloginfo</title><link>http://uly.me/posts/getting-to-know-bloginfo/</link><pubDate>Wed, 08 Jul 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/getting-to-know-bloginfo/</guid><description>&lt;p&gt;Bloginfo is a WordPress function that you can use on WordPress templates to display a number of things such as the home page, the blog description, the main feed, comments feed, admin email address, template directory, site url, pingback url, etc. You can display bloginfo via PHP just like this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;?php bloginfo(&amp;#39;url&amp;#39;); ??&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Assuming the blog’s home page is located at &lt;a href="http://example.com/home"&gt;http://example.com/home&lt;/a&gt;, here’s a list of options.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;admin_email = admin@example.com
atom_url = http://www.example.com/home/feed/atom
charset = UTF-8
comments_atom_url = http://www.example.com/home/comments/feed/atom
comments_rss2_url = http://www.example.com/home/comments/feed
description = Just another WordPress blog
home = http://www.example.com/home (DEPRECATED! use url option instead)
html_type = text/html
language = en-US
name = Testpilot
pingback_url = http://www.example.com/home/wp/xmlrpc.php
rdf_url = http://www.example.com/home/feed/rdf
rss2_url = http://www.example.com/home/feed
rss_url = http://www.example.com/home/feed/rss
siteurl = http://www.example.com/home (DEPRECATED! use url option instead)
stylesheet_directory = http://www.example.com/home/wp/wp-content/themes/largo
stylesheet_url = http://www.example.com/home/wp/wp-content/themes/largo/style.css
template_directory = http://www.example.com/home/wp/wp-content/themes/largo
template_url = http://www.example.com/home/wp/wp-content/themes/largo
text_direction = ltr
url = http://www.example.com/home
version = 3.5
wpurl = http://www.example.com/home/wp
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;As mentioned previously, you can use the bloginfo function anywhere within your WordPress templates.&lt;/p&gt;</description></item><item><title>laravel forge edit .env</title><link>http://uly.me/posts/laravel-forge-edit-env/</link><pubDate>Thu, 02 Jul 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/laravel-forge-edit-env/</guid><description>&lt;p&gt;Laravel Forge was recently upgraded with several new features. You can now edit your .env file directly from within Forge. It’s easier and faster than adding each environmental variable. In addition, you can also create and manage Nginx load balancing servers to balance your application load. With Forge, you can now deploy a new server in just minutes from any of the three cloud hosting service providers: Linode, Digital Ocean and now Amazon Web Services.&lt;/p&gt;</description></item><item><title>wordpress permalinks on nginx</title><link>http://uly.me/posts/wordpress-permalinks-on-nginx-2/</link><pubDate>Wed, 24 Jun 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-permalinks-on-nginx-2/</guid><description>&lt;p&gt;If you’re running WordPress on Nginx, you may have an issue with WordPress permalinks. This &lt;a href="http://nginxlibrary.com/wordpress-permalinks/"&gt;article&lt;/a&gt; explains nicely what you need to do to configure Nginx. What the article failed to do is mention the Nginx configuration filename and its location. The filename is nginx.conf, and it’s usually located in the directory /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx, depending on your Linux distro.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# WordPress installed on root directory
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
# WordPress installed on /blog sub-directory
location /blog/ {
try_files $uri $uri/ /blog/index.php?$args;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You need to reload Nginx for changes to take effect. For Ubuntu:&lt;/p&gt;</description></item><item><title>migrations in laravel</title><link>http://uly.me/posts/migrations-in-laravel/</link><pubDate>Tue, 23 Jun 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/migrations-in-laravel/</guid><description>&lt;p&gt;Migrations in Laravel is like having version control of your database. It gives you the ability to create, modify and share a schema, as well as drop tables. Since it has version control, you can migrate and rollback your database changes with just a couple of CLI commands. Here’s a couple of examples.&lt;/p&gt;
&lt;p&gt;To migrate:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ php artisan migrate
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To rollback:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ php artisan migrate:rollback
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In addition, you can also create a new migration table.&lt;/p&gt;</description></item><item><title>psr-2 coding style guide</title><link>http://uly.me/posts/psr-2-coding-style-guide/</link><pubDate>Mon, 15 Jun 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/psr-2-coding-style-guide/</guid><description>&lt;p&gt;Laravel recently started using the PSR-2 style guide. PSR-2 is a coding style agreed upon by many PHP framework developers. It’s an extension of the original PSR-1, which basically has 3 main conventions.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Classes are upper Camel case.&lt;/li&gt;
&lt;li&gt;Methods are lower Camel case.&lt;/li&gt;
&lt;li&gt;Constants are written in caps like VERSION_NUMBER.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;PSR-2 expands this by using these standards&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Indents are 4 spaces instead of tabs.&lt;/li&gt;
&lt;li&gt;Keep line lengths at 80 characters. Soft limit of 120 characters.&lt;/li&gt;
&lt;li&gt;Use one blank line after a namespace declaration. Use a blank line after a group of declarations.&lt;/li&gt;
&lt;li&gt;Opening braces for classes MUST go on the next line. Closing brace must be on its own line.&lt;/li&gt;
&lt;li&gt;Opening braces for methods must go on the next line, and a separate line for the closing brace.&lt;/li&gt;
&lt;li&gt;Closures must have a space after the function keyword.&lt;/li&gt;
&lt;li&gt;Never use the var keyword, this is used with JavaScript and would cause some confusion.&lt;/li&gt;
&lt;li&gt;Control structures, like IF, WHICH, FOR, and FOREACH must have one space before the condition parenthesis.&lt;/li&gt;
&lt;li&gt;The case keywords should be indented from the switch keyword.&lt;/li&gt;
&lt;li&gt;Keywords, like true, false, and null show be in lower case.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;See &lt;a href="http://www.geekgumbo.com/2013/05/19/psr-2-coding-style-guide/"&gt;examples&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>laravel 5.1 with forge</title><link>http://uly.me/posts/laravel-5-1-with-forge/</link><pubDate>Sun, 14 Jun 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/laravel-5-1-with-forge/</guid><description>&lt;p&gt;Laravel 5.1 was released in June 9, 2015. So, I updated my development environment with version 5.1 and updated it to GitHub. From there, I spun a server via Forge at Digital Ocean. Then, I deployed my development repository via GitHub.&lt;/p&gt;
&lt;p&gt;However, I faced two issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I was getting an error saying that there is not enough memory. The simple fix is to do a &lt;strong&gt;composer update&lt;/strong&gt; in your dev environment and then upload your changes to GitHub. If you have automatic deploy turned on, then the changes will be updated on the server.&lt;/li&gt;
&lt;li&gt;The other error was a missing app key. You can fix this by simply running &lt;strong&gt;artisan key:generate&lt;/strong&gt; on the server. You must have a .env file on the Laravel directory. I believe it’s under /home/forge/default. You can create one or copy the .env.example.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Hopefully, I save you some time with troubleshooting if you run into these issues.&lt;/p&gt;</description></item><item><title>backup rotation</title><link>http://uly.me/posts/backup-rotation/</link><pubDate>Fri, 12 Jun 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/backup-rotation/</guid><description>&lt;p&gt;After another downtime with my service provider, I wasn’t really happy with my backup strategy. Although, I have a backup plan in place, it’s not to the level of detail that I wanted. Back to the drawing board I went. I realized that what I really needed, was to back up my databases and keep copies of the last few days. Prior to that I was just relying on full file system backup and restore. Thankfully, backing up MySQL databases is not that difficult. The following pieces of code is the backup script I have put together to backup each MySQL database, as well rotate the backups and keep 5 days of copies of each database.&lt;/p&gt;</description></item><item><title>generate a controller in laravel</title><link>http://uly.me/posts/generate-a-controller-in-laravel/</link><pubDate>Wed, 03 Jun 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/generate-a-controller-in-laravel/</guid><description>&lt;p&gt;Laravel comes with several generators by way of Artisan CLI or Command Line Interface. To generate a controller, you simply run the following command from the Terminal. This is assuming you’re in the Laravel project folder.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;// generate a standard Controller
$ php artisan make:controller HomeController
// generate a plain Controller with no methods
$ php artisan make:controller HomeController --plain
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The first example is the standard way of generating a controller with resourceful routing in mind.&lt;/p&gt;</description></item><item><title>laravel eloquent orm</title><link>http://uly.me/posts/laravel-eloquent-orm/</link><pubDate>Wed, 03 Jun 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/laravel-eloquent-orm/</guid><description>&lt;p&gt;Eloquent ORM is a simple and yet powerful Active Record implementation included in Laravel, a PHP framework. This &lt;a href="https://laracasts.com/series/laravel-5-fundamentals/episodes/8"&gt;video&lt;/a&gt; at Laracasts is a great introduction to Eloquent. However, this &lt;a href="https://scotch.io/tutorials/a-guide-to-using-eloquent-orm-in-laravel"&gt;article&lt;/a&gt; is everything you ever needed to know about Eloquent. If you’re new to Laravel, read the article. Get to know how to use Eloquent effectively.&lt;/p&gt;</description></item><item><title>remove sensitive info from github</title><link>http://uly.me/posts/remove-sensitive-info-from-github/</link><pubDate>Mon, 01 Jun 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-sensitive-info-from-github/</guid><description>&lt;p&gt;I made a mistake by publishing my database password to an environment file that’s visible. Rookie mistake. Replacing the database password entry with something else and submitting kinda takes care of the problem, but anyone can still view the history of the file and see your password. One way of getting rid of this, if you don’t really care about the history of your submits, is to reinitialize the project back to the initial commit. Here’s how.&lt;/p&gt;</description></item><item><title>display posts alphabetically</title><link>http://uly.me/posts/display-posts-alphabetically/</link><pubDate>Tue, 12 May 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-posts-alphabetically/</guid><description>&lt;p&gt;Here’s a snippet of code to display all WordPress posts alphabetically. Typically, you would list archives using the date they were posted, but there might be a need to list the posts alphabetically. You would normally place this code in your Archives Template page.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>wordpress codex</title><link>http://uly.me/posts/wordpress-codex/</link><pubDate>Sun, 03 May 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-codex/</guid><description>&lt;p&gt;If you’re new to WordPress and you want to learn more, I recommend you dig into the WordPress Codex, which is the online manual and living repository for WordPress information and documentation. As a newbie, you can start learning how to use WordPress, then work with Themes, and maybe even write a Plugin or two. If that’s not your forte, then maybe you can contribute to the WordPress community by becoming a tester by reporting bugs, or work on the online documentation. See link below.&lt;/p&gt;</description></item><item><title>setup new repository on github</title><link>http://uly.me/posts/setup-new-repository-on-github/</link><pubDate>Mon, 02 Feb 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/setup-new-repository-on-github/</guid><description>&lt;p&gt;The following instructions will create a new repository on GitHub. These instructions will assume that you’re logged in to GitHub.com. You can create a new repository by clicking on the link called “create a new repository” found on several pages on GitHub. You can also go directly to this URL: &lt;a href="https://github.com/new"&gt;https://github.com/new&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You need to provide a repository name that’s hopefully short and memorable. Click the “Create Repository” button to start the initiation process. Once the repository is created, you can create a new local repository on your computer and sync it to GitHub repository.&lt;/p&gt;</description></item><item><title>youtube html5 video player</title><link>http://uly.me/posts/youtube-html5-video-player/</link><pubDate>Wed, 28 Jan 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/youtube-html5-video-player/</guid><description>&lt;p&gt;YouTube now defaults to HTML5 video player instead of Flash. The new player takes advantage of MediaSource extensions for its Adaptive Bitrate streaming allowing viewers to quickly and seamlessly switch resolutions. The new player also uses a new video codec called VP9 which gives you higher resolution with low bandwidth. YouTube will also start using WebRTC for recording videos and for live streaming capabilities. &lt;a href="http://www.iclarified.com/46799/youtube-now-defaults-to-html5-video-player-instead-of-flash"&gt;Read more&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>laravel 5</title><link>http://uly.me/posts/laravel-5/</link><pubDate>Tue, 27 Jan 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/laravel-5/</guid><description>&lt;p&gt;It looks like Laravel 5 will be released sometime next week. &lt;a href="http://laravel.com"&gt;Laravel&lt;/a&gt; is a PHP framework which uses simple RESTful routing, Eloquent ORM and Blade templating. It’s built on top of Symfony and Composer. It comes with PHPUnit for testing, and of course, it has migrations built in the package. If you’re curious about what Laravel 5 can do and some of its features, there are several &lt;a href="https://laracasts.com/series/whats-new-in-laravel-5"&gt;free videos&lt;/a&gt; available at Laracasts about Laravel 5.&lt;/p&gt;</description></item><item><title>run code at specific times</title><link>http://uly.me/posts/run-code-at-specific-times/</link><pubDate>Tue, 20 Jan 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/run-code-at-specific-times/</guid><description>&lt;p&gt;If you need to run some code at certain times of the week, a weekly sale for example, PHP gives you that flexibility. In the example below, we will display an image on our website every Wednesday afternoon between 1pm and 5pm to display a sale.&lt;/p&gt;
&lt;p&gt;Let’s create a new function called wednesday_afternoon(). We can use this function to check the date and time. The function checks for the current time and compares it if it’s Wednesday afternoon. It returns a true if it is, and a false if it falls outside those times.&lt;/p&gt;</description></item><item><title>charging at night</title><link>http://uly.me/posts/charging-at-night/</link><pubDate>Tue, 13 Jan 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/charging-at-night/</guid><description>&lt;p&gt;&lt;img alt="charging" loading="lazy" src="http://uly.me/wp-content/uploads/2015/01/charging.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Charging the laptop at night. I’m trying to get back into photography. This photo shows how a responsive design render images differently in various screen sizes using CSS max-width at 100%. In addition, the height is set to auto to keep the scale correct.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;img {
height: auto; /* Make sure images are scaled correctly. */
max-width: 100%; /* Adhere to container width. */
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now regarding the Mac, there’s a rumor that Apple is planning to release a 12-inch MacBook Air as detailed here by &lt;a href="http://www.forbes.com/sites/brookecrothers/2015/01/11/rumored-12-inch-macbook-9to5macs-mark-gurman-talks-new-connector/"&gt;Forbes&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>dynamic footer</title><link>http://uly.me/posts/dynamic-footer/</link><pubDate>Mon, 12 Jan 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/dynamic-footer/</guid><description>&lt;p&gt;Many web designers use Copyright followed by the current year on the bottom of their websites. It’s usually placed in the footer section of the page. If your site has been around for a while, spanning over several years, you’ll have to update your footer every time a new year comes along. If your site runs on PHP, you can make your footer a little bit more dynamic by using the PHP date function.&lt;/p&gt;</description></item><item><title>html redirect</title><link>http://uly.me/posts/html-redirect/</link><pubDate>Sun, 04 Jan 2015 00:00:00 +0000</pubDate><guid>http://uly.me/posts/html-redirect/</guid><description>&lt;p&gt;HTML redirect is one of the oldest tricks in the books for web designers. If multiple links share the same information or page for example, you can simply redirect your visitors to a good-known page. Redirect is accomplished using HTML meta redirect. Here’s an example below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;
&amp;lt;meta content=&amp;#34;0; url=http://yahoo.com&amp;#34; http-equiv=&amp;#34;refresh&amp;#34;&amp;gt;&amp;lt;/meta&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The url is the website or page you want visitors to be redirected. Content is the number of delay in seconds. The value of 0 means that you want visitors to be redirected immediately. A value of 5 means visitors will be redirected after 5 seconds.&lt;/p&gt;</description></item><item><title>continuous order list</title><link>http://uly.me/posts/continuous-order-list/</link><pubDate>Fri, 26 Dec 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/continuous-order-list/</guid><description>&lt;p&gt;Take a look at this &lt;a href="http://codepen.io/xmark/pen/ZYpvEv"&gt;piece of code&lt;/a&gt; from Codepen. It’s just a simple ordering list, but the list is broken up into several sections. The numerical order continuous as it spills over to other sections. It even changes to Roman numbering in the last section. How is this possible?&lt;/p&gt;
&lt;p&gt;Just HTML and CSS. No Javascript. The key is adding the appropriate CSS to the &lt;strong&gt;ol&lt;/strong&gt; markup.&lt;/p&gt;
&lt;p&gt;Just look at the examples below.&lt;/p&gt;</description></item><item><title>responsive page width</title><link>http://uly.me/posts/responsive-page-width/</link><pubDate>Thu, 25 Dec 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/responsive-page-width/</guid><description>&lt;p&gt;You can do a lot with having a responsive design. If you’re using page widths on your designs, you can tailor your page layout based on the viewer’s screen size. The following CSS code will make your web page responsive by offering different page widths to your layout.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;@media screen and (min-width:480px) {
#page {width:90%;}
}
@media screen and (min-width:720px) {
#page {width:75%;}
}
@media screen and (min-width:1440px) {
#page {width:60%;}
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the example above, any screen size that’s bigger than 1440px will have page width of 60%. A screen size of between 720px and 1440px will display a page width of 75%. Any screen size smaller than 480px will display a page width of 90%.&lt;/p&gt;</description></item><item><title>background cover</title><link>http://uly.me/posts/background-cover/</link><pubDate>Mon, 22 Dec 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/background-cover/</guid><description>&lt;p&gt;Adding background images to your designs is quite simple. All you need to do is assign CSS background-image to the body of your design. In addition, you can also assign a background color, just in case the background image is not rendered.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;body {
background-image: url(&amp;#34;path/to/the/background/image.gif&amp;#34;);
background-color: #cccccc;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The code above may have worked in the past, but with 4k and 5k monitors becoming popular nowadays, you need to make sure your background images are big enough to cover the large monitors as well.&lt;/p&gt;</description></item><item><title>install s3cmd on ubuntu</title><link>http://uly.me/posts/install-s3cmd-on-ubuntu/</link><pubDate>Mon, 22 Dec 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-s3cmd-on-ubuntu/</guid><description>&lt;p&gt;If you want to backup your Linux server to Amazon S3 (Simple Storage Service), you need to install a utility called S3cmd which allows you to interact with Amazon’s cloud storage service. You’ll be able to create s3 buckets, upload and retrieve files from your Linux server to the S3.&lt;/p&gt;
&lt;p&gt;You can install S3cmd from Ubuntu.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get install s3cmd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Next, you need to configure S3cmd using your S3 credentials. You’ll need an Access key and a Secret key from Amazon’s Security Credentials page which you can access from Amazon’s IAM Management Console.&lt;/p&gt;</description></item><item><title>netbeans ide</title><link>http://uly.me/posts/netbeans-ide/</link><pubDate>Thu, 11 Dec 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/netbeans-ide/</guid><description>&lt;p&gt;I’m currently testing NetBeans IDE for PHP development. You can download Netbeans IDE directly from NetBean’s &lt;a href="https://netbeans.org/"&gt;website&lt;/a&gt;. Netbeans IDE is a free and open source IDE or integrated development environment. IDE’s are essentially glorified editors with a bunch tools to make development easier. Tools can vary from built-in functions, code completion, debugger, version control to FTP access. Netbeans has plugins for multiple programming languages such Java, Javascript, PHP, HTML, Ruby in Rails, etc. Java 7 or newer is a prerequisite to make NetBeans work on your computer. You can download Java from &lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html"&gt;here&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>get apache version</title><link>http://uly.me/posts/get-apache-version/</link><pubDate>Wed, 03 Dec 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/get-apache-version/</guid><description>&lt;p&gt;To find out what version of Apache running on your server, type the following.&lt;/p&gt;
&lt;p&gt;Ubuntu-based distros&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apache2 -V
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Debian-based distros&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;apachectl -V
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Redhat-based distros&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;httpd -V
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>roundcube install errors</title><link>http://uly.me/posts/roundcube-install-errors/</link><pubDate>Sun, 30 Nov 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/roundcube-install-errors/</guid><description>&lt;p&gt;I ran into several issues with the Roundcube installation on Ubuntu. Roundcube is a browser-based IMAP client that you can install on your server. It’s available from the Ubuntu repository to install. You run this command from the Terminal to install.&lt;/p&gt;
&lt;p&gt;Roundcube Install&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get install roundcube roundcube-mysql
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;However, I ran into some issues. The two Roundcube configuration files are main.inc.php and debian.db.php. Both are located in the /etc/roundcube directory. If you have problems receiving or sending mails, it’s worth to take a look at your IMAP and SMTP settings on your /etc/roundcube/main.inc.php file.&lt;/p&gt;</description></item><item><title>laracasts black friday sale</title><link>http://uly.me/posts/laracasts-black-friday-sale/</link><pubDate>Thu, 27 Nov 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/laracasts-black-friday-sale/</guid><description>&lt;p&gt;If you’re a PHP developer, &lt;a href="http://laravel.com"&gt;Laravel&lt;/a&gt; is all the rage. If you’re new to Laravel and you want to learn how to code, I recommend that you check out &lt;a href="http://laracasts.com"&gt;Laracasts&lt;/a&gt;, a video tutorial website about Laravel. You’ll find a number of free lessons, as well as some paid content.&lt;/p&gt;
&lt;p&gt;Since it’s Thanksgiving Day, Laracasts currently has a fire sale. Well, a Black Friday sale to be exact. Laracasts is offering 40% off any type of subscription. You can apply it to a yearly subscription. What a bargain!&lt;/p&gt;</description></item><item><title>linode linux package mirrors</title><link>http://uly.me/posts/linode-linux-package-mirrors/</link><pubDate>Wed, 26 Nov 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linode-linux-package-mirrors/</guid><description>&lt;p&gt;One way to speed up the Linux package updates is to use a package mirror made available by Linode. They are hosted in all six of their data centers. Just pick a data center where your data is Linode server is located by doing the following.&lt;/p&gt;
&lt;p&gt;Edit your sources list&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo nano /etc/apt/sources.list
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Search and replace&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Replace this address
http://us.archive.ubuntu.com/ubuntu/
# with the new address
http://fremont.mirrors.linode.com/ubuntu/
# you can also use this - returns round robin of all locations
http://mirrors.linode.com/ubuntu/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The next time you run a Linux update, it will be significantly faster.&lt;/p&gt;</description></item><item><title>wordpress permalinks on nginx</title><link>http://uly.me/posts/wordpress-permalinks-on-nginx/</link><pubDate>Tue, 25 Nov 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-permalinks-on-nginx/</guid><description>&lt;p&gt;You’ve abandoned Apache for a faster, newer and sleeker Nginx. Installation was a breeze. WordPress is just humming along until you start clicking links within WordPress. You realized the permalinks are broken, which is a biggie. So, here’s how you fix WordPress permalinks on Nginx.&lt;/p&gt;
&lt;p&gt;WordPress on root directory&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;# Edit nginx config
sudo nano /etc/nginx/sites-available/default
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;# Add the following lines to the file.
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?args;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;WordPress in a subdirectory under root&lt;/p&gt;</description></item><item><title>install mariadb on ubuntu</title><link>http://uly.me/posts/install-mariadb-on-ubuntu/</link><pubDate>Sun, 23 Nov 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-mariadb-on-ubuntu/</guid><description>&lt;p&gt;MariaDB is a drop-in replacement for MySQL database. On most cases, you can just uninstall MySQL and install MariaDB and you are good to go. To keep up the two databases compatible, the MariaDB team are doing monthly merges with the MySQL code base making sure new features and fixes are kept up.&lt;/p&gt;
&lt;p&gt;Uninstall MySQL&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get purge mysql*
sudo apt-get autoremove
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Install MariaDB&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get install mariadb-server mariadb-client -y
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Verify if MariaDB is running&lt;/p&gt;</description></item><item><title>delete a symbolic link</title><link>http://uly.me/posts/delete-a-symbolic-link/</link><pubDate>Fri, 21 Nov 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/delete-a-symbolic-link/</guid><description>&lt;p&gt;In the Unix world, a symbolic is special type of file that references to another file or directory. Symbolic links are also known to others as symlink or softlink. To create a symbolic link, the ln -s command is used to reference a file to another like below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To delete a symbolic link&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo rm /var/www/phpmyadmin
# or
sudo unlink /var/www/phpmyadmin
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>install nginx on ubuntu server</title><link>http://uly.me/posts/install-nginx-on-ubuntu-server/</link><pubDate>Thu, 20 Nov 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-nginx-on-ubuntu-server/</guid><description>&lt;p&gt;nginx (pronounced engine x) is an HTTP and reverse proxy server written by Igor Sysoev. nginx is gaining traction over the years due to its exceptional speed. The latest Netcraft web survey indicate that 14.42 percent of the Internet of websites runs on Nginx.&lt;/p&gt;
&lt;p&gt;If you looking to replace your Apache web server or just want to play around with nginx, here are the really simple instructions on how to install nginx on any Ubuntu Server.&lt;/p&gt;</description></item><item><title>cyberduck</title><link>http://uly.me/posts/cyberduck/</link><pubDate>Thu, 23 Oct 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cyberduck/</guid><description>&lt;p&gt;If you’re looking for a S3 client, check out &lt;a href="https://cyberduck.io"&gt;Cyberduck&lt;/a&gt;. It’s a free FTP, SFTP, WebDAV, S3 &amp;amp; OpenStack Swift browser for both Mac and Windows. I started using it primarily to access an Amazon S3 account. Just download the client and select Amazon S3 to access your account.&lt;/p&gt;
&lt;p&gt;You will need an Access Key ID and your Secret Access Key for your S3 account. You can get that from the AWS Dashboard under IAM (Identity Access Management). Once you’re authenticated, you can access your files from within Cyberduck. Drag and drop to download and upload. Very simple and intuitive.&lt;/p&gt;</description></item><item><title>update composer</title><link>http://uly.me/posts/update-composer/</link><pubDate>Tue, 21 Oct 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/update-composer/</guid><description>&lt;p&gt;I tried starting a new Laravel project from my Mac’s Terminal and came across this message saying, “Warning: This development build of composer is over 30 days old. It is recommended to update it by running “/usr/local/bin/composer self-update” to get the latest version.” So I ran this command to get the latest composer.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo /usr/local/bin/composer self-update
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You’ll be prompted to enter the Admin password.&lt;/p&gt;
&lt;p&gt;And that’s the way you get the latest update of Composer.&lt;/p&gt;</description></item><item><title>php upload limit</title><link>http://uly.me/posts/php-upload-limit/</link><pubDate>Thu, 18 Sep 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/php-upload-limit/</guid><description>&lt;p&gt;I was working on PHPMyAdmin today trying to create a copy of a database. The SQL file was bigger than 8MB. Before I uploaded, I saw a message on the page of PHPMyAdmin saying the upload limit is 8MB. All indication points to increasing the upload size in the PHP configuration.&lt;/p&gt;
&lt;p&gt;Since my server runs on Ubuntu, the php.ini file is located in /etc/php/apache2/php.ini. You’ll need to change the following settings:&lt;/p&gt;</description></item><item><title>wp_enqueue_scripts</title><link>http://uly.me/posts/wp_enqueue_scripts/</link><pubDate>Fri, 15 Aug 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wp_enqueue_scripts/</guid><description>&lt;p&gt;There’s a new way to load WordPress stylesheets from within your templates. In the older versions of WordPress, the stylesheets were hard coded on the theme’s header file. The proper way to load your stylesheets is via the functions.php file. Here are the differences.&lt;/p&gt;
&lt;p&gt;The old way was:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;link href=&amp;#34;&amp;lt;?php bloginfo(&amp;#39;stylesheet_url&amp;#39;); ?&amp;gt;&amp;#34; media=&amp;#34;screen&amp;#34; rel=&amp;#34;stylesheet&amp;#34; type=&amp;#34;text/css&amp;#34;&amp;gt;&amp;lt;/link&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The new way uses wp_enqueue_scripts and the code is placed in functions.php.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function sample_theme_scripts() {
wp_enqueue_style( &amp;#39;style&amp;#39;, get_stylesheet_uri() );
}
add_action( &amp;#39;wp_enqueue_scripts&amp;#39;, &amp;#39;sample_theme_scripts&amp;#39; );
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Both codes work, but the latter will give you less headache.&lt;/p&gt;</description></item><item><title>remove paragraphs from content</title><link>http://uly.me/posts/remove-paragraphs-from-content/</link><pubDate>Mon, 11 Aug 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-paragraphs-from-content/</guid><description>&lt;p&gt;Here’s a really easy way on how to remove paragraphs or &amp;lt;p&amp;gt;&amp;lt;/p&amp;gt; from the WordPress content.&lt;/p&gt;
&lt;p&gt;In the WordPress loop, look for the code ‘the_content().’ Add this command just before it:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;remove_filter (&amp;#39;the_content&amp;#39;, &amp;#39;wpautop&amp;#39;);
the_content();
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That essentially removes all the paragraphs from the WordPress content.&lt;/p&gt;</description></item><item><title>enable mod rewrite in ubuntu</title><link>http://uly.me/posts/enable-mod-rewrite-in-ubuntu/</link><pubDate>Fri, 08 Aug 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/enable-mod-rewrite-in-ubuntu/</guid><description>&lt;p&gt;Another issue when installing Laravel on the Ubuntu server is to make sure you have the mod_rewrite module enabled. You can turn it on by invoking the following command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo a2enmod rewrite
sudo service apache2 reload
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once you’ve enabled mod_rewrite, you need to restart Apache. That should fix any of the route issues that you may have. If mod_rewrite is disabled, you usually get 404 errors or file not found. The Laravel routes simply doesn’t work.&lt;/p&gt;</description></item><item><title>laravel: curl and mycrypt</title><link>http://uly.me/posts/laravel-curl-and-mycrypt/</link><pubDate>Fri, 08 Aug 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/laravel-curl-and-mycrypt/</guid><description>&lt;p&gt;I’ve installed Laravel at least a dozen times. Each time, there’s always something new that goes awry during the installation. If it’s not curl, it’s mcrypt, or maybe the app/storage permissions. I think it’s just the fact that I’m experimenting where to put the Laravel files each time I install. It’s either /var/www or /home/user/. I’m using the Ubuntu standard PHP5 install. You have to specifically install php5-curl in addition to the standard PHP package. I think mcrypt is already in the PHP5 package, but to be sure I added it to the install. Here’s the command.&lt;/p&gt;</description></item><item><title>keep your ssh sessions alive</title><link>http://uly.me/posts/keep-your-ssh-sessions-alive/</link><pubDate>Thu, 31 Jul 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/keep-your-ssh-sessions-alive/</guid><description>&lt;p&gt;If you work on servers via Terminal using SSH (secure shell), one of the more annoying things that happens quite regularly are timeouts. If there’s no activity between your SSH client and the server, your terminal is closed because your session has timed out. You’ll need to login again. If you do this at least 6 times a day, then you can see how taxing this whole exercise can be.&lt;/p&gt;</description></item><item><title>display full content per category</title><link>http://uly.me/posts/display-full-content-per-category/</link><pubDate>Thu, 12 Jun 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-full-content-per-category/</guid><description>&lt;p&gt;By the default, the Genesis child theme called Outreach Pro displays categories posts as excerpts. If you want to display the full content on just one category, &lt;a href="http://sridharkatakam.com/author/sridhar/"&gt;Sridhar Katakam&lt;/a&gt; talks about it in his blog post. I changed the function names to fit my own, so here’s my own version of the code:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;// display full content on blog category
add_action( &amp;#39;genesis_before_loop&amp;#39;, &amp;#39;urr_full_content_specific_category&amp;#39; );
function urr_full_content_specific_category() {
if (is_category(&amp;#39;blog&amp;#39;)) {
remove_action( &amp;#39;genesis_entry_content&amp;#39;, &amp;#39;genesis_do_post_content&amp;#39; );
add_action( &amp;#39;genesis_entry_content&amp;#39;, &amp;#39;urr_do_post_content&amp;#39; );
}
}
function urr_do_post_content() {
the_content();
}
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>display post from a year ago</title><link>http://uly.me/posts/display-post-from-a-year-ago/</link><pubDate>Wed, 11 Jun 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/display-post-from-a-year-ago/</guid><description>&lt;p&gt;Here’s a cool little WordPress script to display a post from a year ago. You can display your old content to entice your readers to view older articles. You can display your old posts on your theme’s sidebar, after your post content, or just anywhere on your theme. Here’s the code.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;// current day of the month without leading zeros, e.g. 1-31.
$current_day = date(&amp;#39;j&amp;#39;);
// last year
$last_year = date(&amp;#39;Y&amp;#39;)-1;
// perform a query based on today&amp;#39;s date last year
query_posts(&amp;#39;day=&amp;#39;.$current_day.&amp;#39;&amp;amp;year=&amp;#39;.$last_year);
if (have_posts()):
while (have_posts()) : the_post();
the_title();
the_excerpt();
endwhile;
endif;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result will depend if you have a post last year on the exact date as today, otherwise you’ll get a blank result. I suppose to be on the safe side, you can query all posts of the current month last year. Your chances of getting results is much better. You can use the date(‘n’) function to extract the current month. Your query would look something like this:&lt;/p&gt;</description></item><item><title>hide wordpress admin bar</title><link>http://uly.me/posts/hide-wordpress-admin-bar/</link><pubDate>Fri, 06 Jun 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/hide-wordpress-admin-bar/</guid><description>&lt;p&gt;There are reasons why you want to hide the Admin Bar from your users. If users don’t have edit rights, then there’s really no use for an Admin bar. Another reason is if the account is shared with others, you don’t want users to reset the password. There are ample reasons why you want to hide the Admin bar.&lt;/p&gt;
&lt;p&gt;Here’s the code:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;if (!current_user_can(‘edit_posts’)) {
show_admin_bar(false);
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s another:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function my_function_admin_bar(){ return false; }
add_filter( &amp;#39;show_admin_bar&amp;#39; , &amp;#39;my_function_admin_bar&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s another for users that can’t manage options:&lt;/p&gt;</description></item><item><title>html5 fullscreen background videos</title><link>http://uly.me/posts/html5-fullscreen-background-videos/</link><pubDate>Thu, 05 Jun 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/html5-fullscreen-background-videos/</guid><description>&lt;p&gt;I noticed several websites using a fullscreen background videos on their home pages. A good example is &lt;a href="http://paypal.com"&gt;Paypal.com&lt;/a&gt;. The videos are typically short, between 10-15 seconds, with the sound turned off. The video falls back to a still background image for visitors whose browsers do not support HTML5 videos.&lt;/p&gt;
&lt;p&gt;In addition, Paypal is using what looks like a playlist of several short videos that are displayed in a loop. If you’re interested in how you can implement background videos on your web pages, &lt;a href="http://demothenes.info"&gt;demothenes.info&lt;/a&gt; has a tutorial on &lt;a href="http://demosthenes.info/blog/777/Create-Fullscreen-HTML5-Page-Background-Video"&gt;how to add video background videos&lt;/a&gt; on your website.&lt;/p&gt;</description></item><item><title>shades of color</title><link>http://uly.me/posts/shades-of-color/</link><pubDate>Wed, 04 Jun 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/shades-of-color/</guid><description>&lt;p&gt;Part of creating web design involves working with shades of color. At times, using a color for a HTML link may look good indeed, but the same Hex color code may not necessarily work as a background color. As a designer, you may have to work with different shades of the same color.&lt;/p&gt;
&lt;p&gt;This article, &lt;a href="http://www.smashingmagazine.com/2012/10/04/the-code-side-of-color/"&gt;the code side of color&lt;/a&gt;, explains the science behind hexadecimal code, but if you need to figure out colors quickly on your website, &lt;a href="http://colllor.com"&gt;Colllor&lt;/a&gt; is a great resource that I have been using for several years. Check it out.&lt;/p&gt;</description></item><item><title>atom editor</title><link>http://uly.me/posts/atom-editor/</link><pubDate>Thu, 08 May 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/atom-editor/</guid><description>&lt;p&gt;&lt;a href="http://github.com"&gt;Github&lt;/a&gt; released yesterday a new editor called &lt;a href="https://atom.io/"&gt;Atom&lt;/a&gt;. It’s built on HTML, CSS, Javascript and &lt;a href="http://nodejs.org/"&gt;Node.js&lt;/a&gt;. It’s designed to be extensible via add-on packages so it can be used for a number of things, but it’s mainly used as a text editor. The Atom core, Package Manager and Shell are open-source available via the &lt;a href="http://opensource.org/licenses/MIT"&gt;MIT license&lt;/a&gt;. Currently is available only on Mac OS, but will be available soon for Windows and Linux.&lt;/p&gt;
&lt;p&gt;There are over 800 add-on packages already available from the project’s homepage. If you’re a PHP developer, be sure to add &lt;a href="https://atom.io/packages/search?q=php"&gt;language-php&lt;/a&gt;, &lt;a href="https://atom.io/packages/search?q=php"&gt;php-twig&lt;/a&gt; and &lt;a href="https://atom.io/packages/search?q=php"&gt;php-beautifier&lt;/a&gt;. Based on the initial review, it seems to be well-received by a number of &lt;a href="http://techcrunch.com/2014/05/06/github-open-sources-its-atom-text-editor/"&gt;reviewers&lt;/a&gt;. Is there enough here to get developers to move from &lt;a href="http://macromates.com/"&gt;Text-Mate&lt;/a&gt; and &lt;a href="http://www.sublimetext.com/"&gt;Sublime Text Editor&lt;/a&gt;? We will see. I happen to like it a lot. I plan to use it for the next two weeks.&lt;/p&gt;</description></item><item><title>write php code online</title><link>http://uly.me/posts/write-php-code-online/</link><pubDate>Tue, 22 Apr 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/write-php-code-online/</guid><description>&lt;p&gt;If you’re looking for a way to check if your PHP code is correct without ever loading your script to the web server, then try &lt;del&gt;writecodeonline.com&lt;/del&gt;. The service is no longer available. Just paste your PHP code on the online form and click the ‘Run Code’ button and see if your code validates. The online interpreter defaults to PHP 5, but you can choose PHP 4 if you prefer.&lt;/p&gt;
&lt;p&gt;I’ve used it several times to check if my logic makes sense. It’s a great tool to have. It’s very handy tool to have if you want to do a quick check if your code works or not. It does throw out errors so you’ll be able to correct your script if it has a syntax error or if your logic is incorrect.&lt;/p&gt;</description></item><item><title>icecast php class</title><link>http://uly.me/posts/icecast-php-class/</link><pubDate>Fri, 14 Mar 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/icecast-php-class/</guid><description>&lt;p&gt;I modified an existing Icecast PHP class that I found online. I’ve added a couple of extra fields particularly the ‘status’ field where you’ll be able to determine if your Icecast server is streaming or not. I’ve initially set the status variable to ‘On Air’ and ‘Off Air.’ To use the class, take a look at the code below:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;// include the class file
include( &amp;#39;icecast.php&amp;#39; );
// instantiate class
$stream = new IceCast();
// set server and mount
$server = &amp;#39;http://yourdomain.com:8001&amp;#39;;
$file = &amp;#39;/status.xsl?mount=/yourmount.ogg&amp;#39;;
// set the url
$stream-&amp;gt;setUrl($server,$file);
// get status info
$radio = $stream-&amp;gt;getStatus();
// assign array to variables
extract($radio);
// echo the status
echo $status.&amp;#39;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;&amp;#39;;
// display more stats if ON AIR
if ($status==&amp;#39;ON AIR&amp;#39;) :
echo $listeners.&amp;#39; listeners&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;&amp;#39;;
echo $most_listeners.&amp;#39; max listeners&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;&amp;#39;;
endif;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Here’s the Icecast class.&lt;/p&gt;</description></item><item><title>modifying the content of your blog</title><link>http://uly.me/posts/modifying-the-content-of-your-blog/</link><pubDate>Fri, 14 Mar 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/modifying-the-content-of-your-blog/</guid><description>&lt;p&gt;I wrote a custom blog in CodeIgniter two years ago. I revisited the code to change the content format a bit. I’ve noticed that there were several pieces of code that were commented out. At the time, I was playing around with what I could potentially do with the content. I thought I would share it here, because it will show you how you could drastically change the content of a blog by manipulating the content.&lt;/p&gt;</description></item><item><title>detect device, os, browser</title><link>http://uly.me/posts/detect-device-os-browser/</link><pubDate>Wed, 12 Mar 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/detect-device-os-browser/</guid><description>&lt;p&gt;If you like to deliver specific content to a certain device type, you can use PHP’s server environment settings to know what type of device, operating systems, and browser type is being used. The server environment setting we are interested in is ‘HTTP_USER_AGENT.’ This index contains a string that is given off by the user agent, the browser in this case. All devices pass down pieces of information identifying themselves, including the type of device, operating system, and browser that is being used.&lt;/p&gt;</description></item><item><title>wordpress bash script</title><link>http://uly.me/posts/wordpress-bash-script/</link><pubDate>Mon, 10 Mar 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-bash-script/</guid><description>&lt;p&gt;You’ve heard of the famous 5-minute WordPress installation. You might be able to shave off some considerable time if you try installing WordPress from the command line using a Bash script. So, here’s my stab at how to install WordPress from the Linux shell. To be able to do this, you need access to server’s command line or shell as it’s commonly known in the Linux world. Some hosting companies allows you to have access to shell, some don’t. So, your mileage may vary. In this exercise, you need access to it, if you want to perform these functions.&lt;/p&gt;</description></item><item><title>heredoc in php</title><link>http://uly.me/posts/heredoc-in-php/</link><pubDate>Sun, 02 Mar 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/heredoc-in-php/</guid><description>&lt;p&gt;Heredoc is a way of displaying simplified code in many programming languages. Heredoc is available in PHP and other major languages such as Python, Ruby, and others. If you were to display a HTML form within PHP, you could go in and out of PHP, or use the echo or printf functions within PHP. Any quotes found inside the main quotes would need to be escaped with a backlash or \. Another trick is to alternatively use single and double quotes. If the string is long, I imagine it can get confusing. Wouldn’t be nice if there was simpler way of doing it. So, here is heredoc coming to the rescue. The following code shows the different ways of presenting HTML within PHP.&lt;/p&gt;</description></item><item><title>simplepie rss reader</title><link>http://uly.me/posts/simplepie-rss-reader/</link><pubDate>Thu, 27 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/simplepie-rss-reader/</guid><description>&lt;p&gt;If you’re thinking about adding syndication to your website, consider using SimplePie, a super fast and easy-to-use feed parser written in PHP. With SimplePie, adding a RSS feed to your site couldn’t be more easier. In this article, I will show you how to create a RSS page that will display a feed. It will display my blog’s RSS feed as default when nothing is clicked. I’ve included a couple of links that are clickable. When the links are clicked, the RSS feed for that link will be displayed.&lt;/p&gt;</description></item><item><title>calculating dates in php</title><link>http://uly.me/posts/calculating-dates-in-php/</link><pubDate>Wed, 26 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/calculating-dates-in-php/</guid><description>&lt;p&gt;Calculating and formatting dates is an important function when writing software applications. You might be needing to perform a database search of all transactions a month ago, six months ago, etc. To make this all possible, you need to be able to figure out how to calculate dates based from today’s date. PHP has a couple of date functions called date() and mktime(). I use the date() function primarily for formatting dates, and mktime() function for calculating dates since mktime() is the actual Unix timestamp. With these two functions, you can do some pretty amazing date calculations.&lt;/p&gt;</description></item><item><title>the latest speed test</title><link>http://uly.me/posts/the-latest-speed-test/</link><pubDate>Tue, 25 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/the-latest-speed-test/</guid><description>&lt;p&gt;I recently switched to Comcast for my Internet services. It has been several years since I have left and abandoned Comcast. I was curious more than anything as to what kind of download speeds I’ll be getting now that I’m back to using broadband cable. The result is pretty impressive. It has been a while since I’ve seen this kind of speeds at home. It’s about 4-5 times faster than what I previously had. I ran 3 different speed tests from 3 different sources. I’m a little surprised the results were similar. All fell within the same range of one another. So, without much further ado, here are the results of the speed tests.&lt;/p&gt;</description></item><item><title>url spaces in codeigniter</title><link>http://uly.me/posts/url-spaces-in-codeigniter/</link><pubDate>Wed, 19 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/url-spaces-in-codeigniter/</guid><description>&lt;p&gt;I ran into some issues with a piece of code I wrote several years ago in CodeIgniter. I’m using names of people as part of the URL. When someone enters a name with spaces on the database, the spaces are converted to %20 in the resulting URL. The URL doesn’t look pretty and definitely not SEO friendly. It needs to be cleaned up by replacing spaces with either a dash or an underscore.&lt;/p&gt;</description></item><item><title>importing sql in phpmyadmin</title><link>http://uly.me/posts/importing-sql-in-phpmyadmin/</link><pubDate>Tue, 18 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/importing-sql-in-phpmyadmin/</guid><description>&lt;p&gt;If you have a problem importing SQL files into phpMyAdmin, the issue could be that the upload limit in PHP is set too low. By default, PHP sets the upload file limit to 2MB, which is too low for most people. You can increase the limit to something more realistic such as 16MB, if you’re working mostly with medium-sized SQL databases.&lt;/p&gt;
&lt;p&gt;If you have access to the Terminal and have root access, you can edit your PHP.ini settings. First, you need to find out where your default PHP.ini is located. There might be several PHP.ini files in your system, but there’s only one bound to Apache. To determine to which one is being used, I suggest you create a file that contains the PHP function called phpinfo(). Place this file your web server and run it.&lt;/p&gt;</description></item><item><title>list directories using glob</title><link>http://uly.me/posts/list-directories-using-glob/</link><pubDate>Sat, 15 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/list-directories-using-glob/</guid><description>&lt;p&gt;If there’s a need for you to list directories on the server, there’s a PHP function called &lt;a href="http://us2.php.net/glob"&gt;Glob&lt;/a&gt; which will find pathnames to match a certain pattern. To make glob read only directories on the server, we can specify in the glob function with the GLOB_ONLYDIR option which will return only directories and ignore files. The asterisk means it will accept any pattern.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;glob(&amp;#39;*&amp;#39;, GLOB_ONLYDIR);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In the example below, we will specify any directory by assigning an empty or a blank to the $dir variable. We will then use the foreach loop to display all directories found. If we have WordPress installed, we can ignore the WordPress directories by searching for them in the if statement. We will finally echo and print to the screen each individual directory found by our glob function.&lt;/p&gt;</description></item><item><title>fighting spam with akismet</title><link>http://uly.me/posts/fighting-spam-with-akismet/</link><pubDate>Thu, 06 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fighting-spam-with-akismet/</guid><description>&lt;p&gt;Akismet is a web service that detects spam. Akismet was originally created by Automattic, the company behind WordPress, to filter out spam comments on its own blogs. The use of Akismet has spread to other blogs and CMS engines. Akismet can also be implemented on other websites. There are a number of plugins and libraries available. Akismit also has an API.&lt;/p&gt;
&lt;p&gt;Akismet is open-source and free for personal use. Akismet offers professional and enterprise plans for a modest fee. To start using Akismet on your website, you first need an Akismet key which you can get from WordPress.com. Just register. A key will be automatically generated for you. In addition, you also need to download the Akismet class library which you’ll need to include in your web projects.&lt;/p&gt;</description></item><item><title>responsive web trends conference</title><link>http://uly.me/posts/responsive-web-trends-conference/</link><pubDate>Wed, 05 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/responsive-web-trends-conference/</guid><description>&lt;p&gt;I just signed up for an all-day conference called Responsive Web Trends Conference in San Francisco. It’s a day-long event and it’s free as in beer. The event is on Wednesday, February 12, 2014 starting at 9am. &lt;a href="http://www.meetup.com/sfhtml5/events/164549162/"&gt;Register&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Responsive Web Trends is a completely free, day-long conference for those who are passionate about creating websites that look great and work well on any device—even those that haven’t been invented yet.&lt;/p&gt;
&lt;p&gt;The conference brings together forward-thinking industry influencers, designers and developers for a day of deep discussions and workshops. Presented by Moboom, the conference explores trends in responsive web design and adaptive technologies with the goal of creating an open dialogue about how designers and developers can work more efficiently and think beyond just mobile.&lt;/p&gt;</description></item><item><title>wordpress custom login page</title><link>http://uly.me/posts/wordpress-custom-login-page/</link><pubDate>Tue, 04 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-custom-login-page/</guid><description>&lt;p&gt;We’ve all seen the default WordPress login page. It’s dull, bland, and boring. Typically, the login page is not part of the WordPress theme setup. Most theme designers don’t bother to change the login screen because it’s not really necessary. The cool thing is, it’s entirely feasible to customize the login page. This article will show you how to change your WordPress login page to something like below.&lt;/p&gt;
&lt;p&gt;&lt;img alt="wp-login" loading="lazy" src="http://uly.me/wp-content/uploads/2014/02/wp-login.png"&gt;&lt;/p&gt;
&lt;p&gt;Changing the WordPress Logo&lt;/p&gt;</description></item><item><title>password generator</title><link>http://uly.me/posts/password-generator/</link><pubDate>Sun, 02 Feb 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/password-generator/</guid><description>&lt;p&gt;Yahoo got hacked again. Based on what I read, not everyone was affected. Yahoo has over 273 million users using their mail service. If you haven’t received an email from Yahoo asking you to reset your password, you are probably ok. But, you could never be so sure. Better reset your password.&lt;/p&gt;
&lt;p&gt;Like most users, we probably use the same password across many sites. It’s doesn’t sound like a good idea now. If one website gets hacked, all your other accounts are possibly compromised as well. As a good security practice, it’s probably a good idea to use different passwords for different accounts.&lt;/p&gt;</description></item><item><title>validating ip addresses</title><link>http://uly.me/posts/validating-ip-addresses/</link><pubDate>Fri, 31 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/validating-ip-addresses/</guid><description>&lt;p&gt;If you have a form that accepts IP addresses, you might want to validate it to make sure it really is a valid IP address. I’m talking about IPv4 since IPv6 is not yet universally implemented. A valid IPv4 IP addresses should fall between the numbers 0.0.0.0 and 255.255.255.255. In this example, we will use a regular expression and a pattern matching function in PHP to see if it’s a real IP address.&lt;/p&gt;</description></item><item><title>truncating page titles</title><link>http://uly.me/posts/truncating-page-titles/</link><pubDate>Wed, 29 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/truncating-page-titles/</guid><description>&lt;p&gt;The title of an article is one of the most important factors for SEO. It’s second only to the content itself. The title has to be catchy, concise and relevant to the content. If you look at Google search results, they show roughly 70 characters of the title on the results page. If the title is too long, you’ll see 3 dots or ellipses as they’re appropriately called. There’s really no ideal length for titles, as long as they best describe the content of the page. They can be short or long and must contain certain keywords.&lt;/p&gt;</description></item><item><title>custom content in wordpress</title><link>http://uly.me/posts/custom-content-in-wordpress/</link><pubDate>Fri, 24 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/custom-content-in-wordpress/</guid><description>&lt;p&gt;There are some instances where you might need to alter or customize the content of a WordPress post. You could be working on a custom post type with a few extra meta box fields, and you simply want to display them on a template. So, instead of editing the WordPress theme files, you can simply customize the WordPress content if it’s a certain post type. Otherwise, the content remains the same if it’s a regular post or page.&lt;/p&gt;</description></item><item><title>gitignore</title><link>http://uly.me/posts/gitignore/</link><pubDate>Wed, 22 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gitignore/</guid><description>&lt;p&gt;You can ignore specific files in Git by placing a .gitignore file at the root of your local repository. The files listed in .gitignore will not be tracked by Git. Why would you do this? Well, there are certain OS generated files placed in system folders such as .DS_Store or Thumbs.db that are not really part of your code.&lt;/p&gt;
&lt;p&gt;Create a .gitignore file&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;touch .gitignore
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Edit the .gitignore file&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo nano .gitignore
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add the files you want excluded. You can use wildcards.&lt;/p&gt;</description></item><item><title>multi-column css</title><link>http://uly.me/posts/multi-column-css/</link><pubDate>Wed, 22 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/multi-column-css/</guid><description>&lt;p&gt;If you have a long list of words laid out on a page (see list below), it might be better to place them in a multi-column page format. CSS3 makes this entirely possible without using tables or multiple divs. All we need is a single div for the entire list. In this example, we will work with a list of animals. We will use a div class called “animals.”&lt;/p&gt;
&lt;div class="animals"&gt;aardvark beetle camel dog elephant fox goat hen iguana jackal kangaroo lion&lt;/div&gt;To use multi-columns, we simply style the div with:
&lt;pre tabindex="0"&gt;&lt;code&gt;.animals {-moz-column-count:3; -webkit-column-count:3; column-count:3;}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Multi-column divs is supported on Firefox, Safari, Chrome and IE browsers.&lt;/p&gt;</description></item><item><title>styling genesis post navigation</title><link>http://uly.me/posts/styling-genesis-post-navigation/</link><pubDate>Tue, 21 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/styling-genesis-post-navigation/</guid><description>&lt;p&gt;The Genesis framework has a feature where you choose the post navigation technique. You can select either “previous / next” or the “numeric” option. This feature is found under the main Genesis Theme settings about halfway down. Selecting the “numeric” option, in this example, will display the numeric post navigation at the bottom of the home page after the main content.&lt;/p&gt;
&lt;p&gt;&lt;img alt="pagination" loading="lazy" src="http://uly.me/wp-content/uploads/2014/01/pagination.png"&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, it didn’t always look like this, when I first enabled it. It lacks margin and some padding. The link colors falls back to the default colors. I had to style the post navigation technique to make it look better. So, I just wanted to share with you the following CSS styles that will make this Genesis numeric post navigation technique look much better.&lt;/p&gt;</description></item><item><title>add a widget area in wordpress</title><link>http://uly.me/posts/add-a-widget-area-in-wordpress/</link><pubDate>Mon, 20 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/add-a-widget-area-in-wordpress/</guid><description>&lt;p&gt;Customizing your WordPress theme gives you total control of the look and feel of your website. One of the ways of customizing your theme is to add a “widget area” that you can place anywhere on your theme’s template. The first step in adding a widget area is to edit your theme’s functions.php file. In this example, we are going to add a widget area just underneath the header and before the main post loop.&lt;/p&gt;</description></item><item><title>this webpage is not available</title><link>http://uly.me/posts/this-webpage-is-not-available/</link><pubDate>Thu, 16 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/this-webpage-is-not-available/</guid><description>&lt;p&gt;I stopped by Starbucks to hang out, sip coffee, and perform some housecleaning on my website. I fired up my MacBook Air and tried to access my website. Chrome barked at me saying, “This webpage is not available.” What! So, I opened up Terminal to see if I’m really connected to the WiFi network. Yes, I am. I can ping everything else, but my domain.&lt;/p&gt;
&lt;p&gt;So, what’s happening? Is my site down? I logged into my VPS. The server is doing just fine. I did some more investigating. I realized that I can ping my IP address, but not the domain. That’s interesting. AT&amp;amp;T is currently the provider for the WiFI for Starbucks.&lt;/p&gt;</description></item><item><title>file association on the mac</title><link>http://uly.me/posts/file-association-on-the-mac/</link><pubDate>Wed, 15 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/file-association-on-the-mac/</guid><description>&lt;p&gt;Have you ever tried to open a file, but the wrong application opens it? It happened to me at least a couple of times on the Mac. But, don’t fret. There’s actually a simple one-minute fix to make files to associate with the correct application.&lt;/p&gt;
&lt;p&gt;To correctly associate a file:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Right click on the file.&lt;/li&gt;
&lt;li&gt;Select Get Info.&lt;/li&gt;
&lt;li&gt;Select “Open With.”&lt;/li&gt;
&lt;li&gt;Select the correct Application.&lt;/li&gt;
&lt;li&gt;Click “Change All.”&lt;/li&gt;
&lt;li&gt;Click “Continue” to apply to all similar files.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That should do it. You can test the file if the association is correct by running it. The file should open up with the application that you’ve selected.&lt;/p&gt;</description></item><item><title>github for mac</title><link>http://uly.me/posts/github-for-mac/</link><pubDate>Wed, 15 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/github-for-mac/</guid><description>&lt;p&gt;GitHub has a native for the Mac OS called “Github Mac.” You can download the app directly from &lt;a href="http://mac.github.com/"&gt;GitHub&lt;/a&gt;. With this native app, you can clone, and fork a repository. You can commit your changes to the local or remote repository. Github for Mac is fairly intuitive. I didn’t need to read the manual to perform version control tasks.&lt;/p&gt;
&lt;p&gt;&lt;img alt="github" loading="lazy" src="http://uly.me/wp-content/uploads/2014/01/github.png"&gt;&lt;/p&gt;
&lt;p&gt;In addition, you can also browse history, switch branches and synchronize your changes to the master repository. The application was designed using Chameleon, a port of Apple’s UIKit for iOS. The interface is well-designed and integrates well with the GitHub repositories. Synchronization seems to be snappy and quite fast. Overall, it’s a fast and snappy application. Most of all, it’s free.&lt;/p&gt;</description></item><item><title>wordpress custom css stylesheet</title><link>http://uly.me/posts/wordpress-custom-css-stylesheet/</link><pubDate>Fri, 10 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-custom-css-stylesheet/</guid><description>&lt;p&gt;I’m releasing a new WordPress plugin called Custom Stylesheet. This plugin creates a safe haven for some custom CSS styles that you want preserved, even if you switch from one theme to another. In addition, this plugin also prevent theme updates from overwriting your custom styles. Lastly, this plugin also serves as a quick test environment for applying your custom CSS styles.&lt;/p&gt;
&lt;h4 id="install-and-configure"&gt;Install and Configure&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Upload the “stylesheet” folder to the WordPress plugins folder.&lt;/li&gt;
&lt;li&gt;Activate the “Custom Stylesheet” plugin from the “Plugins &amp;gt; Installed Plugins.”&lt;/li&gt;
&lt;li&gt;Custom Stylesheet is available from “Appearance &amp;gt; Stylesheet.”&lt;/li&gt;
&lt;li&gt;Add your custom CSS styles.&lt;/li&gt;
&lt;li&gt;Click “Save Custom Stylesheet” to save.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href="https://uly.me/wp-content/uploads/2019/12/stylesheet.zip"&gt;Download&lt;/a&gt;&lt;/p&gt;</description></item><item><title>installing windows after linux</title><link>http://uly.me/posts/installing-windows-after-linux/</link><pubDate>Wed, 08 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/installing-windows-after-linux/</guid><description>&lt;p&gt;Dual boot desktops makes sense. Most techies prefer it. There’s no need for an extra computer. It’s also less clutter on the desk. If you had to install two or more OS on a bare system, I suggest that you install Windows first, followed by Linux. Doing it the other way around, in installing Linux first and then Windows, is certainly doable, but you have to perform an extra step to fix Grub. Grub is the boot loader for Linux systems. Windows removes the Linux Grub entry from the MBR (Master Boot Record) after Windows is installed. This is a case of Microsoft not playing nice. Running a Linux recovery CD, to reinstate Grub in the MBR, does the trick.&lt;/p&gt;</description></item><item><title>html kickstart</title><link>http://uly.me/posts/html-kickstart/</link><pubDate>Mon, 06 Jan 2014 00:00:00 +0000</pubDate><guid>http://uly.me/posts/html-kickstart/</guid><description>&lt;p&gt;&lt;a href="http://www.99lime.com/elements/"&gt;HTML Kickstart&lt;/a&gt; is an ultra-lean website framework built on top of HTML5, CSS3, Javascript and JQuery. HTML Kickstart is a good alternative to the widely-popular &lt;a href="http://getbootstrap.com"&gt;Twitter’s Bootstrap&lt;/a&gt;. The download is quite small. It’s less than 1MB, but it’s quite powerful in terms of what you can do with it. All you have to do is add 3 lines into your existing HTML page to enable HTML Kickstart.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;script src=&amp;#34;https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src=&amp;#34;js/kickstart.js&amp;#34;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;link href=&amp;#34;css/kickstart.css&amp;#34; media=&amp;#34;all&amp;#34; rel=&amp;#34;stylesheet&amp;#34;&amp;gt;&amp;lt;/link&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The framework is well documented and quite easy to follow and implement. Some of the framework features are the ability to render: buttons, lists, menus, tables, tooltips, menus, horizontal rules, icons, code, tabs, breadcrumbs, responsive and flexible grid/ columns, images, slideshow, forms, labels, and extra helpers.&lt;/p&gt;</description></item><item><title>install mysql on mac</title><link>http://uly.me/posts/install-mysql-on-mac/</link><pubDate>Fri, 27 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-mysql-on-mac/</guid><description>&lt;p&gt;This article shows you how to install MySQL on the Mac OS X. MySQL is an open-source relational database management system used in majority of websites on the Internet. MySQL works on many platforms including Windows, Mac and many flavors of the Linux OS.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This article is part of a series of articles on how to manually install Apache, PHP, MySQL on the Mac OS. Installing the popular MAMP application is as simple as installing any other application on the Mac, but it will not give you any valuable learning experience, nor will you have complete control of your development environment. I recommend manually installing the individual applications to maximize your learning experience.&lt;/p&gt;</description></item><item><title>install php on mac</title><link>http://uly.me/posts/install-php-on-mac/</link><pubDate>Fri, 27 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-php-on-mac/</guid><description>&lt;p&gt;This article will show you how to install PHP on the Mac. By default, Apache and PHP are already installed on the Mac, although both are not activated. We must first enable Apache. Once you’ve Apache is enabled, you can then proceed in activating PHP.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This article is part of a series of articles on how to manually install Apache, PHP, MySQL on the Mac OS. Installing the popular MAMP application is as simple as installing any other application on the Mac, but it will not give you any valuable learning experience, nor will you have complete control of your development environment. I recommend manually installing the individual applications to maximize your learning experience.&lt;/p&gt;</description></item><item><title>install phpmyadmin on mac</title><link>http://uly.me/posts/install-phpmyadmin-on-mac/</link><pubDate>Fri, 27 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-phpmyadmin-on-mac/</guid><description>&lt;p&gt;This article covers how to install PhpMyAdmin on Mac OS X. PhpMyAdmin is a software tool written in PHP to manage and administer MySQL databases. It supports not only MySQL, but also MariaDB and Drizzle databases. PhpMyAdmin supports a variety of database operations such as managing databases, tables, columns, relations, indexes, users, and permissions.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This article is part of a series of articles on how to manually install Apache, PHP, MySQL on the Mac OS. Installing the popular MAMP application is as simple as installing any other application on the Mac, but it will not give you any valuable learning experience, nor will you have complete control of your development environment. I recommend manually installing the individual applications to maximize your learning experience.&lt;/p&gt;</description></item><item><title>apache virtual host on mac</title><link>http://uly.me/posts/apache-virtual-host-on-mac/</link><pubDate>Thu, 26 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/apache-virtual-host-on-mac/</guid><description>&lt;p&gt;Creating an Apache virtual host on your Mac is quite easy. Assuming you already have Apache installed and running on your Mac, you will now have to decide whether to serve your pages from the default web root, or create your own virtual host, and serve your pages from an alternate location.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This article is part of a series of articles on how to manually install MAMP or Apache, PHP, MySQL on the Mac OS. Installing the popular MAMP application is as simple as installing any other application on the Mac, but it will not give you any valuable learning experience, nor will you have complete control of your development environment. I recommend manually installing the individual applications to maximize your learning experience.&lt;/p&gt;</description></item><item><title>install apache on mac</title><link>http://uly.me/posts/install-apache-on-mac/</link><pubDate>Thu, 26 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-apache-on-mac/</guid><description>&lt;p&gt;This article will show you how to install Apache on the Mac OS. This is ideal if you want to use your Mac desktop or laptop as your development environment, a place where you can test code, scripts, themes, plugins without affecting your production environment.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This article is part of a series of articles on how to manually install MAMP or Apache, PHP, MySQL on the Mac OS. Installing the popular MAMP application is as simple as installing any other application on the Mac, but it will not give you any valuable learning experience, nor will you have complete control of your development environment. I recommend manually installing the individual applications to maximize your learning experience.&lt;/p&gt;</description></item><item><title>linode manager on android</title><link>http://uly.me/posts/linode-manager-on-android/</link><pubDate>Thu, 26 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linode-manager-on-android/</guid><description>&lt;p&gt;&lt;a href="https://blog.linode.com/2013/12/10/linode-mobile-2-0/"&gt;Linode Manager&lt;/a&gt; is the official Android mobile application for Linode. With this application, you’ll be able to manage and administer your Linodes from anywhere in the world. Here’s a list of things that you can do with this smart phone application:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create, remove, boot, and reboot Linodes&lt;/li&gt;
&lt;li&gt;Access Linodes via SSH and Lish&lt;/li&gt;
&lt;li&gt;Resize Linodes on the fly&lt;/li&gt;
&lt;li&gt;Keep tabs on your Linodes performance with CPU, network, and IO utilization graphs&lt;/li&gt;
&lt;li&gt;Create and manage NodeBalancers and domain zones&lt;/li&gt;
&lt;li&gt;Access the complete Linode Library&lt;/li&gt;
&lt;li&gt;Manage your Linode account and make payments&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Linode Shell or Lish for short, works primarily with a web browser console in this app. I prefer Chrome with Lish. SSH seems to look for an app called Connectbot. Unfortunately, I couldn’t get SSH to work because it defaults to port 22. I use a different port for SSH, an added security to my Linode.&lt;/p&gt;</description></item><item><title>nano history error</title><link>http://uly.me/posts/nano-history-error/</link><pubDate>Fri, 20 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/nano-history-error/</guid><description>&lt;p&gt;I experienced a “nano” editor error this morning. It displayed this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;Error reading /home/ulysses/.nano_history: Permission denied
Press Enter to continue starting nano.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The error doesn’t prevent you from using the nano editor, but it displays an annoying message. You have to press the Enter key each time you want to use the editor. I’m not sure how I manage to make the nano editor behave this way. I probably edited a file in my home directory while I was root. It’s a common mistake.&lt;/p&gt;</description></item><item><title>gimp on mac os x</title><link>http://uly.me/posts/gimp-on-mac-os-x/</link><pubDate>Wed, 18 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/gimp-on-mac-os-x/</guid><description>&lt;p&gt;&lt;a href="http://www.gimp.org"&gt;Gimp&lt;/a&gt; is the GNU image manipulation program that I use exclusively for editing and creating image files. It’s open-source and it’s free. Gimp on the Mac OS X has come a long way. Last year, Gimp went native on OS X, meaning it no longer required XQuartz or Apple’s X11 to run on the Mac OS.&lt;/p&gt;
&lt;p&gt;When Apple released Mac OS X &lt;a href="http://www.apple.com/osx/"&gt;Mavericks&lt;/a&gt; a couple of months ago, Gimp followed with its own release supporting Mavericks. However, there are some serious bugs that need fixing, particularly with the keyboard focus. When Gimp is prompted with a text box, the keyboard focus remains in the background.&lt;/p&gt;</description></item><item><title>heatsink and modem</title><link>http://uly.me/posts/heatsink-and-modem/</link><pubDate>Wed, 18 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/heatsink-and-modem/</guid><description>&lt;p&gt;My DSL router/modem is failing miserably. My Internet connection slows down to a crawl. Pinging a host online takes twice as long. Resetting the router/modem fixes the problem temporarily, but only for a couple of hours, then it’s back to its slow crawl.&lt;/p&gt;
&lt;p&gt;Rummaging through my stash of electronics, I found an old DSL modem that I put away years ago. There’s a reason why it’s in the electronic pile. It has problems with overheating as I recall. Desperate for a fix. I pried off the heatsink from an old motherboard, and placed it on top of the overheating chip on the modem.&lt;/p&gt;</description></item><item><title>mac pro</title><link>http://uly.me/posts/mac-pro/</link><pubDate>Wed, 18 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mac-pro/</guid><description>&lt;p&gt;Apple Mac Pro will go on sale tomorrow. The cylindrical high-end desktop is made and assembled in the USA and priced somewhere between $3000 to $4000. The lower end unit features a 3.7 Ghz quad-core Intel Xeon E5 processor, 12 GB of RAM, two FirePro D500 graphics processing units and 256 GB of flash storage.&lt;/p&gt;
&lt;p&gt;The high-end unit will have upgrade to faster processors, more memory and 1 TB of SSD flash storage. The Mac Pro is geared towards movie editors that need lots of processing power. The Mac Pro is available at Apple.com, Apple stores and select resellers.&lt;/p&gt;</description></item><item><title>installing laravel 4.1</title><link>http://uly.me/posts/installing-laravel-4-1/</link><pubDate>Mon, 16 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/installing-laravel-4-1/</guid><description>&lt;p&gt;&lt;a href="http://laravel.com"&gt;Laravel&lt;/a&gt; version 4.1 was released just a couple of days ago. With the latest release of Laravel, the installation and setup couldn’t be any easier. In this article, I will show you how easy it is to install Laravel on &lt;a href="http://ubuntu.com"&gt;Ubuntu&lt;/a&gt;. You can quickly adapt these commands to other Linux flavors using either the ‘yum’ or ‘rpm’ commands.&lt;/p&gt;
&lt;p&gt;The preferred way of installing Laravel is by using &lt;a href="http://getcomposer.org/"&gt;Composer&lt;/a&gt;, which is a dependency manager for PHP. In this article, I will be using Composer because it’s by far the easiest way to install Laravel.&lt;/p&gt;</description></item><item><title>sublime text 2</title><link>http://uly.me/posts/sublime-text-2/</link><pubDate>Mon, 16 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sublime-text-2/</guid><description>&lt;p&gt;&lt;a href="http://www.sublimetext.com/2"&gt;Sublime Text 2&lt;/a&gt; is a sophisticated text editor built for writing code, markup and prose. It has a slick user interface with extraordinary features and amazing performance. Sublime Text 2 is available multiple platforms including Windows, Mac OS and Linux OS. After 4 months of heavy use, I now use Sublime Text 2 exclusively. I stopped using other text editors altogether.&lt;/p&gt;
&lt;p&gt;Since I work mostly from the Terminal, I wanted to be able to launch Sublime Text 2 directly from the command line. In order to make this possible, I needed to create a symbolic link for easier access. The reason for this is because the Sublime Text 2 command is located in a directory that is hard to remember. So, here’s the command to create a symbolic link called ‘&lt;strong&gt;/bin/subl&lt;/strong&gt;‘ for Sublime Text 2.&lt;/p&gt;</description></item><item><title>virtual apache host</title><link>http://uly.me/posts/virtual-apache-host/</link><pubDate>Mon, 16 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/virtual-apache-host/</guid><description>&lt;p&gt;Creating a virtual host in &lt;a href="http://httpd.apache.org/"&gt;Apache&lt;/a&gt; allows for multiple domains to be hosted on a single IP address. This is extremely useful in terms of hosting multiple domains on a single host or VPS. As far as I know, you can have an unlimited number of virtual hosts. The only limitation is the system resources in terms of CPU usage, memory and storage. This article will show you how to add Apache virtual hosts in Ubuntu.&lt;/p&gt;</description></item><item><title>wordpress 3.8</title><link>http://uly.me/posts/wordpress-3-8/</link><pubDate>Thu, 12 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-3-8/</guid><description>&lt;p&gt;&lt;a href="http://wordpress.org"&gt;WordPress 3.8&lt;/a&gt; was released today. It’s named “Parker” after the jazz saxophonist Charlie “Bird” Parker. WordPress 3.8 has a new modern, clean, aesthetic &lt;a href="http://wordpress.org/news/2013/12/parker/"&gt;Admin Dashboard&lt;/a&gt;. The clean design makes it easier to navigate and read the Admin Dashboard. It comes in 8 stunning color themes. My favorite is “Midnight.”&lt;/p&gt;
&lt;p&gt;In addition, WordPress now uses the “Open Sans” typeface which is friendly for desktop and mobile viewing. WordPress 3.8 now uses vector-based icons that scales to every device. To top it all off, WordPress 3.8 comes with a new sleek magazine-styled default theme called “Twenty Fourteen.”&lt;/p&gt;</description></item><item><title>mumble</title><link>http://uly.me/posts/mumble/</link><pubDate>Thu, 05 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mumble/</guid><description>&lt;p&gt;&lt;a href="http://mumble.sourceforge.net/"&gt;Mumble&lt;/a&gt; is a voice over IP or VOIP application designed primarily for gamers. The Mumble application is similar to Ventrilo and Teamspeak. Mumble uses a client-server architecture letting users talk to each other while connected to the Mumble server called Murmur. Mumble contains a simple admin interface and features a high quality audio codec with low latency. All communication is encrypted to ensure user privacy.&lt;/p&gt;
&lt;p&gt;Logging in to Mumble servers provide users with a root channel and a hierarchical tree underneath it. Mumble uses &lt;a href="http://www.speex.org/"&gt;Speex&lt;/a&gt; audio codec for voice, noise reduction and automatic gain control. The &lt;a href="http://celt-codec.org/"&gt;CELT&lt;/a&gt; audio codec was added starting with Mumble version 1.2. Mumble is optimized for low latency resulting in faster communication. Mumble has positional audio which modifies audio based on a player’s position within a video game.&lt;/p&gt;</description></item><item><title>zoho mail</title><link>http://uly.me/posts/zoho-mail/</link><pubDate>Thu, 05 Dec 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/zoho-mail/</guid><description>&lt;p&gt;Running your own mail server has its own benefits and drawbacks. If you want full control, then running your own is the ideal option. You will be able to personalize your own email, have access to your server logs, and access to the raw email files. The are a few drawbacks such as, configuration is complicated, troubleshooting problems is a pain, downtime can result in lost emails, and the need to run your own spam and virus filtering. Your system can also be exploited if not properly secured.&lt;/p&gt;</description></item><item><title>chromecast adds hbo go</title><link>http://uly.me/posts/chromecast-adds-hbo-go/</link><pubDate>Thu, 21 Nov 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/chromecast-adds-hbo-go/</guid><description>&lt;p&gt;Google announced today that it can now stream &lt;a href="http://news.yahoo.com/hbo-ios-android-now-stream-chromecast-135941702.html"&gt;HBO Go to Chromecast&lt;/a&gt; from both iOS and Android devices. Google is slowly adding the pieces together in making Chromecast a formidable streaming option. Priced at just $35, it’s an attractive buy considering the competition from Roku, Apple TV and others.&lt;/p&gt;
&lt;p&gt;At this moment, Chromecast can now stream from Pandora, Hulu Plus, Netflix, and YouTube. In time, more and more services will be added in the future. In a year or two, we will see a much longer list of streaming services. Google should add sports programming next. NFL, NBA, MLB, NHL and MLS would be nice.&lt;/p&gt;</description></item><item><title>codeacademy</title><link>http://uly.me/posts/codeacademy/</link><pubDate>Wed, 20 Nov 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/codeacademy/</guid><description>&lt;p&gt;If you want to learn how to develop websites, visit &lt;a href="http://codeacademy.com"&gt;CodeAcademy.com&lt;/a&gt;. In about several dozen exercises or so, you can quickly learn how to write code in different languages that empower the web. Courses in HTML/CSS, PHP, Javascript, Python, Ruby, and APIs are being offered. The program is geared towards people with no programming experience, but challenging enough for those with some programming experience.&lt;/p&gt;
&lt;p&gt;The programs are designed to get you started, and to get your feet wet. It’s by no means a be all exhaustive programming experience. The CodeAcademy exercises are designed to get you introduced to the basics of each language. If you’re looking for a programming experience that is exhaustive, extensive and covers intermediate and advanced levels, CodeAcademy is not this program. There are other certification programs offered for a handsome fee.&lt;/p&gt;</description></item><item><title>php.net new design</title><link>http://uly.me/posts/php-net-new-design/</link><pubDate>Wed, 20 Nov 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/php-net-new-design/</guid><description>&lt;p&gt;PHP.net revealed its brand new website design today. &lt;a href="http://php.net"&gt;PHP.net&lt;/a&gt; is the official website of PHP. The redesign is based on &lt;a href="http://www.w3.org/html/wg/drafts/html/master/"&gt;HTML5&lt;/a&gt;, &lt;a href="http://google.com/fonts/"&gt;Google Fonts&lt;/a&gt;, and &lt;a href="http://getbootstrap.com/"&gt;Bootstrap&lt;/a&gt;. The website’s layout is a typical Bootstrap-centered layout with a top menu level. It’s both simple and elegant. The website color scheme remains purple, but the colors have been lightened a bit according to the PHP.net designers. The font of choice is “Source Sans Pro” making the website’s font much more smoother and softer to read. The PHP code examples are more readable.&lt;/p&gt;</description></item><item><title>2 million raspberry pi</title><link>http://uly.me/posts/2-million-raspberry-pi/</link><pubDate>Mon, 18 Nov 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/2-million-raspberry-pi/</guid><description>&lt;p&gt;Sales of the popular and highly successful &lt;a href="http://www.raspberrypi.org/"&gt;Raspberry Pi&lt;/a&gt; have hit the two million units last week. The creators of the $35 credit-card sized computer initially planned to sell a 1000 units. It took a year to sell the first million and 8 months to sell the second. I bought two units myself last year. Raspberry Pi have been introduced to schools to teach kids how to program. There are many uses for Raspberry Pi. The Linux-based units are used in variety of ways from running websites, mail servers, print servers, media servers, DNS servers, as well as automation. Raspberry Pi users have found different uses for the open-sourced units from &lt;a href="http://www.wired.co.uk/news/archive/2013-11/07/raspberry-pi-powered-bar"&gt;running bars&lt;/a&gt;, as a &lt;a href="http://lifehacker.com/transform-your-raspberry-pi-into-a-universal-translator-1458394765"&gt;translator&lt;/a&gt;, for &lt;a href="http://wnmufm.org/post/device-lets-you-order-pizza-push-button"&gt;ordering pizzas&lt;/a&gt;, etc.&lt;/p&gt;</description></item><item><title>xcode reinstall on mavericks</title><link>http://uly.me/posts/xcode-reinstall-on-mavericks/</link><pubDate>Wed, 13 Nov 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/xcode-reinstall-on-mavericks/</guid><description>&lt;p&gt;I’ve been using Mac OS 10.9 Mavericks for a couple of weeks now. So far, so good. No issues whatsoever. There were several updates that followed the OS upgrade. Updates to iTunes, iMovie, iPhoto were the obvious ones, plus a couple of other small applications that were also updated as a result of the OS upgrade.&lt;/p&gt;
&lt;p&gt;I happen to use Git for version control for my software projects. One thing I noticed after upgrading to Mavericks, Git stopped working completely. I tried to do a git pull, and I was met with this error, “xcode-select: note: no developer tools were found at ‘/Applications/Xcode.app’, requesting install. Choose an option in the dialog to download the command line developer tools.”&lt;/p&gt;</description></item><item><title>html5 download attribute</title><link>http://uly.me/posts/html5-download-attribute/</link><pubDate>Mon, 11 Nov 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/html5-download-attribute/</guid><description>&lt;p&gt;HTML5 has a little-known attribute called download. The download attribute is often used in conjunction with the link or the &amp;lt;a&amp;gt; tag. Check the correct markup for the link tag below. Clicking on a HTML link will typically result in the browser opening up a new page, image, or a document.&lt;/p&gt;
&lt;p&gt;In some cases, depending on your browser settings, clicking on a link will download a document, file or an image. For consistency, we can alter the behavior of the link tag by adding the download attribute. Let’s say, we want our readers to download an image, pdf, or a web page. We simply add the download attribute in the link tag.&lt;/p&gt;</description></item><item><title>where is your rss feed?</title><link>http://uly.me/posts/where-is-your-rss-feed/</link><pubDate>Fri, 01 Nov 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/where-is-your-rss-feed/</guid><description>&lt;p&gt;RSS or Really Simple Syndication enable publishers to syndicate their data automatically. Readers can subscribe to the feed and content will be delivered automatically. Most websites, news feeds, blogs, forums, etc. nowadays run some kind of content management system or CMS. And most CMS, if not all, have built-in RSS feed generators.&lt;/p&gt;
&lt;p&gt;But, why is it so hard to find the RSS feed for some websites? Why do readers have to go for a bunny hunt each time, just to find the RSS feed. If it’s not on the top of the page, it must be at the bottom. If it’s not on the front page, then clearly, it must be somewhere else on the site. Maybe, it’s searchable on the website. Well, try again. In some instances, there is no RSS at all. What a shame at this day and age.&lt;/p&gt;</description></item><item><title>wordpress 3.7 auto updates</title><link>http://uly.me/posts/wordpress-3-7-auto-updates/</link><pubDate>Thu, 31 Oct 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/wordpress-3-7-auto-updates/</guid><description>&lt;p&gt;Starting with WordPress 3.7, you don’t have to lift a finger to perform a WordPress update. Most WordPress-powered websites will be able to perform automatic updates without any intervention. The only prerequisite is that your website is capable of carrying updates without entering your FTP credentials. In the future, WordPress may require users to click “Update Now” for major feature releases.&lt;/p&gt;
&lt;p&gt;The good news is, several of my WordPress-powered websites were able to perform auto updates automatically without a hitch. WordPress, as a courtesy, does send out an email notifications to WordPress administrators after each upgrade is completed. This new feature will be a tremendous help for many administrators who manage dozens of websites, knowing WordPress updates are going to be done automatically.&lt;/p&gt;</description></item><item><title>open with application duplicate</title><link>http://uly.me/posts/open-with-application-duplicate/</link><pubDate>Fri, 30 Aug 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/open-with-application-duplicate/</guid><description>&lt;p&gt;If you’re a Mac user, you can open up a file by right-clicking on it, and choosing “Open With,” and selecting an application. If you see duplicates, you can remove multiple entries by running the following script. The script restarts the Launch Register called lsregister and removes the duplicates.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Right click the file again. The duplicates should be gone.&lt;/p&gt;</description></item><item><title>phpmailer and gmail smtp</title><link>http://uly.me/posts/phpmailer-and-gmail-smtp/</link><pubDate>Thu, 22 Aug 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/phpmailer-and-gmail-smtp/</guid><description>&lt;p&gt;Although PHP comes with its own email() function, it lack features. There’s an alternative called PHPMailer that’s easy to implement. PHPMailer is a library class used by many popular PHP projects. In this article, I’ll show how PHPMailer is used to send out notification emails via GMail’s STMP server. Using GMail SMTP server requires an account as well as the need to authenticate. So, here’s the code using PHPMailer and GMail SMTP server.&lt;/p&gt;</description></item><item><title>530 incorrect login error on vsftpd</title><link>http://uly.me/posts/530-incorrect-login-error-on-vsftpd/</link><pubDate>Fri, 09 Aug 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/530-incorrect-login-error-on-vsftpd/</guid><description>&lt;p&gt;I installed a FTP server called vsftpd on my Ubuntu Server recently. After the install, I’ve been unable to login at all. It turned out to be a bug within the vsftpd program. I found a fix &lt;a href="http://www.jackenhack.com/vsftpd-ubuntu-server-530-login-incorrect-error-fixed/"&gt;here&lt;/a&gt;. Essentially, the fix was removing the vsftpd program first, deleting the /etc/pam.d/vsftpd file and forcing the application to recreate the file. The third step is to reinstall the vstfpd once again.&lt;/p&gt;
&lt;p&gt;From the Terminal, type the following commands.&lt;/p&gt;</description></item><item><title>install samba shared drive</title><link>http://uly.me/posts/install-samba-shared-drive/</link><pubDate>Fri, 09 Aug 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/install-samba-shared-drive/</guid><description>&lt;p&gt;What’s not to like with Samba. If you’re not familiar with Samba, it’s an open-source file and printer services which allows disparate clients to share files via SMB/CIFS standard, meaning there’s interoperability between Linux/Unix servers and Windows-based clients. This article will show you how to install a Samba shared drive on an Ubuntu Server.&lt;/p&gt;
&lt;p&gt;Install Samba Server&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo apt-get install samba
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Configure Samba by editing /usr/samba/smb.conf. Uncomment and add the following.&lt;/p&gt;</description></item><item><title>linode doubled its disk storage</title><link>http://uly.me/posts/linode-doubled-its-disk-storage/</link><pubDate>Thu, 01 Aug 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/linode-doubled-its-disk-storage/</guid><description>&lt;p&gt;A week ago, Linode doubled the storage for all its VPS plans. It now boasts 48GB of disk storage. This came at the heels of a RAM upgrade back in May. A month before that, Linode doubled its CPU from 4 to 8 cores. All of these upgrade are for the same monthly price of just $20 per month. Not bad at all. So overall, here are the details.&lt;/p&gt;
&lt;p&gt;Linode 1 GB&lt;/p&gt;</description></item><item><title>mac os hosts file</title><link>http://uly.me/posts/mac-os-hosts-file/</link><pubDate>Sun, 28 Jul 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mac-os-hosts-file/</guid><description>&lt;p&gt;Adding host entries in your desktop can be beneficial if you run several servers or hosts on your internal network. Instead of typing and remembering long IP addresses, you simply type the name of each host to make things easier for you. Let’s say you have several servers named “one”, “two” and “three” in your internal network. Each hosts will have their own assigned static IP address. By editing your hosts file and adding host entries to it, you can then use the hostnames instead of IP addresses.&lt;/p&gt;</description></item><item><title>a custom html button</title><link>http://uly.me/posts/a-custom-html-button/</link><pubDate>Fri, 19 Jul 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/a-custom-html-button/</guid><description>&lt;p&gt;HTML buttons are dull and boring. If you like to make your HTML buttons stand out in the crowd, you’ll need to style them using CSS. This article will show you how to spice up your HTML buttons, therefore giving them life and color.&lt;/p&gt;
&lt;p&gt;To begin, here’s the syntax for the HTML button:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;input type=&amp;#34;submit&amp;#34; value=&amp;#34;Click here&amp;#34;&amp;gt;&amp;lt;/input&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Starting HTML4 and now with HTML5, button tags were made available. Instead of using input, you can simply use the button tags instead of the input tags. The button syntax is like this:&lt;/p&gt;</description></item><item><title>cant connect to mysql server</title><link>http://uly.me/posts/cant-connect-to-mysql-server/</link><pubDate>Fri, 28 Jun 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cant-connect-to-mysql-server/</guid><description>&lt;p&gt;I recently had a problem with an Ubuntu server that was running MySQL. None of my applications were connecting to the database. After poking around in the server, I realized the database doesn’t seem to be running at all. I tried restarting it from the Terminal, but I ran into this error message.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ERROR 2003 (HY000): Can&amp;#39;t connect to MySQL server on &amp;#39;10.10.10.110&amp;#39; (111)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;As it turns out, the Ubuntu server picked up a new IP address of 10.10.10.113 from the last reboot. I went ahead and assigned a static IP address to the server of 10.10.10.200. I should have done it initially when I setup the server. If you need help setting up a static IP address on the Ubuntu server, here are the instructions on &lt;a href="http://ulyssesonline.com/ubuntu/2007/06/28/change-ip-address/"&gt;how to set Ubuntu server to static IP address&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>choosing dns servers</title><link>http://uly.me/posts/choosing-dns-servers/</link><pubDate>Fri, 28 Jun 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/choosing-dns-servers/</guid><description>&lt;p&gt;Every once in a while (it doesn’t happen very often) DNS servers would stop resolving certain domains causing intermittent issues when accessing the Internet. To solve the DNS issues, I often switch DNS servers on my main router. Changing DNS servers may require rebooting your router.&lt;/p&gt;
&lt;p&gt;So, here’s a list of DNS servers you could use on your router, in case the current DNS servers you are using is having problems. I primarily use OpenDNS and Google DNS servers, but others DNS servers are reliable as well.&lt;/p&gt;</description></item><item><title>mysql and access via odbc</title><link>http://uly.me/posts/mysql-and-access-via-odbc/</link><pubDate>Fri, 24 May 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/mysql-and-access-via-odbc/</guid><description>&lt;p&gt;A client of mine had a request to connect Microsoft Access to MySQL via an ODBC connector. The MySQL ODBC setup is not very common, but is entirely possible. MySQL does provide an ODBC connector for other database clients. The setup is a bit tricky. Unfortunately, there’s not a lot of information and documentation online for this type of setup. After some trial and error, I got it to work.&lt;/p&gt;</description></item><item><title>user access to web root</title><link>http://uly.me/posts/user-access-to-web-root/</link><pubDate>Thu, 16 May 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/user-access-to-web-root/</guid><description>&lt;p&gt;When setting up your Ubuntu server, you can allow regular Linux accounts to access your web root directory via FTP or secure shell. In this case, you want users to access /var/www directory. One of the first things you’ll need to do is give permissions to the Apache user www-data.&lt;/p&gt;
&lt;p&gt;Change the group name to /var/www.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo chgrp www-data /var/www
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Make it writeable.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo chmod 775 /var/www
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Set the GID for www-data for all sub-folders.&lt;/p&gt;</description></item><item><title>fix apache fdq error</title><link>http://uly.me/posts/fix-apache-fdq-error/</link><pubDate>Sun, 12 May 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/fix-apache-fdq-error/</guid><description>&lt;p&gt;If you’re working on Ubuntu and running Apache, you probably have seen this error when rebooting Apache. It says “could not reliably determine the server’s fully qualified domain name.” There’s a simple fix to this configuration issue.&lt;/p&gt;
&lt;p&gt;You’ll need to edit the /etc/apache2/httpd.conf config file:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo nano /etc/apache2/httpd.conf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and add this entry:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;ServerName localhost
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Reboot Apache&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;sudo /etc/init.d/apache2 restart
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The error is now gone.&lt;/p&gt;</description></item><item><title>codeigniter anchor with onclick</title><link>http://uly.me/posts/codeigniter-anchor-with-onclick/</link><pubDate>Thu, 31 Jan 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/codeigniter-anchor-with-onclick/</guid><description>&lt;p&gt;CodeIgniter comes with a &lt;a href="http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html"&gt;URL helper&lt;/a&gt; that assist you with managing URLs. One function worth examining is called anchor, which creates standard HTML links. Instead of the standard HTML &amp;lt;a href=””&amp;gt;anchor&amp;lt;/a&amp;gt; tag most people are familiar with, CodeIgniter coders can take advantage of the simpler anchor function.&lt;/p&gt;
&lt;p&gt;To create a standard link, all you have to do is code this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;=anchor(&amp;#39;blog /index&amp;#39;, &amp;#39;Home&amp;#39;);?&amp;gt;
// Output is
&amp;lt;a href=&amp;#34;http://yourdomain.com/blog/index.php&amp;#34;&amp;gt;Home&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want to add a Javascript popup that will ask you “Are you sure?” before proceeding to the link, then all you have to do is add a third option in the anchor function like this:&lt;/p&gt;</description></item><item><title>delete .ds_store files recursively</title><link>http://uly.me/posts/delete-ds_store-files-recursively/</link><pubDate>Thu, 31 Jan 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/delete-ds_store-files-recursively/</guid><description>&lt;p&gt;If you work with MacOS and you FTP files to a Linux server, you probably have seen this pesky and ubiquitous hidden files named .DS_Store. They seem to be in every folder known to man. The .DS_Store files are hidden MacOS files used to store the attributes of a folder such as position of icons and choice of background images, etc. Although they are not harmful, they probably don’t belong on the web server. Instead of deleting them one by one, there’s a faster way of deleting them recursively. You can invoke this command from the Linux terminal on your webroot folder.&lt;/p&gt;</description></item><item><title>web directory structure</title><link>http://uly.me/posts/web-directory-structure/</link><pubDate>Wed, 16 Jan 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/web-directory-structure/</guid><description>&lt;p&gt;If you’re a system administrator or web developer with root privileges, chances are, you probably have complete control of your web server, including root privileges. That’s a good thing. You can setup the server anyway you want. If you’re starting out to build out a new web server, some of the questions that you may have is, what’s the proper or correct way of creating a web directory structure on your web server.&lt;/p&gt;</description></item><item><title>setup wireless on raspberry pi</title><link>http://uly.me/posts/setup-wireless-on-raspberry-pi/</link><pubDate>Thu, 10 Jan 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/setup-wireless-on-raspberry-pi/</guid><description>&lt;p&gt;One of the first things you should do once you have your Raspberry Pi is setup a wireless network adapter. This will allow you to be cable free. To configure, you will need one of several approved USB wireless adapters. I’m using an Airlink 101 Wireless N 150 Ultra Mini-USB Adapter that I &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B006ZZUK5Y/savagehomeaut-20"&gt;purchased&lt;/a&gt; at Amazon for just $14. I chose the Airline 101 because it was affordable, and it works very well with the Raspberry Pi.&lt;/p&gt;</description></item><item><title>first page is always selected</title><link>http://uly.me/posts/first-page-is-always-selected/</link><pubDate>Fri, 04 Jan 2013 00:00:00 +0000</pubDate><guid>http://uly.me/posts/first-page-is-always-selected/</guid><description>&lt;p&gt;I had a little trouble with CodeIgniter pagination today. The pagination function is working fine, but Page 1 is always selected regardless which page I select. The data seems to be correct as I go from one page to another, but the page number doesn’t move at all. Well, after trial and error, the problem turned out to be a configuration issue.&lt;/p&gt;
&lt;p&gt;CodeIgniter typically uses the following URI format:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://domain.com/class/function/id"&gt;http://domain.com/class/function/id&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>remove last comma in loop</title><link>http://uly.me/posts/remove-last-comma-in-loop/</link><pubDate>Wed, 26 Dec 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-last-comma-in-loop/</guid><description>&lt;p&gt;When performing a database query, we normally use a loop to output the database result. This is a common exercise for programmers when displaying results to the screen. To make the output readable, commas are typically used to separate data. Consider a loop below that prints a list of names. We added a string &lt;strong&gt;‘, ‘&lt;/strong&gt; after each name to make it readable.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;foreach($query as $item) :
echo $item-&amp;gt;name.&amp;#39;, &amp;#39;;
endforeach;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The output would be something like this:&lt;br&gt;
John, Mary, Steve, Mark,&lt;/p&gt;</description></item><item><title>bootstrap your website</title><link>http://uly.me/posts/bootstrap-your-website/</link><pubDate>Wed, 19 Dec 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/bootstrap-your-website/</guid><description>&lt;p&gt;Jumpstart your website by adding Bootstrap, a front-end CSS framework started by a couple of Twitter developers. If you are starting on a new web project, why not dress it with Bootstrap. You can quickly transform your website, by just adding a couple of markups. Bootstrap uses some HTML markup, LESS CSS, and Javascript plugins to create the framework.&lt;/p&gt;
&lt;p&gt;To get started, &lt;a href="http://twitter.github.com/bootstrap/index.html"&gt;Download Bootstrap&lt;/a&gt; first.&lt;/p&gt;
&lt;p&gt;Then, use this HTML Bootstrap template&lt;/p&gt;</description></item><item><title>dropbox folder as web root</title><link>http://uly.me/posts/dropbox-folder-as-web-root/</link><pubDate>Sat, 08 Dec 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/dropbox-folder-as-web-root/</guid><description>&lt;p&gt;One of many clever ways you can do with Dropbox is to make it the web root of your development server. There’s an advantage to doing this, as I’ll explain in this post. Currently, I have Dropbox installed on my Linux Mint desktop. I also use the desktop as my web development server. I have Apache, PHP, MySQL, etc. installed. Typically the web root of the Apache web server, is located in the /var/www directory. I’ve changed mine to a Dropbox folder at /home/ulysses/Dropbox/web/.&lt;/p&gt;</description></item><item><title>validate email address</title><link>http://uly.me/posts/validate-email-address/</link><pubDate>Wed, 05 Dec 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/validate-email-address/</guid><description>&lt;p&gt;I was working with PHP forms the other day which contained an email address. Validating email addresses is important. Occasionally, email addresses are used for activating accounts or resetting passwords. We can’t always guarantee that the email address provided is going to be valid, but at least, we can validate it’s going to be in the correct format. For pattern matching, I’m using a regex I found online. I like it because it’s very strict. I’m using the regex pattern with the preg_match function to determine a valid email address.&lt;/p&gt;</description></item><item><title>validate empty fields</title><link>http://uly.me/posts/validate-empty-fields/</link><pubDate>Wed, 05 Dec 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/validate-empty-fields/</guid><description>&lt;p&gt;Here’s a simple way to validate forms with empty fields. When working with forms, we want users to submit required fields. We can easily check by using the PHP empty() function. In this example, I will use a simple form, and check if “username” is empty. Since the action for the form is blank, the form will submit to itself. The the code you see for “value” is a shorthand PHP code to echo the field entry after a submit.&lt;/p&gt;</description></item><item><title>the raspberry pi works</title><link>http://uly.me/posts/the-raspberry-pi-works/</link><pubDate>Fri, 30 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/the-raspberry-pi-works/</guid><description>&lt;p&gt;My &lt;a href="http://www.raspberrypi.org"&gt;Raspberry Pi&lt;/a&gt; finally arrived yesterday, after what seemed like an eternity of waiting. I ordered it October 24. It was shipped November 20 and arrived on my doorstep November 29. That’s over a month! I had a few hours to play around with it. The first thing I did was placed the Raspberry Pi inside an &lt;a href="http://www.adafruit.com/products/975"&gt;Adafruit Rainbow Pibow&lt;/a&gt; enclosure that I’ve ordered several weeks back. It looks amazing. Here’s it is.&lt;/p&gt;</description></item><item><title>generate random characters</title><link>http://uly.me/posts/generate-random-characters/</link><pubDate>Wed, 28 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/generate-random-characters/</guid><description>&lt;p&gt;This article will show you how to generate random characters in PHP. Random characters are useful in a variety of ways, such as generating random passwords or filenames. The command that we are going to use to generate random characters is a function called mt_rand(). In addition, we will specify which characters we want to include in our random key.&lt;/p&gt;
&lt;p&gt;I’ve decided to omit vowels, as well as the number zero, to make the random characters much more unpredictable. I’ve added some special characters in the mix, just for the fun of it. If you don’t want the special characters, you can just take them out. Here’s our list.&lt;/p&gt;</description></item><item><title>2012 mac mini</title><link>http://uly.me/posts/2012-mac-mini/</link><pubDate>Tue, 27 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/2012-mac-mini/</guid><description>&lt;p&gt;About a month ago, I bought a Mac Mini at the Apple store in San Francisco. I remember it very well, because it was October 31, which happens to be Halloween. If that wasn’t enough, it was also the day of the victory parade of the World Champions San Francisco Giants. So, I headed out to the Apple store, at the corner of Ellis and Stockton after watching the last motorcade. I picked up the new 2012 Mac Mini, and carried it home, inside an Apple plastic bag.&lt;/p&gt;</description></item><item><title>sorting arrays</title><link>http://uly.me/posts/sorting-arrays/</link><pubDate>Tue, 27 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sorting-arrays/</guid><description>&lt;p&gt;I was working on a client project last night. I had to sort a multidimensional array. I came across a neat PHP function called asort. In the end, I had to use arsort instead of asort to get a reverse sort order. This short article will show you how to sort arrays in normal and reverse order. Here’s our array.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$animals = array(&amp;#34;a&amp;#34; =&amp;gt; &amp;#34;Giraffe&amp;#34;, &amp;#34;b&amp;#34; =&amp;gt; &amp;#34;Elephant&amp;#34;, &amp;#34;c&amp;#34; =&amp;gt; &amp;#34;Lion&amp;#34;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;We will sort the array using the asort function. We print the array to view the results.&lt;/p&gt;</description></item><item><title>google web fonts plugin</title><link>http://uly.me/posts/google-web-fonts-plugin/</link><pubDate>Mon, 26 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/google-web-fonts-plugin/</guid><description>&lt;p&gt;I’m releasing a WordPress plugin called “Web Fonts.” This plugin takes advantage of the free and open-source &lt;a href="http://google.com/webfonts/"&gt;Google Web Fonts&lt;/a&gt;. If you’re not familiar with Google Web Fonts, it’s a group of fonts that allows designers to customize the looks of their blogs or websites using hundreds of exotic fonts. With a gaggle of external fonts available for use, “Web Fonts” can transform the overall design of a website.&lt;/p&gt;
&lt;h4 id="install-and-configure"&gt;Install and Configure&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;Upload the “webfonts” folder to the WordPress plugins folder.&lt;/li&gt;
&lt;li&gt;Activate the “Web Fonts” plugin from the “Dashboard &amp;gt; Plugins &amp;gt; Installed Plugins.”&lt;/li&gt;
&lt;li&gt;Configure stylesheet link and CSS from the “Dashboard &amp;gt; Settings &amp;gt; Web Fonts.”&lt;/li&gt;
&lt;li&gt;If you want multiple fonts, just add a second stylesheet link and additional CSS.&lt;/li&gt;
&lt;li&gt;“Update Options” to save.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id="screenshot"&gt;Screenshot&lt;/h4&gt;
&lt;p&gt;&lt;img loading="lazy" src="http://uly.me/wp-content/uploads/2012/11/Screen-Shot-2012-11-26-at-3.48.42-PM-e1353973916434.png" title="Screen Shot 2012-11-26 at 3.48.42 PM"&gt;&lt;/p&gt;</description></item><item><title>numbers and currency on forms</title><link>http://uly.me/posts/numbers-and-currency-on-forms/</link><pubDate>Wed, 21 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/numbers-and-currency-on-forms/</guid><description>&lt;p&gt;This article will show you how to limit currency and numbers only in a form. There are essentially two different approaches when validating data. One way is to validate before submitting the form. The other is to validate after submitting the form. Obviously, validating before submit has its own merits. Incorrect data can be corrected before hitting the submit button. In this article, we will validate a field to allow numbers and currency only. We will allow up two decimal places to reflect currency values. The HTML markup is detailed below.&lt;/p&gt;</description></item><item><title>open new window</title><link>http://uly.me/posts/open-new-window/</link><pubDate>Wed, 21 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/open-new-window/</guid><description>&lt;p&gt;One of the basic things you can do with Javascript is to open up a small popup window. You can set the resulting window to any size you want. You can make the window scrollable, fixed and resizable. To create a popup window, we will use a simple link to trigger the event. Here are details of our page with some embedded Javascript code.&lt;/p&gt;
&lt;p&gt;In this example, we are using a regular link to trigger an event. Instead of the standard URL on the link, we will use the “javascript:open_window()” function. The “open_window” function opens the contents of my home page, which is &lt;a href="http://uly.me"&gt;http://uly.me&lt;/a&gt;. We can point it to any file or page that we want. The new window is called “abc.”&lt;/p&gt;</description></item><item><title>unsaved changes on forms</title><link>http://uly.me/posts/unsaved-changes-on-forms/</link><pubDate>Tue, 20 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/unsaved-changes-on-forms/</guid><description>&lt;p&gt;If you try to abandon a form, you’ll be reminded that you’ve made changes. In addition, a pop up message will come up, asking you whether to stay on the page or to abandon it. This feature is made possible using a Javascript function. This short article will show how to alert users if they made changes to a form, prior to canceling or going to another link.&lt;/p&gt;
&lt;h4 id="the-form"&gt;The Form&lt;/h4&gt;
&lt;p&gt;In this example, I created a simple form with one input called “username.” I’ve added “onchange=’needToConfirm=True&amp;rsquo;” to monitor the input field. I also added a save and cancel button, as well as an internal link for testing the form later. The save button calls the “needToConfirm” function when the save button is clicked. The cancel button simply reloads the same page when the cancel button is clicked. Here’s the HTML markup.&lt;/p&gt;</description></item><item><title>sanitize input</title><link>http://uly.me/posts/sanitize-input/</link><pubDate>Sun, 18 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/sanitize-input/</guid><description>&lt;p&gt;When designing web applications, it’s important to sanitize data before storing them into the database. I use several PHP built-in functions namely trim, strip_tags, htmlspecialchars, and addslashes to sanitize my forms. This function has become a staple for all my web projects. So, here it is.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;function sanitize($in) {
return addslashes(htmlspecialchars(strip_tags(trim($in))));
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Whenever I need to sanitize a form input, I simply use the sanitize function before storing the data to the database.&lt;/p&gt;</description></item><item><title>remove commas from forms</title><link>http://uly.me/posts/remove-commas-from-forms/</link><pubDate>Fri, 16 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/remove-commas-from-forms/</guid><description>&lt;p&gt;This article will show you how to remove commas, semicolons, or any character, from a form. This tidy PHP script is quite useful when filtering out unwanted characters submitted in a form. This is important when the data is collected and exported later to a CSV (comma-delimited values) file. CSV files use commas and semicolons to separate data values. Having commas and semicolons in your data creates confusion and unwanted results. This neat PHP script removes commas and semicolons, and replaces them with a blank value.&lt;/p&gt;</description></item><item><title>atx bench power supply</title><link>http://uly.me/posts/atx-bench-power-supply/</link><pubDate>Wed, 07 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/atx-bench-power-supply/</guid><description>&lt;p&gt;I have several old computers with perfectly working power supplies. I decided to convert one of them into into a bench power supply. Typically, a bench power supply can cost anywhere from $100-200 dollars or more, depending on brand and quality of equipment. With this modified ATX bench power supply, it cost me only $20 and about 3 hours of project work.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="http://uly.me/wp-content/uploads/2012/11/DSC_0843.jpg" title="DSC_0843"&gt;&lt;/p&gt;
&lt;p&gt;This ATX bench power supply gives me 3 different voltages at 3.3, 5 and 12 volts. The voltages are rated at 18, 12 and 21 amps respectively. I didn’t bother using the -5 and -12 volts since the amperage on these two voltages are very low. The only downside to this power supply is the voltages are fixed. It would have been nice to have an adjustable voltages.&lt;/p&gt;</description></item><item><title>git commit</title><link>http://uly.me/posts/git-commit/</link><pubDate>Wed, 07 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-commit/</guid><description>&lt;p&gt;Git Commit is a command for committing files to the local repository. Once satisfied with the changes in the local repository, the files will need to be committed. This command does not update the master repository in Github. Just the local repository. You commit files to the local repository by issuing this command in the Terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git commit -m “your comments go here” -a
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git export</title><link>http://uly.me/posts/git-export/</link><pubDate>Wed, 07 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-export/</guid><description>&lt;p&gt;Subversion has an export command when you want a copy of the repository without the .svn directories and files. Git Export is similar to Subversion’s Export command. To export a project in Git, you will need to go to the root of your Git project and issue the following commands.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;cd git/project
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Create a gzip file or a zip file.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git archive master | gzip &amp;gt; project.tgz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;or&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git archive master | zip &amp;gt; project.zip
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>raspberry pi</title><link>http://uly.me/posts/raspberry-pi/</link><pubDate>Wed, 07 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/raspberry-pi/</guid><description>&lt;p&gt;I ordered a couple of Raspberry Pis from Newark Element 14 two weeks ago. I’m ecstatic to say the least. I can’t wait to get my hands on the Raspberry Pi. The estimated shipment date is November 19. It will probably take 4-5 days for the shipment to arrive home.&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="http://uly.me/wp-content/uploads/2012/11/raspberrypi.jpg"&gt;&lt;/p&gt;
&lt;p&gt;I’m not sure yet what I plan to do with the Raspberry Pi yet. I will probably start with a media center for streaming music, videos, movies, and radio stations. The other Raspberry Pi, I will most likely use it for other projects. November 19 can’t get here soon enough.&lt;/p&gt;</description></item><item><title>subversion branch</title><link>http://uly.me/posts/subversion-branch/</link><pubDate>Tue, 06 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-branch/</guid><description>&lt;p&gt;Subversion Branch creates a new branch in the local working directory. In the example below, a copy of the project directory is forked and given a new name. The new branch will be treated as a separate branch.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn copy http://repository/project/trunk \
http://repository/project/branch/newbranch
\ -m &amp;#34;Place comments here.&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>subversion delete</title><link>http://uly.me/posts/subversion-delete/</link><pubDate>Tue, 06 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-delete/</guid><description>&lt;p&gt;The Subversion Delete command will delete a file in the local working directory. While it removes file in the working copy, it doesn’t remove the same file in the repository until after a commit.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn delete foo.c
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>subversion diff</title><link>http://uly.me/posts/subversion-diff/</link><pubDate>Tue, 06 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-diff/</guid><description>&lt;p&gt;Subversion Diff will display differences between a file in the local working directory versus the same file that’s located in the repository. It will display on the screen what has been edited, modified or deleted. You invoke the Diff command from the Terminal as displayed below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn diff
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>subversion move</title><link>http://uly.me/posts/subversion-move/</link><pubDate>Tue, 06 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-move/</guid><description>&lt;p&gt;Subversion Move is a command that renames a file in either in the local working directory or directly in the repository. You can invoke the move command from Terminal like this example below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn move foo.c bar.c
svn move http://repository/project/trunk/foo.c \
http://repository/project/trunk/bar.c
-m &amp;#34;Place comment here.&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>subversion revert</title><link>http://uly.me/posts/subversion-revert/</link><pubDate>Tue, 06 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-revert/</guid><description>&lt;p&gt;Subversion Revert undoes the recent changes in the local working directory. Revert can also undo changes recursively. Here’s a couple of examples displayed below.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn revert foo.c
svn revert --recursive .
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>subversion export</title><link>http://uly.me/posts/subversion-export/</link><pubDate>Mon, 05 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-export/</guid><description>&lt;p&gt;Subversion Export creates a clean working copy of a project without the .svn folders and files. In this example, the command creates a folder named &lt;code&gt;project&lt;/code&gt; and places a clean working copy in it.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn export http://repository/project/trunk project
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>subversion info</title><link>http://uly.me/posts/subversion-info/</link><pubDate>Mon, 05 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-info/</guid><description>&lt;p&gt;Subversion Display shows information of the local working copy of the repository. The information displayed will contain the versioned number, the recent commits made, user-level locks held on a object, local scheduling information such as (added, deleted and copied), and any local convict information. To display the info, type in the Terminal this command.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn info
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>subversion update</title><link>http://uly.me/posts/subversion-update/</link><pubDate>Mon, 05 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-update/</guid><description>&lt;p&gt;Subversion Update is used to synch the working copy with repository. You can use any of the two commands below. Any changes done by you since the last update will not be overwritten. Your changes will be reflected on the repository once you perform a commit to the repository.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn update
svn up
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git push</title><link>http://uly.me/posts/git-push/</link><pubDate>Sun, 04 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-push/</guid><description>&lt;p&gt;The Git Push command sends all commits found in the local repository to the remote or master repository on the web such as Github or Unfuddle, as an example. You can invoke the Git Push command from the Terminal by typing the following:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git push
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In addition, you can be more specific by typing the following:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git push origin master
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git status</title><link>http://uly.me/posts/git-status/</link><pubDate>Sat, 03 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-status/</guid><description>&lt;p&gt;Git Status is a command to display the status of files in the local working repository. It displays differences of files whether if updated or if it needs to committed to the repository. The Git Status command is typed in Terminal of the local working directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>subversion status</title><link>http://uly.me/posts/subversion-status/</link><pubDate>Sat, 03 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-status/</guid><description>&lt;p&gt;The Subversion Status command give you the status of the local working directory. Type this command in the Terminal to display the status.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn status
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git add</title><link>http://uly.me/posts/git-add/</link><pubDate>Fri, 02 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-add/</guid><description>&lt;p&gt;The Git Add command will add files to the current local working repository. This is how files are officially added to the local repository. You can specify one file or multiple files by using wildcards.&lt;/p&gt;
&lt;p&gt;Add one file&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git add sample.php
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add all files&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git add .
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Add all PHP files&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git add *.php
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git clone</title><link>http://uly.me/posts/git-clone/</link><pubDate>Fri, 02 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-clone/</guid><description>&lt;p&gt;Git Clone is a command used to make a copy of a Git repository to your local drive. It creates a new directory and creates a clone of the repository on the local drive. In the example below, a clone of an existing repository from Github is placed on the local computer. You initiate a clone by typing the following command on the Terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;// old way. does not work anymore.
git clone git@github.com:username/Project.git
// new way. use this from this point on.
git clone https://github.com/username/Project
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>git init</title><link>http://uly.me/posts/git-init/</link><pubDate>Fri, 02 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/git-init/</guid><description>&lt;p&gt;Git init is a command to start a new repository or reinitialize an existing one. You will need to type this command in the Terminal in the desired directory of your choice to start new repository.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There are options or switches you can add. See the &lt;a href="http://www.kernel.org/pub/software/scm/git/docs/git-init.html"&gt;manual&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>subversion commit</title><link>http://uly.me/posts/subversion-commit/</link><pubDate>Fri, 02 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-commit/</guid><description>&lt;p&gt;Once you are done editing, and are through with making file changes in the local working directory, you have the option to commit the changes to the Subversion repository. You simply type the following command from the Terminal to initiate a commit.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn commit -m &amp;#34;Place your comment here&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I encourage that you add comments, so you’ll know exactly what changes you’ve applied. Going forward, it will be easier to keep track of changes as you apply hundreds of commits to a project.&lt;/p&gt;</description></item><item><title>subversion import</title><link>http://uly.me/posts/subversion-import/</link><pubDate>Fri, 02 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-import/</guid><description>&lt;p&gt;Typically, you use the Subversion Import command to start or add a new project to a remote repository. Subversion recommends that you setup three directories called trunk, tags and branches under each project in a repository. Trunk will be the current version you are working on. Tags are for releases. Branches are when you fork projects based on one particular release. The following directory format under each project is recommended.&lt;/p&gt;</description></item><item><title>subversion tag</title><link>http://uly.me/posts/subversion-tag/</link><pubDate>Fri, 02 Nov 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-tag/</guid><description>&lt;p&gt;Subversion Tags are snapshots of a project at a certain time. Tags are ideal for version releases. To create a tag, you will need to type the following command in the Terminal. It’s a good idea when creating a project that you create a tag directory under the project directory. The tag directory will be the place where you can store all your tag releases in an organized way.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn copy http://repository/project/trunk \
http://repository/project/tags/1.0 \
-m &amp;#34;Place comments here.&amp;#34;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>css style switcher</title><link>http://uly.me/posts/css-style-switcher/</link><pubDate>Sun, 28 Oct 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/css-style-switcher/</guid><description>&lt;p&gt;Years ago, I implemented an &lt;a href="http://www.alistapart.com/articles/alternate/"&gt;alternative style switcher&lt;/a&gt; I found at &lt;a href="http://alistapart.com"&gt;A List Apart&lt;/a&gt;. But, that solution is quite old now. It was published eleven years ago, back in 2001. Now, I’m looking for something a little bit more modern, perhaps a solution that uses JQuery. The idea is to let the readers choose a CSS stylesheet of their liking by simply clicking on a link. So, here’s the finished product. &lt;a href="http://uly.me/demo/styleswitcher/"&gt;Demo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The Stylesheet&lt;/p&gt;</description></item><item><title>subversion add</title><link>http://uly.me/posts/subversion-add/</link><pubDate>Fri, 26 Oct 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-add/</guid><description>&lt;p&gt;Adding a file or directory to Subversion is quite easy. The following commands will add a file and a directory to the current Subversion working directory. The added file or directory is only added to the local working directory, and not to the Subversion repository. For that to happen, you’ll need to issue a Subversion commit to synch the files to the repository. The following commands simply add files and directories in the local working directory.&lt;/p&gt;</description></item><item><title>subversion checkout</title><link>http://uly.me/posts/subversion-checkout/</link><pubDate>Fri, 19 Oct 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/subversion-checkout/</guid><description>&lt;p&gt;The Subversion Checkout command is used to pull out a working copy of a project from the main Subversion repository. The Checkout command signals the start of using version control. This command is usually performed once at the beginning, but sometimes, it can also be performed whenever there are major changes to a project structure. To perform a checkout, type the following command in the Terminal.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;svn co http://repository/project/trunk .
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The period at the end is very important.&lt;/p&gt;</description></item><item><title>cloud journal</title><link>http://uly.me/posts/cloud-journal/</link><pubDate>Sun, 01 Jan 2012 00:00:00 +0000</pubDate><guid>http://uly.me/posts/cloud-journal/</guid><description>&lt;p&gt;Here are a few things I learned as a cloud engineer. Hope you find this website helpful. :)&lt;/p&gt;
&lt;p&gt;&lt;img loading="lazy" src="http://uly.me/wp-content/uploads/2012/01/blog.jpg" title="blog.jpg"&gt;&lt;/p&gt;</description></item></channel></rss>