Skip to content

Instantly share code, notes, and snippets.

View ultrox's full-sized avatar
🏠
Working from home

Marko Vujanic ultrox

🏠
Working from home
View GitHub Profile
@ultrox
ultrox / TestSetupExampleCRAEnzymeChaiMocka.md
Created October 31, 2016 18:58 — forked from busypeoples/TestSetupExampleCRAEnzymeChaiMocka.md
Mocha/Chai/Enyzme test setup with create-react-app

Basic setup for using Enzyme/Mocha/Chai with create-react-app

This is a temporary solution. Might change in the near future, this depends on how create-react-app will implement testing.

create-react-app quick-test-example

cd quick-test-example

npm run eject
@ultrox
ultrox / node-on-ec2-port-80.md
Created August 19, 2017 13:03 — forked from kentbrew/node-on-ec2-port-80.md
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);
@ultrox
ultrox / default.conf
Created December 15, 2017 08:54 — forked from cbmd/default.conf
nginx config - dynamic virtual hosts
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@ultrox
ultrox / ttfb.sh
Created January 2, 2018 17:49 — forked from sandeepraju/ttfb.sh
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
/* begin table creation */
create table department
(dept_id smallint unsigned not null auto_increment,
name varchar(20) not null,
constraint pk_department primary key (dept_id)
);
create table branch
(branch_id smallint unsigned not null auto_increment,
@ultrox
ultrox / self-signed-certificate-with-custom-ca.md
Created November 4, 2018 10:07 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@ultrox
ultrox / @@INTRO.md
Created August 3, 2019 01:15 — forked from djmitche/@@INTRO.md
My use of Taskwarrior

Getting Started

My Usage

I've been using this for several years now, so here are some of the ways I have set it up to be most productive. See my taskrc below for implementation details.

In general, I've had the most success by keeping lists of tasks short and to the point, avoiding the anxiety of seeing 100 tasks and feeling like I'm going to drown.

@ultrox
ultrox / resetFieldset.css
Created March 6, 2020 11:30 — forked from nicolasrenon/resetFieldset.css
Reset fieldset and legend styles
/* From http://thatemil.com/blog/2015/01/03/reset-your-fieldset/ by Emil Björklund */
legend {
display: table;
padding: 0;
}
fieldset {
border: 0;
margin: 0;
min-width: 0;
@ultrox
ultrox / debugger pause beforeunload
Created November 24, 2020 16:28 — forked from carcinocron/debugger pause beforeunload
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@ultrox
ultrox / nixos.md
Created July 23, 2021 03:41 — forked from martijnvermaat/nixos.md
Installation of NixOS with encrypted root