Unfortunately duckdb doesn’t have an official package for OpenBSD so we need to compile it from source. It turns out you can’t get extensions after compilation because there are no official packages for OpenBSD. So make sure to compile with the extensions you need. Switch to a known release tag: git checkout tags/v1.1.2 pkg_add gmake cmake git clone https://github.com/duckdb/duckdb.git…
SSH has had a history of vulnerabilities which could lead to remote code execution or compromise your server. Spiped protects against 0-day vulnerabilities. It prevents anyone without the key from even attempting to connect. From the author: Since data is authenticated before being forwarded to the target, this can allow you to SSH to a host while protecting you in the event that someone finds an…
Ok today is going to be a quick post on how to change the Message Of The Day or MOTD. This is the message that you will see when you first log into your shell either through ssh or on the machine. The message of the day is really just a text file. It got its name because it was easier and used less disk space to send a message to all of your users than using email. To change the MOTD you have to…
Today, we will be using rsync to make daily, weekly, incremental backups and then a full compressed/archived backup once a month. We will then use cron to automate the process. Lets face it us humans get lazy sometimes and most backup systems loose complete effectiveness if they are not completely automated. What is rsync? Rsync is a great utility for syncing files/folders. Many times it is used…
It is important to make sure you site’s URL is either naked yoursite.com or with www. like www.yoursite.com . One should redirect to the other and you should keep is consistent for SEO. If you redirect naked to www. , and you use Go, you can use the following Go middleware to have all naked requests redirect with 301 to www. : func RedirectNakedToWWW(handler http.Handler) http.Handler {…
This article is here to help you get a jump start on using the UPS Shipping API. This article is part 1 of the series that will help you get all the required tools to get you up and running. Later the series will expand upon each service the API has to offer as well as go into detail on how to create your custom programs using various languages and show you examples with both PHP and other…
There are many guides out there on how to use WireGuard to create your own personal VPN to route all your traffic through a VPS (Virtual Private Server) for privacy or other reasons. This guide will focus on creating a VPN so you can connect to your home network on the go . This is guide is based on How to setup your own VPN server using WireGuard on Ubuntu . Motivation / Why? To connect to home…
Install mergerfs sudo apt install mergerfs Mount it /mnt/data1:/mnt/data2 /mnt/usb fuse.mergerfs category.create=mfs,nonempty,defaults,allow_other,minfreespace=20G,fsname=mergerfsPool 0 0 Reboot to mount as drives may already be mounted/used
I never want to copy a chunk of text and then later paste that text with all of its styles and formatting. I personally found that I have no purpose for this. My styles are never aligned with the same styles that I am copying from. Unfortunately, this is the default copy/paste behavior of OSX. Lets change that: Open System Preferences Select Keyboard Select tab Keyboard Shortcuts Select…
Every one hates to get political or an automated spam robo call; however, I recently had the opportunity to create one that people loved and it was stupid simple thanks to Twilio . My girlfriend has a tradition of reciting the speech from the movie Independence Day , on our Independence Day: She has the speech memorized and had been manually calling her friends each year to deliver the…
I am excited to announce that I have a new book coming out! Lately, I have been busy working on my side projects . One that I am particularly proud of is that I have moved from Montana to San Francisco and joined the Vonnda team. Since joining Vonnda I have learned a lot about the inner workings of Magento and how to properly develop extensions for the platform. We have really made Magento do some…
Ever wonder what RSS feeds I subscribe to? Here is a quick list of most of the feeds I subscribe to. Niche Alerts These are alerts that I have setup so I can see if I am mentioned on twitter or if a general term is being talked about. Some of these keywords will generate tons of alerts. For the ones with many alerts I will usually scan these weekly to see any trending topics. Google Alerts: Linux…
Ever want to schedule a tweet to go out at the same time an article is published or an event is started? Want to do it without signing up to a service or some other complicated task? Well this post is for you. I am going to show you how to schedule a tweet from the command line in one line of code. You can schedule the tweet to take place ten minutes from now, 14 days, or whenever you wish .…
As you may have noticed posts have slowed a little here on MarkSanborn.net. This is due to my involvement in two new projects. NixTutor NixTutor is a new blog/tutorial site that I created to cater to those that love and use unix like systems. NixTutor will have full guides and indepth tutorials regarding various unix like topics including: Linux FreeBSD OpenBSD NetBSD Solaris Open Source Software…
Well we decided that podcasting was fun and many of our listeners enjoyed it so we continuing with the project. We opened a website up at faceoffshow.com Although the site is not quite up yet, expect a full feature site with proper itunes compatible feeds soon! In the mean time you can download the podcast directly from here: Episode 2: Topics include: Technology people to follow on Twitter Web…
This is the first episode of our new podcast called, Face Off. This was our first recording of any kind ever. Since this is our first podcast it is very amateur. There are times in the podcast where there is light swearing. The first recording was also not structured and was never really meant to be a podcast until we were done and had over an hour worth of material we wanted to share, so, please…
Whenever I download something that is compressed on the Internet in a .zip, .rar or .tar.gz it is always a crapshot whether or not it contains a “container directory”. A “container directory” is a directory that contains all the other files usually with the same name as the compressed file. For example the Zend Framework when downloaded contains a folder called, ‘…
One of the first parts of the checkout process of any ecommerce site is to provide the customer with a dropdown box with shipping options. In this tutorial we are going to shop for various UPS rates and display them in a convenient drop down. If you are new to the UPS API first read this article, Mastering the UPS Shipping API: Getting Started . You will need to have access to UPS’s online…
If you have ever been in an irc channel or IM and needed to show another programmer your code you have probably used Pastebin before or a similar service. You simply go to the website copy and paste and hit submit and you have a link generated so you can hand it out to your fellow programmer. I’m always someone that is looking for a faster/better way of doing things and copying, pasting,…
Just recently I found a post that described using the ipseccmd in Windows. I honestly had no idea that this tool existed for Windows. I found this article while searching for a way to block outgoing traffic on the local computer as apposed to making firewall policies. This was the perfect solution for network testing, forcing productivity, optimization and security in Windows. To get the firewall…
So recently a friend of mine , had a client that had a very odd problem. His website was working fine when you go to it directly by typing in the domain name; however, if you searched for the site in Google and clicked the link for the site it would take you to a hijacked page. So the page only appeared hijacked when the referral was coming from Google. The hijack could go unnoticed for months.…
Random string generators are something we programmers end up using quite a bit. Sometimes you want to generate a random file name, a random email verification link, a random password, random token, etc.. Here is the one that I have been using lately. This password generator uses the Mersenne Twister algorithm to generate random digits. You can learn more about it at Wikipedia or on Makoto…
Update: For a no fuss, 100% complete USPS script with label printing support, integration and support I have created, RocketShipIt . If you have been following the posts on USPS you should know how to calculate USPS shipping rates with PHP . Today we are going to use the same USPS API to print out a label. One of the advantages of this is that you get free tracking on all priority shipments when…
Let’s say you are working on an important email, document, or a critical website bug and your computer suddenly crashes and wont boot up. You have to get this work done right away what do you do? With a live CD you can be up and running in two minutes with the tools you need to finish the job. When you are done with your work you can use the live CD to actually fix your computer. Whether you…
Frameworks seem to be popping up all over the place for all sorts of languages. These frameworks all have one goal. They are looking to reduce development time. Time is money and when you are working on client’s sites frameworks can drastically reduce the development time. For this reason frameworks are not going away any time soon. Why a framework? If you haven’t tried a framework for…
Email addresses are one of trickiest input types to validate because there are multiple ways emails can be written according to the RFC2822 specification. You could have me@gmail.com , or me+spam@gmail.com , or “mark@server”@marksanborn.net , common on Linux/BSD systems. A lot of times people will use a regular expression like: (\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6}) This regular expression…
Ever wonder how websites can tell you made a mistake entering your credit card number before you even submit it? Like most identification numbers credit cards have checksum digits built into them. Just like barcodes. If you ever look at a EAN-13 UPC barcode (on all retail products) you will notice there is a digit outside of the regular set on the right. If any digit is out of order or mistyped…
Well for the short answer all you have to do is ask your self this simple question. Would you give your mail, credit cards and other personal information to a complete stranger? Probably not. By connecting to someone else’s internet connection you are giving them complete control over the data that you send from your computer. This may include mail, credit card information, and personal…
Flash doesn’t come with Ubuntu by default so we need to install if for all of our browsers if we want to view any sites that have flash. Adobe provides an easy deb installation file to install it for browsers like Firefox but not Opera. Although the package from Adobe doesn’t automatically install flash for Opera, adding it manually is as simple as copying over a file. Download the…
When learning regular expressions it is helpful to be able to quickly test regular expression patterns. It doesn’t really matter which proramming language you use to build it but I will give you two examples, one in Perl and one in PHP. If you are new to regular expressions first check out, Learning Regular Expressions For Beginners: The Basics . It will run your through your first example.…
SVN is one of those things that you love once you know what and how it works. SVN is a version control system used by almost all major open source projects and is an absolute dream to work with. If you have ever worked with a team of developers you probably have had the experience of having your code accidentally written over or deleted. With SVN you have version control where you can revert…
Well I just recently hooked up a DSL connection via a DSL modem that was also a router. For regular home users this DSL modem/router is probably good enough but for more complex setups it is useless. In this particular setup we had a custom built firewall. This firewall had a built in dynamic DNS service for ISP’s that rotate IP addresses. The problem however, is that the firewall was behind…
If you consider yourself a programmer and you have not learned regular expressions yet now is the time! At some point in your development you will need to manipulate strings in more complicated ways that simple string functions can’t provide. Regular expressions are used in almost all programming languages and are considered the de facto standard for string manipulation. Regular expressions…
Out of popularity I have decided to take UPS modules written in PHP found in my article, Calculating UPS Shipping Rate with PHP , over to the next level. I am rewriting all the code in object oriented PHP and publishing the code on Google Code under GNU General Public License v3 to ease implementation. I am also going to be writing official documentation in the Google Code wiki pages . This…
Well if you have decided to take the plunge into Perl I commend you. So far my experience with Perl has been really great. I have already made very useful programs for both Windows and Linux. Coming from a web development background I like to think of Perl as the “PHP for operating systems”. If PHP is great for creating dynamic websites, Perl is great for manipulating anything to do…
Eric Wendelin over at eriwen.com was kind enough to let me post an article about Vim on his blog today. It is a nice guide to Vim for people that have never used Vim looking to add some productivity to their programing. If you have used Vim for years you might learn something as well. While you are there check out some of his other articles. There are some great ones on grep , sed , awk , and lots…
With my newly acquired Perl and regular expression skills I was trying to put them to the test and get a little practice. I asked a friend of mine if he had any regular expressions I should write. He first gave me an easy one. Replace ‘ foo ’ with ‘ bar ’ only when bar follows the word ‘ blah ’. So after a minute or two I returned with a working regular…
Google Chrome is the new browser that was just relased by Google in an attempt to capture the browser market to give them a significant advantage to their search/advertising business. With Chrome Google will be able to track what actions the browser takes to further narrow down pagerank of sites. Google Chrome uses Webkit as its rendering engine. WebKit is also the name of the Mac OS X system…
In response to David’s post on PHP IMDB Information Grabber , I thought I would extend his idea and grab the cover image for the movie and save it. So basically you give this script the IMDB number OR the actual movie title and it will go out and try to find it and download the image that IMDB has on file and store it on your hard drive. By default the file will be downloaded into the…
I don’t want to have to login to Twitter all the time to do updates. So what I made was a script that displays a small text box near my twitter updates on my blog when I am logged in. This is handy because not only does is display your tweets it also gives you an opportunity to update them while you are working on a blog post or just browsing around checking your own blog. The Perl Script I…
I am on a huge Perl kick lately. I have been making tons of different perl scripts for many different uses. Some of them useful and some are just plain silly. In this post we are going to talk about making an easy script that will go out and check the pagerank of any site that you want. Then we will make the script run through PHP so we can display our result on a website. The Perl This is a…
After reading the chapter in my Perl book about regular expressions I decided to go ahead and solve one of the problems I usually have when getting cURL data. Often times I had cURL report back the HTTP header with the XML data. Although I can disable this and tell cURL to only display the XML data, I wanted to be able to use the header data to distinguish if the website is reachable or not. This…
When programming in Perl or any language that requires you to run it from shell it is often helpful to have two screens open at once. One screen for your editor and one screen for running the program. This is how most IDEs (Integrated Development Environment) are structured; however, since I love Vim and the Linux command line I use a program called screen to make my own IDE type setup. Here is…
Sometimes it is helpful to know which ports are currently open on your server. On my FreeBSD servers I like to use the sockstat command. It is very similar to the netstat command for Windows or Linux. You can configure it to show IPv4 ports, IPv6 or both. One of the benefits of checking your server’s open ports with sockstat, is its ability to generate a quick list of all your services. Once…
Now that you have MySQL installed you might want to install the famous Apache web browser on your FreeBSD system. This post will be a quick walk through for installing Apache with PHP5 with mostly default settings to help you get going quick. To install the latest version of Apache run this as root: `# cd /usr/ports/www/apache22 make install clean` I find that the defaults are usually fine when…
I have had some serious issues integrating Twitter into my site using the javascript method. Firefox seems to load the twitter updates every time without a problem; however, Internet Explorer and Opera both have issues. Opera for example will load the twitter updates on the first load of the page or if the twitter feed has been updated but will not load the second time the page is loaded. You can…
curl usage explained - I love curl! Using cURL to interact with Google data services - A great resource from Google showing common usages of cURL interacting with their services. Test your ISP - This is a very interesting project lead by the Electronic Frontier Foundation. In light of the recent comcast debacle they have started a project that helps you determine if your ISP is up to no good. They…
Ever dream about automating mundane tasks? Or wish you could train you computer to do your work for you? I think we would all love to have the power of automation in our lives. With AutoIt we can easily take a boring repetitive task and automate it. AutoIt can send key strokes and mouse movements to your computer. But what makes AutoIt most useful is that it is actually a scripting language…
I have a script on my local computer that needs to send data to my website for further processesing. To accomplish this I use a powerful tool called cURL . cURL is an open source program that lets me send or recieve HTML data in pretty much any structure you could think of. I am going to use cURL to send POST data to a PHP script on the site. Make sure you have cURL. curl -V This should print out…
Getting consistent margins in CSS across all browsers can be a pain. I have tried quite a few CSS clears but this one seems to work the best for me. The reason these come in handy is because IE, Firefox, and Opera all have different default margins and can cause weird formatting issues later on. This is why I usually include this on the first line of my CSS sheets. This clears out all the margin…