Skip to content

Instantly share code, notes, and snippets.

View Sharaf5's full-sized avatar
🏠
Working from home

Abdelaziz Sharaf Sharaf5

🏠
Working from home
View GitHub Profile
extends Camera
var _duration = 0.0
var _period_in_ms = 0.0
var _amplitude = 0.0
var _timer = 0.0
var _last_shook_timer = 0
var _previous_x = 0.0
var _previous_z = 0.0
@thiagodiniz
thiagodiniz / html_parser.py
Created July 4, 2019 18:07
HTML 2 DOCX @ Python
# -*- coding: utf-8 -*-
import io
import requests
from bs4 import NavigableString, BeautifulSoup
from docx import Document as DocxDocument
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Cm, Pt, Mm
from docx.image.exceptions import UnrecognizedImageError
from lxml import etree
@kekru
kekru / 01nginx-tls-sni.md
Last active May 6, 2024 14:59
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@Julian-Nash
Julian-Nash / flask_sitemap_generator.py
Last active May 4, 2024 13:03
Flask dynamic sitemap generator
@app.route("/sitemap")
@app.route("/sitemap/")
@app.route("/sitemap.xml")
def sitemap():
"""
Route to dynamically generate a sitemap of your website/application.
lastmod and priority tags omitted on static pages.
lastmod included on dynamic content such as blog posts.
"""
from flask import make_response, request, render_template
@Calinou
Calinou / godot_mingw.sh
Last active July 8, 2023 23:17
Compile Godot using MinGW and generate Windows installers using InnoSetup (from Linux)
#!/bin/sh
set -euo pipefail
# Number of CPU threads to use for building
# Use `./godot_mingw.sh <number of threads>` to specify
THREADS=$1
# Godot Git clone path
GODOT_PATH="$HOME/Documents/Git/godotengine/godot"
@estorgio
estorgio / Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS.md
Last active March 8, 2024 17:34
Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

Update 28 July 2019: An updated version of this guide for Ubuntu Server 18.04 LTS is now available. Feel free to check it out.

Update 23 May 2020: This guide is ALREADY OUTDATED and might no longer work with new versions of Ubuntu and VirtualBox. Please consider switching to the updated guide instead. I will no longer respond to the replies to this gist. Thank you.

Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

@Calinou
Calinou / godot_android.bat
Created September 9, 2017 20:25
Compile Godot for Android (from Windows)
@ECHO OFF
set threads=%NUMBER_OF_PROCESSORS%
call scons platform=android tools=no target=release_debug verbose=no warnings=no progress=no -j%threads%
call scons platform=android tools=no target=release verbose=no warnings=no progress=no -j%threads%
cd platform\android\java\
call gradlew build
@Calinou
Calinou / build_javascript.bat
Last active July 8, 2023 23:22
Compile Godot for HTML5 easily (from Windows)
:: This script must be run from a Windows system with the Emscripten SDK
:: installed and configured. 7-Zip and MinGW also need to be installed.
:: Place this script at the root of your Godot Git clone.
:: CC0 1.0 Universal
set threads=%NUMBER_OF_PROCESSORS%
:: Set MinGW path
set PATH=%PROGRAMFILES%\mingw-w64\x86_64-6.2.0-posix-seh-rt_v5-rev0\mingw64\bin\;%PATH%
@Calinou
Calinou / build_linux.sh
Last active July 8, 2023 23:24
Compile Godot for GNU/Linux 64-bit easily
#!/bin/sh -x
# This script compiles Godot for GNU/Linux in 64-bit.
# Place this script at the root of your Godot Git clone.
# CC0 1.0 Universal
# Build 64-bit Godot for GNU/Linux desktop, in debug and release mode
scons p=x11 -j$(nproc) verbose=no tools=yes target=release_debug openssl=builtin
scons p=x11 -j$(nproc) verbose=no tools=no target=release_debug openssl=builtin
@Calinou
Calinou / update-svn.sh
Last active July 8, 2023 23:25
Updates all Subversion repositories in a directory
#!/bin/bash
# Copyright (c) 2015 Calinou
# CC0 1.0 Universal
# <https://creativecommons.org/publicdomain/zero/1.0/>
update() {
for d in "$@"; do
test -d "$d" -a \! -L "$d" || continue
cd "$d"