Skip to content

Instantly share code, notes, and snippets.

View marcozink's full-sized avatar

Marco Zink marcozink

View GitHub Profile
function urlencode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
@marcozink
marcozink / ReceiptPrint.php
Created February 19, 2018 15:31 — forked from Stenerson/ReceiptPrint.php
Using escpos-php with Code Igniter (2x)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// IMPORTANT - Replace the following line with your path to the escpos-php autoload script
require_once __DIR__ . '\..\..\autoload.php';
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\Printer;
class ReceiptPrint {
@marcozink
marcozink / pushover
Created April 12, 2018 22:08 — forked from outadoc/pushover
Pushover Bash Script
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: ./pushover <message> [title]"
exit
fi
MESSAGE=$1
TITLE=$2
@marcozink
marcozink / AWS IAM Policy - ForceMFA.json
Created May 1, 2018 00:30 — forked from incyclum/AWS IAM Policy - ForceMFA.json
AWS IAM Policy - Force MFA - This policy allows users to manage their own passwords and MFA devices but nothing else unless they authenticate with MFA
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:GetAccountPasswordPolicy",
@marcozink
marcozink / nginx.conf
Created June 22, 2018 05:13 — forked from wsaribeiro/nginx.conf
NGINX Configuration for WordPress Multisite + Domain Mapping with HTTPS
server {
listen 80 default_server deferred;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl spdy deferred;
# Main site domain
server_name example.com *.example.com;
@marcozink
marcozink / nginx.conf
Created June 22, 2018 05:13 — forked from QROkes/nginx.conf
NGINX Configuration for WordPress Multisite + Domain Mapping with HTTPS
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com subsite.com www.subsite.com another.com www.another.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
@marcozink
marcozink / signup.html
Created August 28, 2018 22:16 — forked from ahmadawais/signup.html
Bootstrap ajax email signup form for sendy.co
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js" ></script>
<title>AJAX Signup</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
@marcozink
marcozink / int2ip.js
Created September 24, 2018 00:11 — forked from jppommet/int2ip.js
javascript conversion from ip address to long integer and vice versa
function int2ip (ipInt) {
return ( (ipInt>>>24) +'.' + (ipInt>>16 & 255) +'.' + (ipInt>>8 & 255) +'.' + (ipInt & 255) );
}
@marcozink
marcozink / prestashop.conf
Created January 28, 2019 22:27 — forked from julienbourdeau/prestashop.conf
PrestaShop Nginx Configuration
server {
listen 80;
listen [::]:80; #Use this to enable IPv6
server_name www.example.com;
root /var/www/prestashop17;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.php index.html;
@marcozink
marcozink / clean-up-boot-partition-ubuntu.md
Created May 7, 2019 03:56 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r