Skip to content

Instantly share code, notes, and snippets.

View thomasleveil's full-sized avatar

Thomas LÉVEIL thomasleveil

View GitHub Profile
@thomasleveil
thomasleveil / README.md
Created March 7, 2019 21:57
Traefik as an automatic reverse proxy in a docker-compose project

Here's a setup using a reverse proxy so that you can use relative url (instead of messing with domain names in your webpages) and which also has the advantage of taking care of CORS issues you would have while making ajax calls to your backend.

If you are not familiar with reverse proxies, just know that all http requests should first hit the reverse proxy, and the reverse proxy will take care of forwarding those http requests to the correct http server following a set of rules.

In the docker world, a very convenient reverse proxy is Traefik.

@hkuno9000
hkuno9000 / git-diff-excel.md
Last active December 30, 2023 13:47
How to git diff for MS-Excel files(xls/xlsx) on Windows-OS

How to git diff for MS-Excel files(xls/xlsx) on Windows-OS

  1. Download the xdoc2txt tool from: http://ebstudio.info/home/xdoc2txt.html#download
  2. extract "xdoc2txt.exe" and locate it on your PATH folder
  3. edit your gitattributes as A:
  4. edit your gitconfig as B:

A: append following texts to "~/.config/git/attributes" or ".git/info/attributes"

*.xls	diff=xdoc2txt
//------------------------------------------------
// Report on Budget vs Spend (Hybrid)
// Created by: Remko van der Zwaag & PDDS
// remkovanderzwaag.nl & pdds.nl
// More info: http://goo.gl/d0KVTd
// CHANGELOG
// 12-06-2014: Combined two separate scripts into one Hybrid version (for MCC and accounts)
// 12-02-2015: Added column Spend yesterday and empty columns with days
// 18-06-2015: Added logic to only check campaigns with a specific label
// 03-02-2016: Will check for labelled adgroups in ignored campaigns
@fotinakis
fotinakis / Jenkins auto-shudown-slaves job
Last active July 6, 2020 08:56
Auto-managed Jenkins slaves on Google Compute Engine
#!/bin/bash
# Have to redirect stderr to stdout here because slave.py uses stderr for output.
~/bin/slave.py list 2>&1 >/dev/null | grep beaker-slave- | while read slave; do
echo
echo "Checking status of $slave..."
# First, check if we can SSH into the host. If we can, then check the process and maybe shut down.
# This makes sure that we don't consider an SSH failure to be reason to shut down the node.
if ssh $slave echo < /dev/null; then
@willurd
willurd / web-servers.md
Last active July 12, 2024 11:21
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@n1ywb
n1ywb / retries.py
Created May 1, 2012 17:48
A Python function retrying decorator
#!/usr/bin/env python
#
# Copyright 2012 by Jeff Laughlin Consulting LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions: