Skip to content

Instantly share code, notes, and snippets.

View johnefemer's full-sized avatar
:octocat:
Constant K

John Efemer johnefemer

:octocat:
Constant K
View GitHub Profile
@johnefemer
johnefemer / Install and uninstall dnsmasq.md
Created April 15, 2022 07:18 — forked from ricardoaguiar/Install and uninstall dnsmasq.md
Install and uninstall dnsmasq #Dnsmasq #TipsTricks

Install

  1. brew install dnsmasq
  2. cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf now this is automatically done by the dnsmasq installation
  3. Replace this in /usr/local/etc/dnsmasq.conf file:
address=/test/127.0.0.1
listen-address=127.0.0.1
  1. sudo mkdir -v /etc/resolver
  2. sudo touch /etc/resolver/test
@johnefemer
johnefemer / 00-https-single-instance.yaml
Created May 10, 2021 18:38 — forked from the-vampiire/00-https-single-instance.yaml
AWS EB elastic beanstalk single instance nodejs nginx SSL/HTTPS ebextensions config file
# REQUIREMENTS
# set the following configuration environment variables at: configuration -> software -> modify -> environment variables
# CERT_EMAIL: the email address used for registering the cert
# CERT_DOMAIN: the domain to create a cert for
# EB environment URL (listed at the top of the environment page) or a custom domain, custom domains must have a DNS CNAME record pointing to the EB environment URL
# !! MUST NOT have "http://" prefix or the trailing "/" at the end !!
# EXAMPLES
@johnefemer
johnefemer / latency.txt
Created October 3, 2020 23:00 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@johnefemer
johnefemer / php-restrictions.nginxconf
Created July 6, 2020 22:35 — forked from Ellrion/php-restrictions.nginxconf
Nginx + Php-fpm config for Laravel app
# /etc/nginx/global/php-restrictions.conf
# Don't throw any errors for missing favicons and don't display them in the logs
location = /favicon.ico {
log_not_found off;
access_log off;
}
# Don't log missing robots or show them in the nginx logs
location = /robots.txt {
allow all;
@johnefemer
johnefemer / android-restore-password-keystore-jks.md
Created July 6, 2020 18:39 — forked from ptkdev/android-restore-password-keystore-jks.md
Android: Recovery lost keystore jks file or keystore password

Sign android app with new keystore file if you missing password or lost jks file.

  1. Create new keystore.jks file with comand line (not android studio build menu)

    Linux: keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks

    Windows: "C:\Program Files\Android\Android Studio\jre\bin\keytool.exe" -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore "C:\keystore_new.jks"

  2. Generate a .pem file from new keystore

@johnefemer
johnefemer / BACKEND.md
Created May 20, 2020 10:41 — forked from imranismail/BACKEND.md
Careers at Fave

As a Back-End Engineer at Fave, you will help us design cutting edge scalable products to meet our rapidly growing business. We are looking for someone who cares a lot about their craft. Someone who understands the impact of their work on the users.

Your work is not limited to the end users. Your work impacts the livelihood of local businesses. With you, we can help them to grow their business.

As a Back-End Engineer, you will:

  • Develop back end code, Restful APIs and web applications
  • Perform peer code reviews to optimize code quality or readability
  • Deliver reliable solutions that handle massive data and high traffic.
  • Research & learn new technologies and work towards solving problems and meeting requirements.
@johnefemer
johnefemer / add_local_trusted_ca_for_valid_https.md
Created April 12, 2020 19:17 — forked from mwidmann/add_local_trusted_ca_for_valid_https.md
Generating trusted SSL keys for development

Generating SSL keys for development

Installation

Thanks to minica it is very easy to create trusted SSL certificates that have a very long expiration date.

In order to get started you have to have the go tools installed and set up correctly in your environment.

Setup

@johnefemer
johnefemer / docker-php-ext-install.md
Created September 26, 2019 11:25 — forked from giansalex/docker-php-ext-install.md
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
@johnefemer
johnefemer / send_remote_syslog.php
Created January 27, 2019 19:04 — forked from troy/send_remote_syslog.php
Send UDP remote syslog message from PHP (RFC 3164)
# replace PAPERTRAIL_HOSTNAME and PAPERTRAIL_PORT
# see http://help.papertrailapp.com/ for additional PHP syslog options
function send_remote_syslog($message, $component = "web", $program = "next_big_thing") {
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
foreach(explode("\n", $message) as $line) {
$syslog_message = "<22>" . date('M d H:i:s ') . $program . ' ' . $component . ': ' . $line;
socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, PAPERTRAIL_HOSTNAME, PAPERTRAIL_PORT);
}
socket_close($sock);
@johnefemer
johnefemer / slugify.js
Created August 8, 2018 09:44 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}