Skip to content

Instantly share code, notes, and snippets.

View knibals's full-sized avatar

Oumar Fall knibals

View GitHub Profile
@knibals
knibals / redirectExample.go
Created August 16, 2017 09:18 — forked from jaymecd/redirectExample.go
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
)
func redirect(w http.ResponseWriter, req *http.Request) {
http.Redirect(w, req,
"https://" + req.Host + req.URL.String(),
http.StatusMovedPermanently)
}
@knibals
knibals / d8-responsive-image-programmatically.php
Created April 9, 2022 09:39 — forked from szeidler/d8-responsive-image-programmatically.php
Load and render responsive image from field in Drupal 8
<?php
function _load_header_image($variables) {
if ($node = $variables['node']) {
// Load main_image
$file = $node->field_main_image->entity;
if ($file) {
$variables = array(
'responsive_image_style_id' => 'header_image',
'uri' => $file->getFileUri(),
@knibals
knibals / VS Code settings
Last active January 6, 2022 10:56
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-02-02T12:08:11.111Z","extensionVersion":"v3.4.3"}
@knibals
knibals / Youtube API sample with GO
Last active March 2, 2021 03:29 — forked from ikai/gist:1f746b018664f604e4cc
Code example for connection to Youtube API (written in Go -- #golang)
package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"net"
@knibals
knibals / HAProxy_self-signed_certificate.txt
Last active September 20, 2020 12:02 — forked from yuezhu/gist:47b15b4b8e944221861ccf7d7f5868f5
Generate self-signed certificate for HAProxy
# Generate a unique private key (KEY)
sudo openssl genrsa -out mydomain.key 2048
# Generating a Certificate Signing Request (CSR)
sudo openssl req -new -key mydomain.key -out mydomain.csr
# Creating a Self-Signed Certificate (CRT)
openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt
# Append KEY and CRT to mydomain.pem
@knibals
knibals / WHOIAM.md
Created May 28, 2020 12:57
Mon CV sur Github

Hi I'm Oumar and I'm a digital plumber

@knibals
knibals / drupal_nginx_config
Created January 4, 2020 00:42
The Nginx virtualhost for Drupal sites
server {
server_name example.com;
root /var/www/drupal8;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
@knibals
knibals / keybase.md
Last active September 22, 2019 11:56

Keybase proof

I hereby claim:

  • I am knibals on github.
  • I am knibals (https://keybase.io/knibals) on keybase.
  • I have a public key ASAt-c3vDWMV9XL6kUSeazJZGL7IJPKY6MjhzstWpkJS6Ao

To claim this, I am signing this object:

---
layout: post
section-type: post
title: Casually using a Proxy with Bash on Ubuntu on Windows
category: Win10
tags: [microsoft, canonical, windows, windows 10, bash, ubuntu, proxy, session, logon, enterprise, company, network]
---
With the **Microsoft Windows 10 Anniversary Update (1607)** we also got an integrated *Linux Subsystem* and the so called [Bash on Ubuntu on Windows], providing us with a familiar Bash shell and Linux environment in which you can run most Linux command-line tools, directly on Windows, **unmodified**, without needing an entire Linux virtual machine.
As I'm using my Surface Pro 4 within our company network as well as at home, I need to use a proxy-server only occasionally and wanted an easy method to switch it within the Bash.
@knibals
knibals / GitConfigHttpProxy.md
Created September 28, 2018 10:09 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

##In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like: