cat bookmarks.txt | awk '/[^\]]$/' | less
Sunday, March 21, 2021
Sunday, December 13, 2015
nginx local proxy
I wanted just a simple nginx setup to forward to a local app. Here's the result:
http {
...
server {
server_name 52.62.72.255;
#access_log /var/log/nginx/histories.log;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
For some reason it was hard to find this info! I had to pull it from one of my other servers. But one good example is this reference: http://wiki.nginx.org/FullExample
Wednesday, July 15, 2015
Unable to SSH to new AWS servers, until: route table
Symptoms: I've had an AWS account for years, and I went back and created some instances this past week but then I couldn't access them (via SSH: "Operation timed out"). One oddity was that my old instances had no VPC ID, but every new instance had one (and the VPC was created if none existed).
Solution: I found this troubleshooting guide for connecting, and I followed the step on route tables and added a route with a destination of 0.0.0.0/0 and target of igw... (which is auto-filled with my internet gateway ID).
I've never had to do this before. Hopefully I'll remember!
Solution: I found this troubleshooting guide for connecting, and I followed the step on route tables and added a route with a destination of 0.0.0.0/0 and target of igw... (which is auto-filled with my internet gateway ID).
I've never had to do this before. Hopefully I'll remember!
Tuesday, May 5, 2015
PermanentRedirect when accessing AWS S3 bucket
When running this on the command-line:
aws s3 ls s3://my-bucket/I kept getting this error:
A client error (PermanentRedirect) occurred when calling the ListObjects operation: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.The problem was that my region wasn't set. I did this to fix it:
export AWS_DEFAULT_REGION=us-west-2This is a pretty stupid situation: when using the web console, the S3 service says that there's no need to choose a region, and it won't even let you select one. But obviously it's very important for configurations. Dumb.
Thursday, September 4, 2014
Solutions for Vagrant deployment to AWS
Here are a bunch of notes from troubleshooting Vagrant out to AWS:
... yep, destroy it
Saturday, August 16, 2014
Adding tables to Etherpad Lite
So I love the real-time sharing of Google Docs, so I installed our own Etherpad Lite... and then I wanted tables so I installed ep_tables, but it was a bear to try and copy existing tables into there, so I finally exported some tables and found the format and here's what I recommend, in this example of 2 lines:
{"payload":[["This is a sample row on table 1"," "," "]],"tblId":"1","tblClass":"data-tables"}
{"payload":[[" "," "," row 2 column 3"]],"tblId":"1","tblClass":"data-tables"}
... where each row of data is a line of text. Just paste them in the document and it reformats into a table.
It turns out the plugin doesn't like line breaks (or tabs) in a row, so don't even try... and that's one reason I wouldn't try and put multiple rows inside one payload line like this:
{"payload":[["This is a sample row on table 1","",""],["",""," row 2 column 3"]],"tblId":"1","tblClass":"data-tables"}
Since you can't split each row onto a new line it is pretty unreadable.
Other hints:
- Only use the 'Table' button at the top to manipulate the table and not the little mouse-overs... they just never did anything reliable for me.
- I also installed styles and formatting, but I couldn't get them to apply inside the table.
- I don't see the purpose of the tblId; I put rows with the same tblId in different places and they showed at their location in the document, with line breaks or whatever in between.
Monday, July 7, 2014
The day-of-week for any day this year (and this century)
I came up with this approach to figure out the day-of-week for any day during the current year:
- Each year, remember the weekday of first day of the year, eg. Wed in 2014 (See below for a formula for this in the 21st century.)
- Memorize this set of numbers, one for each month: 155274263153 ... which is the date of the first time that day occurs each month
You can probably get it from there... so here's an example: what day is Dec 25 this year?
- December is month #12, so take the last digit in that set of numbers: 3
- That means the 3rd is the first time that Wed occurs this December.
- Add multiples of 7 to get to other Wed that are close:
- +7=10
- +14=17
- +21 = 24
- Since Dec 24 is on Wed, Dec 25 must be on Thurs
- The exception is leap years, and I typically subtract one from the first day in January and February.
This makes it pretty easy, because that first weekday only changes each year and I can remember that day for the whole year.
Now, for the majority of my lifetime (if things don't go as I hope), it's actually pretty easy to find the first day of the year for any year:
- Take the year without the 2000 part, eg. 14 for 2014
- Calculate (y + y div 4) mod 7
- or (y mod 7 + y div 4) mod 7
- or (y mod 7 + (y div 4) mod 7) mod 7
- 0=Sun, 1=Mon, etc.
- except for on leap years (divisible by 4) subtract 1 day for Jan-Feb
Pretty easy to remember for us mathematicians... it starts with Sunday, and then moves one day each year with an extra adjustment on leap years.
The rules get really complicated for previous or future centuries because we don't have leap-years every 100 years but then we do have them every 400 years. But, like I say, this works for my foreseeable future, in 99.9% of the times I ever need to find a day.
I haven't written this up before because I checked years ago and found people had already written about this algorithm, but I think it's worth mentioning now because it's so easy for the vast majority of cases people use for a while to come. BTW, if I want a comprehensive algorithm, I'll probably try Conway's Doomsday Algorithm.
Subscribe to:
Posts (Atom)