Skip to content

Instantly share code, notes, and snippets.

View echr's full-sized avatar
🎯
Focusing

Eddy Christiandy echr

🎯
Focusing
View GitHub Profile
@echr
echr / sample-blogger-snippet.txt
Last active June 7, 2017 04:27
Megahubs blogger sample snippets
<style>
#mp-hook {
text-decoration: none;
text-transform: uppercase;
font-family: 'Exo 2', sans-serif;
font-weight: 300;
font-size: 30px;
display: inline-block;
position: relative;
text-align: center;
@echr
echr / sample-page-webview.html
Last active June 7, 2017 04:39
Autoload Webview
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Publisher Page</title>
<script async="" src="https://www.google-analytics.com/analytics.js"></script>
</head>
<body>
<!-- <h1>Publisher Test Page</h1> -->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Webview Page</title>
</head>
<body>
<noscript>
Please enable javascript
@echr
echr / nginx-ssl-config
Created August 18, 2018 20:26 — forked from apollolm/nginx-ssl-config
Nginx Configuration with multiple port apps on same domain, with SSL.
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_geoforce {
server 127.0.0.1:3000;
}
upstream app_pcodes{
server 127.0.0.1:3001;
}
@echr
echr / aes-128-ecb.php
Last active November 5, 2018 18:58
PHP AES-128-ECB Encrypt Test
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
class PHP_AES_Cipher {
static function encrypt($str, $key) {
$block = mcrypt_get_block_size('rijndael_128', 'ecb');
$pad = $block - (strlen($str) % $block);
$str .= str_repeat(chr($pad), $pad);
return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $str, MCRYPT_MODE_ECB);
@echr
echr / update-openfire.sh
Created March 13, 2019 01:06 — forked from fabiomontefuscolo/update-openfire.sh
Update openfire keystore with Letsencrypt stuff
#!/bin/bash
#
# @author https://github.com/guusdk
#
# Checks for a known location where Let's Encrypt keys/certificates will be spontaneously exist.
# When files are detected, they're used to generate a new keystore, which is then used
# to replace the Openfire keystore.
set -e
@echr
echr / webhook.php
Created July 7, 2019 15:31 — forked from jplitza/webhook.php
A basic PHP webhook handler for Github, just verifying the signature and some variables before calling another command to do the actual work
<?php
// where to log errors and successful requests
define('LOGFILE', '/tmp/github-webhook.log');
// what command to execute upon retrieval of a valid push event
$cmd = 'update-jekyll.sh 2>&1';
// the shared secret, used to sign the POST data (using HMAC with SHA1)
$secret = '00000000000000000000000000000000';
@echr
echr / composer.json
Created July 29, 2019 06:11 — forked from woozy/composer.json
Git hook to validate modified code against PSR-2 code standard
{
"require-dev": {
"squizlabs/php_codesniffer": "^3.2",
"exussum12/coverage-checker": "^0.10.0"
}
}
location /websockets/ {
proxy_pass http://127.0.0.1:6001/;
proxy_set_header Host $host;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
# Allow the use of websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@echr
echr / connections.sh
Created August 17, 2019 04:52 — forked from fideloper/connections.sh
Quick and dirty monitoring of mysql connections
#!/usr/bin/env bash
# 5 minutes between alerts
SECONDS_BETWEEN_ALERTS=300
# Track when we sent the last alert
LAST_ALERT=0
while true; do
NUMBER_CONNECTIONS=$(mysql --defaults-extra-file=/data/.prod.cnf -sNe "select count(*) as connection_count from INFORMATION_SCHEMA.PROCESSLIST;")