Skip to content

Instantly share code, notes, and snippets.

View dubuc's full-sized avatar

Gilles Dubuc dubuc

  • Montreal, Canada
View GitHub Profile
@dubuc
dubuc / gist:618bcbffc9ca502857ad04428c95266c
Created July 24, 2018 20:06
waagent /mnt/resource with cloud-init enabled
[dubuc@centos2-test ~]$ systemctl cat mnt.mount
# /run/systemd/generator/mnt.mount
# Automatically generated by systemd-fstab-generator
[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
RequiresOverridable=systemd-fsck@dev-disk-cloud-azure_resource\x2dpart1.service
After=systemd-fsck@dev-disk-cloud-azure_resource\x2dpart1.service
# cloud-init
device_aliases: {'ephemeral0': '/dev/sdb'}
disk_setup:
ephemeral0:
type: mbr
layout: True
overwrite: False
fs_setup:
@dubuc
dubuc / handy-windows-commands.md
Created April 10, 2018 01:51
Handy Windows Commands

Handy Windows Commands

This is a list of useful commands I found when using Windows

Create an empty file (equivalent to "touch" on Linux/macOS)

Run this on Command Prompt

copy NUL main.go

@dubuc
dubuc / get-largest-files.sh
Created April 4, 2018 17:53
Get largest files in git history
git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| awk '/^blob/ {print substr($0,6)}' \
| sort --numeric-sort --key=2 \
| cut --complement --characters=13-40 \
| numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
@dubuc
dubuc / gist:5abd49101ee5805345dd2cdc2609bfc6
Created February 22, 2018 19:20
Bitbucket Pipelines .Net Core
image: microsoft/dotnet:2.0.0-sdk
pipelines:
default:
- step:
script:
# This is necessary to pull from private repository. It is using Pipelines Env Vars
- git remote set-url origin https://$BITBUCKET_USERNAME:$BITBUCKET_PASSWORD@bitbucket.org/team/repo.git
- git submodule update --init --recursive
- export PROJECT_NAME=myProjectName
@dubuc
dubuc / cmake_build.py
Created February 15, 2018 20:10
Allows concurrent Windows builds without PDB pollution. Handy in CI environments.
import os
import uuid
import subprocess
from contextlib import contextmanager
@contextmanager
def mspdbsrv_execute():
os.environ['_MSPDBSRV_ENDPOINT_'] = str(uuid.uuid4())
mspdbsrv = os.path.join(os.environ['ProgramFiles(x86)'], 'Microsoft Visual Studio 14.0', 'Common7', 'IDE', 'mspdbsrv.exe') # VS2015
@dubuc
dubuc / JenkinsEnvironmentVariable.txt
Created February 9, 2018 00:46
Jenkins Pipeline Git Commit Email
env.GIT_COMMIT_EMAIL = sh (
script: 'git --no-pager show -s --format=\'%ae\'',
returnStdout: true
).trim()
@dubuc
dubuc / fwlinks.txt
Last active October 19, 2017 19:55
Microsoft Forward Links for Automation
@dubuc
dubuc / vim_cheatsheet.md
Created March 2, 2017 22:04 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close