-
Update and Upgrade the server
$ sudo apt-get update && sudo apt-get upgrade
-
Follow instructions to add user
ubuntu
and grantubuntu
root priviledges -
Install
openssh-server
$ sudo apt-get install openssh-server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THIS LINUX SETUP SCRIPT HAS MORPHED INTO A WHOLE PROJECT: HTTPS://OMAKUB.ORG | |
# PLEASE CHECKOUT THAT PROJECT INSTEAD OF THIS OUTDATED SETUP SCRIPT. | |
# | |
# | |
# Libraries and infrastructure | |
sudo apt update -y | |
sudo apt install -y \ | |
docker.io docker-buildx \ | |
build-essential pkg-config autoconf bison rustc cargo clang \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This function is designed to duplicate all live INSERTS/UPDATES/DELETES from one table (referred to as "source_table_name" | |
-- to a second partitioned table (referred to as "destination_table_name"). The function should be set to trigger after insert/ | |
-- update/delete on the source table. | |
-- This function is designed to be leveraged for partitioned table migration through this method: | |
-- 1) Create an empty partitioned copy of the "source_table_name". Alter primary key as necessary, as partitioned Postgres | |
-- tables do not support unique/primary keys not included in the partition key. | |
-- 2) Create the following function, and attach it as a trigger to "source_table_name". At this point, incoming new DML is | |
-- being copied successfully to the partitioned table, so only historical data will need to be backfilled. | |
-- 3) Target rows in "source_table_name" with an updated_at value BEFORE the trigger was attached, and backfill them into |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instruct the interpreter to create a network request and create an object representing the request state. This can be done using the urllib module. | |
import urllib.request | |
import tarfile | |
thetarfile = "http://file.tar.gz" | |
ftpstream = urllib.request.urlopen(thetarfile) | |
thetarfile = tarfile.open(fileobj=ftpstream, mode="r|gz") | |
thetarfile.extractall() | |
# The ftpstream object is a file-like that represents the connection to the ftp server. Then the tarfile module can access this stream. Since we do not pass the filename, we have to specify the compression in the mode parameter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- The section describing iterators was configusing to me. http://www.lua.org/pil/7.1.html | |
-- | |
-- I think it simpler to describe the 'stateless' iterator first, then | |
-- go into the nitty details of a 'stateful' iterator using closures. | |
-- | |
-- | |
-- Example of making an iterator in lua | |
-- | |
-- The 'real' syntax for the 'for' statement is this | |
-- for <v> in <iter-fn>, <thing_2_iterate>, <initial-key> do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
====================================== | |
Setting up Nginx, uWSGI and Python3 | |
====================================== | |
First off, I'm traditionally a PHP developer, but am looking at moving across to Python. I really struggled to find decent documentation on how to get a server up and running for deploying Python web applications from the point of view of someone coming from PHP. The main problems I came across with documentation were: | |
1) Only showed you how to run the server for a single web application. | |
2) Only showed you how to configure the app, not the server it was running on. | |
My preferred workflow for development is by setting up a new VM in VMware Fusion and then forwarding through all requests to that VM via /etc/hosts. This might not be the optimal way to get things up and running, but it works for me. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Original code by Nick Brenn | |
Modified by Marc de Vinck | |
Make Projects Arduino-based 4WD robot | |
http://makeprojects.com/Project/Build-your-own-Arduino-Controlled-Robot-/577/1 | |
*/ | |
#include <AFMotor.h> | |
AF_DCMotor motor1(1, MOTOR12_8KHZ); | |
AF_DCMotor motor2(2, MOTOR12_8KHZ); | |
AF_DCMotor motor3(3, MOTOR12_1KHZ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
For some reason, the change() event only fires when the input field loses focus. | |
Binding to other options ('change keypress paste focus textInput input') will | |
fire the event several times, which is bad. The below code works even when | |
content is pasted into the text field, and only fires once as expected. | |
*/ | |
$('#search-form .term').bind('input', function(){ | |
console.log('this actually works'); | |
}); |
NewerOlder