Skip to content

Instantly share code, notes, and snippets.

@merong
merong / Vagrantfile
Created May 24, 2024 23:20 — forked from carthegian/Vagrantfile
A quick gist for Vagrant with Amazon Linux 2 + PHP 7.4. Specifically for kickstart communicating with Google APIs using gRPC.
# -*- mode: ruby -*-
# vi: set ft=ruby :
@script = <<SCRIPT
# Install php and extensions
# PHPと拡張をインストールする
sudo amazon-linux-extras install php7.4
sudo ln -s /usr/bin/php /usr/local/bin/php
@merong
merong / bypass_ssl_insecurities.py
Created September 16, 2023 13:44 — forked from sujit/bypass_ssl_insecurities.py
Selenium Bypass SSL Bad/Revoked Certificates
import sys
from time import sleep
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import WebDriverException
from eliot import start_action, to_file, log_call
# from selenium.webdriver.common.keys import Keys
# from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
# from selenium.webdriver.common.by import By
# from selenium.webdriver.support import expected_conditions as EC
@merong
merong / index.html
Created August 15, 2023 00:34 — forked from Shoora/index.html
Slider and Lightbox :: slider (swiper.js) & Lightbox gallery (photoswipe.js)
<h1>
<a title="swiper.js" href="http://idangero.us/swiper/" target="_blank">Swiper.js (4.3.5)</a>
&
<a title="photoswipe" href="http://photoswipe.com/" target="_blank">Photoswipe.js (4.1.1)</a>
- Mobile Native feel slider gallery
</h1>
<p>Combine two of the most powerfull JS plugins (Endless options / Great docs / Fast / Modern / Mobile freindly) - <a title="swiper.js" href="http://idangero.us/swiper/" target="_blank">SWIPER</a> IS PERFECT FOR THIS IDEA BEACUSE OF ITS unique <code>preventClicks</code> Parameter (Prevent accidental unwanted clicks on links during swiping) - <strong>Works like magic</strong>. Also its really <b>hard</b> to find - Code example of working photoswipe combination with any slider out there(slick, flickity, owl etc.) and in general slider & lightbox - so i hope this example be usefull for you.</p>
<!-- Slider main container -->
<div class="swiper-container">
@merong
merong / PDFTableStripper.java
Created July 19, 2022 19:25 — forked from beldaz/PDFTableStripper.java
Class to extract tabular PDF text using PDFBox
/*
* Copyright 2017 Beldaz (https://github.com/beldaz)
* 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
@merong
merong / nginx-tuning.md
Created April 15, 2022 07:35 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

#!/bin/sh
# install stable nginx
# even though nginx will be replaced
# by compiling from source
# this installs latest versions
# of required libs
add-apt-repository -y ppa:nginx/stable \
&& apt-get update \
&& apt-get install -y nginx \
@merong
merong / SimpleXMLElement-node-existence.php
Created June 11, 2021 02:53 — forked from Thinkscape/SimpleXMLElement-node-existence.php
How to check if a <child> node exists in SimpleXMLElement document ? Comparison of different approaches.
<?php
/**
* The only reliable way of determining if a child exists
* in SimpleXMLElement is to use count(). All other methods
* do not work reliably in global or local NS.
*
* NOTE: Error suppresion on @count() is used to suppress
* "PHP Warning: count(): Node no longer exists"
*/
if(!class_exists('SimpleXMLElement')) die("Bonkers");
@merong
merong / nginx.conf
Created January 18, 2020 10:40 — forked from CSRaghunandan/nginx.conf
Nginx configuration for serving mp4 videos
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@merong
merong / HTML: HTML5 Default Template
Created August 31, 2018 04:17 — forked from fakiolinho/HTML: HTML5 Default Template
HTML: HTML5 Default Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<!-- Favicons Start -->
<!-- In case image.ico -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
@merong
merong / README.md
Created April 24, 2018 11:45 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc