Skip to content

Instantly share code, notes, and snippets.

@ahngoo8Gongi
ahngoo8Gongi / README.md
Last active July 13, 2024 18:00
Script to create an OPENVPN client inline configuration with easy-rsa V3

Purpose

OpenVPN supports certificates generated by easy-rsa. This script creates client configuration files using the inline format with easyrsa3

Authors:

@nfsarmento
nfsarmento / nginx-wordpress.conf
Last active August 29, 2024 16:55
Harden wordpress security nginx
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active September 20, 2024 01:37
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@elmariachi111
elmariachi111 / SendMailCommand.php
Created October 19, 2018 18:00
PHP / Symfony: create zip file mail attachments in memory
<?php
namespace App\Command;
use Badcow\LoremIpsum\Generator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use ZipStream\ZipStream;
@elmariachi111
elmariachi111 / package.json
Last active May 24, 2020 13:08
webpack production demo file
{
"name": "symfony",
"version": "1.0.0",
"description": "Symfony Standard Edition ========================",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
@ziadoz
ziadoz / include-me-func.php
Last active August 24, 2019 19:48
Prevent Variable Leakage In PHP Includes
<?php
// Use a closure so nothing leaks out when included.
return (function () {
$array = ['foo', 'bar'];
foreach ($array as $string) {
// Some exciting logic.
}
return 'FOOBAR';
@uhop
uhop / .bash_aliases
Created July 3, 2016 20:19
My bash setup
# commands from http://www.askapache.com/linux/bash_profile-functions-advanced-shell.html
#alias chmod='command chmod -c'
alias cpr='command cp -rpv'
alias df='command df -kh'
alias df1='command df -ia'
alias diff='diff -up'
alias dsiz='du -sk * | sort -n --'
alias du='command du -kh'
alias du1='echo *|tr " " "n" |xargs -iFF command du -hs FF|sort'
background: linear-gradient(45deg, #222 12%, transparent 0, transparent 88%, #222 0),
linear-gradient(135deg, transparent 37%, #111 0, #444 32%, #111 63%, transparent 0),
linear-gradient(45deg, transparent 37%, #222 0, #222 63%, transparent 0) #000;
background-size: 15px 15px;
@jwcobb
jwcobb / Install MAPP stack on El Capitan using MacPorts.md
Last active September 15, 2016 12:53
Install MAPP (MAMP) stack on El Capitan using MacPorts – Apache 2, Percona (MySQL), & PHP 5.6

Install MAPP (MAMP) stack on El Capitan using MacPorts

I keep most of my Apache/PHP/Percona (MySQL) configuration stuff in a local Git repository so I can track changes and I symlink to those from where they should be so you will see commands such as

 sudo ln -s ~/Documents/configs/PHP/fat-tony.local/php56.ini /opt/local/etc/php56/php.ini 

If you don’t have a similar setup, just copy your configuration files to where they need to be.

I like to prepend some of the commands with time just for curiosity’s sake to see how long it takes.

@ghalusa
ghalusa / youtube_id_regex.php
Created June 20, 2015 23:14
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ