This article looks at installing a Squid proxy server on Ubuntu 18.04. First let’s look at what a proxy is. What is a Proxy A proxy is an intermediary between two systems. This can be a proxy server caching images onto a network so each subsequent visitor gets a better, faster experience or a proxy can be an Apple Software Update Server running on macOS server that is specifically tuned to cache slices of apps so large networks don’t get crushed when downloading software. These are known as forward proxies. There are also reverse proxies, which live on the side of a web server and proxy incoming requests. Tomcat, Apache…
-
-
Quick and Dirty dnsmasq Install On Ubuntu 18.04 on AWS EC2 Instances
These days, when using AWS, we usually use Amazon’s Route 53 service for DNS. It’s nearly free and super-simple. But there are several reasons why we might choose to use a DNS server of our own. These days, while bind9 continues to be an exceptional choice, when scripting or containerizing, dnsmasq is often far easier to automate against (although unless there are a crapload of domains, not as easy as route53). So let’s look at a basic setup real quick. Before we start, it’s worth noting that for dns host resolvers to work in EC2 instances the security group for a vm needs to have 53 UDP open for ingress…
-
Kubectl: Echo and Check
After a virtual machine is provisioned and booted, we can echo the server and check that the cluster is deployed properly. Here, we’ll use a yaml file called kube_cluster_config604.yml (but your name may be different). That file should be in the directory with the cloned repo. We’ll kick it off with the kubectl binary. First, we’ll run a simple kubectl defining the –kubeconfig and then the yml file and apply a command that is an echo.yml (to see an example of that, check out( https://github.com/spinnaker/echo/blob/master/echo-web/config/echo.yml): kubectl --kubeconfig kube_cluster_config604.yml apply -f echo.yml We can then check the deployment using a get verb followed by pod, deployment, ingress, and sac: kubectl --kubeconfig…
-
A Brief History of Time
Noooooo – a different Brief History of Time… Time is important; so important that it’s epic! Or epoch more specifically. The epoch is a date and time from which a computer measures the time on the system. Most operating systems derive their time from the number of seconds that have passed since January 1st, 1970 when the clock struck midnight. Why? Because this is when time began – likely the Catch-22 the movie, which came out later that year was made based on this fact. As with most things awesome in computing, this came from Unix. More specifically, taken from Unix Epoch time. MATLAB uses January 0, 1BC – which…
-
Pull iTunes App Categories via Bash
I love bash one-liners. Here’s one it took me a bit to get just right that will pull the Category of an app based on the URL of the app. curl -s 'https://itunes.apple.com/us/app/self-service-mobile/id718509958?mt=8' | grep -Eo '"applicationCategory":.*?[^\\]",' If you don’t already have the URL for an app, it can be obtained via a lookup using curl https://itunes.apple.com/lookup?id=718509958 If you’ll be performing these kinds of operations en masse from within server-side scripting, Apple has a number of programs, including the Affiliate Program, which allow you to do so more gracefully. But as a quick and dirty part of a script, this could solve a need. More importantly, hey, parse some json…
-
Scripting Instances On Google Cloud From A Mac
Over the users I’ve written a good bit about pushing a workload off to a virtual machine sitting in a data center somewhere. The Google CloudPlatform has matured a lot and I haven’t really gotten around to writing about it. So… It’s worth going into their SDK and what it looks like from a shell using some quick examples. For starters, you’ll need an account with Google Cloud Platform, at cloud.google.com and you’ll want to go ahead and login to the interface, which is pretty self-explanatory (although at first you might have to hunt a little for some of the more finely grained features, like zoning virtual instances. The SDK…
-
To Hex And Back
The xxd is a bash command in Linux and macOS that is used to take a hexdump (convert a string to hex), or convert hex back to a string. To use xxd, just call it with a couple of options. Below, we’ll use the -p option to export into plain hexdump, and we’ll quote it and the <<< is to take input rather than a file name to convert (the default behavior), as follows: xxd -p <<< "hey it's a string" The output would be a hex string, as follows: 6865792069742773206120737472696e670a Then use the -r option to revert your hex back to text. Since xxd doesn’t allow for a positional…
-
Basic Bash Functions
According to @johnkitzmiller, you can’t spell function without fun. So let’s have some fun! What’s a function? Think of it as a script inside a script. Define functions at the beginning of the script instead of making repeated calls to the same task within a script. The other nice thing about functions is that the act of compartmentalization makes them simple to insert into a number of different scripts. For example, if you do a lot of curl commands to pull down something in a lot of different scripts, having the grabbing of the data as a function, then the parsing of it into an array as a function and…
-
Basic Bash Inputs
Recently someone asked me about accepting bash inputs. So I decided to take a stab at writing a little about it up. For the initial one we’ll look at accepting text input. Here, we’ll just sandwich a read statement between two echo commands. In the first echo we’ll ask for a name of a variable. Then we’ll read it in with the read command. And in the second echo we’ll write it out. Using the variable involves using the string of the variable (myvariable in this case) with a dollar sign in front of it, as in $myvariable below: echo "Please choose a number: " read myvariable echo "You picked…
-
View The Content Of Files Without Comments In Bash
So I comment a lot of lines out in my /etc/hosts file. This usually means that I end up with a lot of cruft at the top of my file. And while I write comments into files and scripts here and there, I don’t always want to see them. So I can grep them out by piping the output of the file to grep as follows: cat /etc/hosts | grep -v "^#" You could also do the same, eliminating all lines that start with a “v” instead: cat !$ | grep -v "^v"