Sometimes you need to test input with a long string and it is useful to easily see the index of each position so that you can see how much is read or tuncated or whatever. Here is a handy string that I use. It is divided up into 10 character blocks with no special characters or spacing (to see how wrapping will work or not work in some cases). Each block starts with an “L” and ends with an “I” with “x”s and a number indicating position between. This particular one is 1100 characters long, but it should be easy to extend or modify as needed. Copy and paste is hella easier than making this by hand or using random characters that don’t indicate position easily.
So, today I learned from a typo, that the GAE dev app server treats pathing defined in the @ApiMethod annotation differently than the cloud server. In the dev app server, a path like either
path = “/endpoint”
path = “endpoint”
will resolve to
Where as the cloud GAE will resolve it as either
This had me scratching my head for a while, but it is an interesting thing to remember and it may have some useful applications.
There are times when a proxy server is necessary. This article will not go into what a proxy server is or why you might need one, but this will give you step by step instructions on how to set up the squid proxy server on a Google Compute Engine (GCE) server. This document assumes that you have a Google Cloud account and that you know how to set up a GCE server with Ubuntu. Lines in a
Fixed Width Font are commands that should be entered into the command shell.
This can be run on a GCE that has other things on it, but for personal use, a simple GCE f1-micro (1 vCPU, 0.6 GB memory) should be more than enough power. Start your GCE and SSH into the machine to get a command line then do these simple steps.
- Install squid
- Install apache utils
sudo apt-get install apache2-utils
- This Installs the htpasswd utility that allows for creating password files.
- Copy the default configuration file to back it up.
sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.original
- Delete the old configuration file
sudo rm /etc/squid/squid.conf
- This configuration file is ridiculously huge and has way more than any simple case would need. We will just back it up and make a new one with only the information that we need.
- Make a new configuration files
sudo vi /etc/squid/squid.conf
- Enter this in the config file
- Set up the username and password
sudo htpasswd -c /etc/squid/passwords [username]
- Replace [username] with any username you want to use
- You will be asked to enter and reenter a password for the username that you entered. make sure they match.
- Restart the squid service
sudo systemctl restart squid.service
You now have a proxy server. 🙂 To use it, you will need to find the external IP address for this GCE and use that along with the port that you set (8888 in this example) and the username and password that you set.
To make life easier, you may want to set an alias for starting squid. To do that, do the following:
- Open your bashrc file
- Scroll to the bottom of the file and add this line:
alias startsquid='sudo systemctl restart squid.service'
- Save the file
- reload your bashrc file so that you can use the new alias
- that’s (period)(space)~/.bashrc
- now you can restart it with the alias.