Skip to content

Instantly share code, notes, and snippets.

View pappu687's full-sized avatar

Md. Mahbubur Rahman pappu687

View GitHub Profile
@pappu687
pappu687 / wp-config.php
Created November 16, 2020 18:31
WP-CONFIG modifications for Wordpress sites behind EC2 Application Load Balancer. Fixes the redirect loop when trying to access /wp-admin
<?php
define('FORCE_SSL_ADMIN', true);
if ( (isset($_SERVER['HTTP_X_FORWARDED_PORT'] ) && ( '443' == $_SERVER['HTTP_X_FORWARDED_PORT'] ))
|| (isset($_SERVER['HTTP_CF_VISITOR']) && $_SERVER['HTTP_CF_VISITOR'] == '{"scheme":"https"}')) {
$_SERVER['HTTPS'] = 'on';
}
/**
* Rest of the wp-config.php below.
*/
@pappu687
pappu687 / gogs.conf
Created December 8, 2016 05:40
Supervisor Conf for Gogs (gogs Version: 0.9.99)
[program:gogs]
directory = /home/gogs/gogs-repositories
command=/usr/bin/gogs run web
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/gogs/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
@pappu687
pappu687 / amazon-scrap-schema.json
Last active November 1, 2016 04:25
Amazon Scrap Schema
{
"title" : "//*[@id='productTitle']"
}
@pappu687
pappu687 / import.md
Last active February 27, 2023 21:14
How to import large flat text file into mysql table

Import Large flat text file into mysql

Say you have a 1GB text file (words.txt) and has a word each line. Like this

1. John
2. Doe
3. Jane
4. Smith
@pappu687
pappu687 / overview-for-angular-apps-with-roles-and-permissions.md
Created May 1, 2016 08:56 — forked from bvaughn/overview-for-angular-apps-with-roles-and-permissions.md
RE: Reddit Angular JS question "Advice on separating the logical parts of an application"

This gist is in response to a question asked on the Reddit Angular JS forum about how to structure an Angular app with roles and permissions.

There are many ways to approach this, but I'll share one that I've used before and maybe it will give you an idea. I'd combine all of the above into a single app and control who gets to see what using permissions. There are a few components to this approach...

A local session service

First off I'd advise creating some sort of local session management service. This should be able to track whether you have an authenticated user and- if so- what types of permissions that user has. (Lots of ways to manage permissions. I'll assume your user object has either a 'role' enum or something simple like an array of string permissions.) You could roll your own session service or you could check out something like satellizer.

Let's assume yo

@pappu687
pappu687 / my-tmuxifier-layout.sh
Created January 10, 2016 12:33
My Tmuxifier for a Laravel project
window_root "~/Code/Project"
# Create new window. If no argument is given, window name will be based on
# layout file name.
new_window "canon"
# Split window into panes.
split_h 50
split_v 50 1
split_v 50 2
@pappu687
pappu687 / country-dropdown-de.txt
Created January 7, 2016 04:59
Country Dropdown in German
<select name="countries">
<option value="DE">Deutschland</option>
<option value="AT">Österreich</option>
<option value="CH">Schweiz</option>
<option value="LU">Luxemburg</option>
<option value="AF">Afghanistan</option>
<option value="EG">Ägypten</option>
<option value="AX">Åland</option>
<option value="AL">Albanien</option>
<option value="DZ">Algerien</option>
https://images.unsplash.com/photo-1448318440207-ef1893eb8ac0
https://images.unsplash.com/photo-1447678523326-1360892abab8
https://images.unsplash.com/photo-1445754574409-bcd715e18017
https://images.unsplash.com/photo-1444682717031-a2498d603d5b
https://images.unsplash.com/photo-1442405740009-7b57cca9d316
https://images.unsplash.com/photo-1439337153520-7082a56a81f4
https://images.unsplash.com/photo-1433832597046-4f10e10ac764
https://images.unsplash.com/photo-1430651717504-ebb9e3e6795e
https://images.unsplash.com/photo-1428190318100-06790c8b2e5a
https://images.unsplash.com/photo-1422504090664-c57eba84293f
@pappu687
pappu687 / global-js
Last active August 29, 2015 14:01
JavaScript Global
<html>
<head>
<script src="js-1.js"></script>
<script src="js-2.js"></script>
</head>
<body>
</body>
</html>
@pappu687
pappu687 / 0_reuse_code.js
Created April 14, 2014 15:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console