Skip to content

Instantly share code, notes, and snippets.

Working from home

Subhan Nooriansyah subhanshuja

Working from home
View GitHub Profile
subhanshuja / Laravel nginx config to redirect all requests to https and an exception URL that can still be accessible via http


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
subhanshuja / Account.php
Last active Nov 26, 2020
Abstract Class User in Php
View Account.php
$path = dirname(__DIR__, 1);
$path .= '/models/UserModel.php';
require_once $path;
class Account extends User {
private $userId;
subhanshuja /
Last active Nov 10, 2020
download file modern js without npm using bash
function validate_url(){
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi
# file list of url
while IFS= read -r line; do
if `validate_url $line > /dev/null`; then wget $line -P /path/lib/; else echo "doesn't exist"; fi
subhanshuja /
Created Aug 13, 2020 — forked from Yinchie/
Compiling NGiNX with OpenSSL TLS1.3, Brotli, more_headers, NAXSI - Ubuntu 18.04 x64
#!/usr/bin/env bash
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use the root user to install the software."
exit 1
# Make script exit if a simple command fails and
# Make script print commands being executed
subhanshuja /
Created Jul 16, 2020
porting javascript to python backtrack Road to Genius: superior #51
# javascript reference:
# function backtrack(list, tempList, nums, start) {
# list.push([...tempList]);
# for(let i = start; i < nums.length; i++) {
# tempList.push(nums[i]);
# backtrack(list, tempList, nums, i + 1);
# tempList.pop();
# }
# }
subhanshuja / ineventhandler.kt
Last active Jun 30, 2020
Sever Sent Event (SSE)
View ineventhandler.kt
interface DefaultEventHandler : EventHandler {
override fun onOpen() {
override fun onClosed() {
subhanshuja /
Created Dec 27, 2017 — forked from glennq/
Benchmarks for learning rate updating schemes in MLP
import numpy as np
from time import time
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification
from sklearn.neural_network import MLPClassifier
subhanshuja / index.html
Created Apr 20, 2013
A CodePen by schobiwan. Life timeline - This is a little life and work timeline project I was working on. Made with Fontello icon fonts, a filter navigation system, a bit of jquery and a bunch of CSS3 features. Feel free to use the 'J' and 'K' keys for navigation. Will feel much better on full screen.
View index.html
<ul id="main_nav">
<li class="active all" data-title="all" title="All">All</li>
<li class="icon-address active" data-title="life" title="Life Events"></li>
<li class="icon-graduation-cap active" data-title="education" title="Education"></li>
<li class="icon-briefcase active" data-title="work" title="Work"></li>
<li class="icon-user active" data-title="user" title="Additional Info"></li>