Skip to content

Instantly share code, notes, and snippets.

View hamdifourati's full-sized avatar
☁️
working from the cloud 🌍 ☁️

Hamdi Fourati hamdifourati

☁️
working from the cloud 🌍 ☁️
View GitHub Profile
#!/bin/bash
# usage:
# curl -s https://gist.githubusercontent.com/hamdifourati/2f940556f0ebfd68e932585c557623d9/raw/kube.sh | sudo bash
#
set -ex
DOCKER_VERSION=18.09.9~3-0
CONTAINERD_VERSION=1.2.10-3
#!/bin/bash
# Usage:
# curl -s https://gist.githubusercontent.com/hamdifourati/9efaba113bc4cc3423a1a93674335002/raw/google-cloud-sdk-debian.sh | sudo bash
#
set -ex
apt install apt-transport-https ca-certificates gnupg -y

Tips and Tricks for using docker

Running a container without a daemon

 docker run --rm -it --name web-client hamdifourati/curl  su -c 'trap "exit 0" SIGTERM SIGKILL; tail -f /dev/null'
@hamdifourati
hamdifourati / top_java_import.py
Created March 14, 2018 09:44
Use Dataflow to count top imported packages in Java
#!/usr/bin/env python
"""
Copyright Google Inc. 2016
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@hamdifourati
hamdifourati / french-accent-letters.md
Last active March 28, 2020 10:48
French accent letters made easy for QWERTY keyboards

French Accent Marks


Character Number Alt Code Type of accent
â 131 Alt + 131 Circumflex
 182 or 0194 Alt + 182 or Alt + 0194 Circumflex
ä 132 Alt + 132 Tréma
Ä 142 Alt + 142 Tréma
à 133 Alt + 133 Accent grave
@hamdifourati
hamdifourati / telepresence_centos7.sh
Last active January 7, 2021 22:28
Hack your way to install Telepresence on CentOS7
#!/bin/bash
set -ex
yum update -y
# install python3.6
yum -y install yum-utils
yum -y groupinstall development
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
yum -y install python36u
@hamdifourati
hamdifourati / docker_java.md
Last active December 26, 2017 15:06
create and run Java project with ZERO configuration using docker.

Create a sample java project inside a docker container


Create Java project using maven

docker run -it --rm -v $PWD:/app/ maven:3-jdk-8 su -c"cd /app && mvn archetype:generate -DgroupId=info.hamdifourati.helloworld -DartifactId=hello-world -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false"

Build and package ( jar ) the java application

import os
import logging
# Use APP_ENV environment variable to determine app environment
# Default to `production`
APP_ENV = os.getenv('APP_ENV', 'production')
logging.basicConfig(
level=(logging.ERROR if APP_ENV is 'production' else logging.DEBUG )