Skip to content

Instantly share code, notes, and snippets.

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

Md. Sumon Islam sumonst21

🏠
Working from home
View GitHub Profile
@masasdani
masasdani / letsencrypt-nginx-centos.md
Last active May 26, 2021 13:00
letsencyript SSL nginx proxy centos 7

Install Letsencrypt Nginx Centos 7

install certbot

  sudo yum install epel-release
  sudo yum update
  sudo yum install certbot

install nginx

  sudo yum install nginx

sudo systemctl start nginx

@sumonst21
sumonst21 / sessions.php
Created August 27, 2021 04:12 — forked from fdorantesm/sessions.php
PHPSESSID Helper functions
<?php
function decode_session($data){
$temp = $_SESSION;
session_decode($data);
$out = $_SESSION;
$_SESSION = $temp;
return $out;
}
@neilgee
neilgee / acf-first-row.php
Last active September 17, 2021 18:20
ACF Repeater - Grab First/LAst or Random Single Data Row
<?php
//My ACF Fields for reference
//testimonials - field group
//testimonial - sub-field
//testimonial_header - sub-field
//First Repeater Row in Array
$rows = get_field( 'testimonials', 348 );// grab all rows from page ID
@wpmu-authors
wpmu-authors / AJAX-Action-Hook-Plugin-Functions.php
Created April 30, 2021 19:26
AJAX-Action-Hook-Plugin-Functions.php
<?php // used here only for enabling syntax highlighting. Leave this out if it's already included in your plugin file.
// define the actions for the two hooks created, first for logged in users and the next for logged out users
add_action("wp_ajax_my_user_like", "my_user_like");
add_action("wp_ajax_nopriv_my_user_like", "please_login");
// define the function to be fired for logged in users
function my_user_like() {
// nonce check for an extra layer of security, the function will exit if it fails
@LinzardMac
LinzardMac / 1-wp-config.php
Last active October 8, 2021 20:26
Stupid simple conditional config for local and production w/ constants.
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
<?php
// Version CSS file in a theme
wp_enqueue_style(
'theme-styles',
get_stylesheet_directory_uri() . '/style.css',
array(),
filemtime( get_stylesheet_directory() . '/style.css' )
);
@abeluck
abeluck / concat-mp4-annexb.md
Created September 20, 2012 17:50
Concat MP4 files using AnnexB bitstream format

Concat MP4 files without transcoding to mpeg

  1. Use the h264_mp4toannexb bitstream filter to convert the mp4s (video steam only) into the AnnexB bitstream format

    ffmpeg -i input1.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part1.ts
    # repeat for up to inputN
    
  2. Concat the files using cat

@tmaiaroto
tmaiaroto / image-proxy.conf
Last active December 16, 2021 03:23
Nginx Image Filter Resize Proxy Service
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.
@nepsilon
nepsilon / how-to-force-a-file-download-with-ningx.md
Last active January 10, 2022 05:29
How to force a file download with Nginx? — First published in fullweb.io issue #73

How to force a file download with Nginx?

In short:

add_header Content-Disposition 'attachment; filename="foo.txt"';

We’re just adding a Content-Disposition header in the response. You can specify the file name, here we’re using foo.txt.

# Centos 7.1
yum -y install wget
wget http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
rpm -ivh nux-dextop-release-0-5.el7.nux.noarch.rpm
yum -y install deluge-web
systemctl start deluge-web
systemctl stop firewalld