Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
...

Emmanuel Robert Ssebaggala erssebaggala

:octocat:
...
View GitHub Profile
@erssebaggala
erssebaggala / laravel-nginx-config-make-http-exception-url-and-make-all-others-https.md Laravel nginx config to redirect all requests to https and an exception URL that can still be accessible via http
View laravel-nginx-config-make-http-exception-url-and-make-all-others-https.md

Pre-condition

One day in your Laravel app, you were required to redirect all http requests to https but need to make a certain URL route accessible via http for a certain reason; perhaps a portion of your javascript code needs to redirect to http URL but it can't because redirection to secure URL to insecure is prohibited. Therefore, in cases like this, you need to just allow just one URL to make an http connection.

NOTE: There are obvious security implications here so don't just follow this blindly and understand if this is really the solution you're looking for. The nginx config can somehow be improved, I just don't have the time yet. It sure do look redundant.

Understanding and examples

  • Redirect everything from http to https
@erssebaggala
erssebaggala / nginx.conf
Created Apr 7, 2020 — forked from mreschke/nginx.conf
Nginx config for multiple laravel sites based on /api/v1 url paths
View nginx.conf
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route
@erssebaggala
erssebaggala / express_in_electron.md
Created Oct 13, 2019 — forked from maximilian-lindsey/express_in_electron.md
How to run Express inside an Electron app
View express_in_electron.md

How to run Express inside an Electron app

You can run your Express app very easily inside your Electron app.

All you need to do is to:

  • place all the files of your Express app inside a new app folder in your_electron_app\resources\app
  • reconfigure the app.js file
  • refactor some relative pathes in your Express app
@erssebaggala
erssebaggala / express_in_electron.md
Created Oct 13, 2019 — forked from maximilian-lindsey/express_in_electron.md
How to run Express inside an Electron app
View express_in_electron.md

How to run Express inside an Electron app

You can run your Express app very easily inside your Electron app.

All you need to do is to:

  • place all the files of your Express app inside a new app folder in your_electron_app\resources\app
  • reconfigure the app.js file
  • refactor some relative pathes in your Express app
View EnvPaths.psm1
function Add-EnvPath {
param(
[Parameter(Mandatory=$true)]
[string] $Path,
[ValidateSet('Machine', 'User', 'Session')]
[string] $Container = 'Session'
)
if ($Container -ne 'Session') {
View Download and Install MongoDB as Windows Service PowerShell Script
#
# MongoDB (as a windows service)
#
$mongoDbPath = "$env:SystemDrive\MongoDB"
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg"
$url = "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-3.2.7.zip"
$zipFile = "$mongoDbPath\mongo.zip"
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-3.2.7"
if ((Test-Path -path $mongoDbPath) -eq $false)
@erssebaggala
erssebaggala / Hash_Code_Pizza_Practice_2018_Try_02.py
Created Feb 28, 2018
Hash_Code_Pizza_Practice_2018_Try_02.py
View Hash_Code_Pizza_Practice_2018_Try_02.py
import os
import sys
input_file = sys.argv[1]
def get_all_factors(n):
factors = []
for i in range(1,n+1):
if n%i == 0:
factors.append(i)
View Hash_Code_Pizza_Practice_2018_Try_01.py
import os
import sys
input_file = sys.argv[1]
def get_all_factors(n):
factors = []
for i in range(1,n+1):
if n%i == 0:
factors.append(i)
@erssebaggala
erssebaggala / update_bulkcm_mo_parent_id.py
Last active Feb 28, 2018
Update Bulk CM managed object parent id
View update_bulkcm_mo_parent_id.py
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import text
engine = create_engine('postgresql://bodastage:password@database/bts')
vendor_pk=3
tech_pk=3
table_schema='zte_cm_4g'