Skip to content

Instantly share code, notes, and snippets.

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

Edi Septriyanto joglomedia

🏠
Working from home
View GitHub Profile
@joglomedia
joglomedia / curl.md
Created September 16, 2019 07:40 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@joglomedia
joglomedia / my.cnf
Created August 31, 2019 02:08 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# === Updated December 2018 ===
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value
@joglomedia
joglomedia / ssh_port_checker.sh
Created June 23, 2019 16:09 — forked from skamithi/ssh_port_checker.sh
Bash script to detect if SSH port is active on remote host. Used it orchestrating vm creation using ansible.
#!/bin/bash
# Script for checking if SSH port is open
# Only checks that port is open. Not that actually SSH connection can occur
counter=0
result="ssh disabled"
if [ -z "$1" ]
then
echo "hostname argument required. Example ssh_port_checker.sh 10.1.1.1"
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@joglomedia
joglomedia / jquery.iframe_to_div.js
Created May 30, 2019 16:55 — forked from aklump/jquery.iframe_to_div.js
A jQuery plugin to replace iframes with divs containing their source by loading via ajax. Benefits use parent page's css and have an auto height to your iframe.
/**
* Convert iframes to divs via ajax iframe_to_div jQuery Plugin
*
* Uses javascript to replace iframes with divs containing their source content
* by loading via ajax. If you use this to load vanilla html snippets, this has the
* effect of applying the page's css to your vanilla html snippet.
*
* This will not work if the iframe src is not a relative link due to ajax restrictions across domains.
*
* As an example:
@joglomedia
joglomedia / gist:710ef8a5f9fbcf11b628baa54c831db4
Created February 16, 2019 12:22
FIX bash error “Cannot allocate memory” on Ubuntu Server
To get out of this condition without rebooting, you can trigger the OOM killer manually as follows:
echo 1 > /proc/sys/kernel/sysrq
echo f > /proc/sysrq-trigger
echo 0 > /proc/sys/kernel/sysrq
Ref : https://askubuntu.com/questions/845233/running-any-command-returns-cannot-allocate-memory-on-ubuntu-server
## How to install mcrypt in php7.2
##
## https://lukasmestan.com/install-mcrypt-extension-in-php7-2/
##
#
# Check version php and pecl
#
php -v # if default php is not 7.2 then use /usr/bin/php7.2 instead php
@joglomedia
joglomedia / build_ngx_pagespeed_xtr.sh
Created November 24, 2018 07:44
Build Nginx with PageSpeed module and other extra additional module. A fork of build_ngx_pagespeed.sh
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@joglomedia
joglomedia / gist:82a5bcb9456e4c335751cbdbbfc548e6
Created July 22, 2018 17:09 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using:

@joglomedia
joglomedia / compile-nginx-from-source.sh
Last active January 20, 2023 04:52 — forked from nurrony/compile-nginx-from-source.sh
All configuration files needed to install nginx on Ubuntu 16.04 Compile Nginx from source with nginx-rtmp-module, pagespeed and cache-purge module.
#change it to latest version
#NGX_VERSION=1.12.0;
NPS_VERSION=1.11.33.4;
echo "Changing Directory to $HOME..."
cd $HOME;
echo "Nginx version to install: " && \
read NGINX_VERSION && \
echo "Downloading nginx-$NGINX_VERSION..." && \
wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \