Skip to content

Instantly share code, notes, and snippets.

View alextercete's full-sized avatar

Alex Tercete alextercete

View GitHub Profile
@alextercete
alextercete / Program.cs
Created December 18, 2017 11:06
Optional parameter unexpected behaviour
using System;
using System.Linq;
namespace OptionalParameterUnexpectedBehaviour
{
class Program
{
static void Main(string[] args)
{
var numbers = Enumerable.Range(1, 5);
@alextercete
alextercete / docker-wwi.sh
Last active August 7, 2023 16:14
Create a docker container for the WideWorldImporters database
#!/bin/bash
# See: https://docs.microsoft.com/en-us/sql/linux/tutorial-restore-backup-in-sql-server-container
SA_PASSWORD=<YourStrong!Passw0rd>
function show_info {
tput setaf 6; echo $1; tput sgr 0
}
show_info 'Pulling the container image...'
@alextercete
alextercete / stalk-makers.py
Created January 2, 2018 15:09
Try to find a Makers graduate GitHub CV from their name
import argparse
import requests
def parse_command_line_args():
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--token', required=True)
parser.add_argument('-n', '--name', required=True)
args = parser.parse_args()
return args.token, args.name

Leap years

Problem

  1. All years divisible by 400 ARE leap years (so, for example, 2000 was indeed a leap year)
  2. All years divisible by 100 but not by 400 are NOT leap years (so, for example, 1700, 1800, and 1900 were NOT leap years, NOR will 2100 be a leap year)
  3. All years divisible by 4 but not by 100 ARE leap years (e.g., 2008, 2012, 2016)
  4. All years not divisible by 4 are NOT leap years (e.g. 2017, 2018, 2019)

See:

WSL 1, Docker and Vagrant+Virtualbox

Set up Windows

  1. Install docker-machine

  2. Create a Docker machine named default, sharing D:\ (only one drive can be specified):

Overcome your fear of Git

Useful shell commands

Create file

touch A

Duplicate file