nginx installed with homebrew from the core tap
git installed and all the software needed to build something from source
First of all, you need to get your currently installed nginx version simply by executing:
import path from 'path'; | |
import fs from 'fs'; | |
const testAgainstRegex = (patterns, string) => { | |
if (typeof patterns === 'string') { | |
return new RegExp(patterns).test(string); | |
} else if (patterns instanceof Array) { | |
return new RegExp(patterns.join('|')).test(string); | |
} else { | |
return patterns; |
#!/usr/bin/env bash | |
cat << 'EOF' >> /etc/yum.repos.d/mongodb.repo | |
[mongodb] | |
name=MongoDB Repository | |
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ | |
gpgcheck=0 | |
enabled=1 | |
EOF |
// Get the canonical url of a page | |
document.querySelector("link[rel='canonical']").href; | |
document.querySelector("link[rel='canonical']").getAttribute("href"); |
nginx installed with homebrew from the core tap
git installed and all the software needed to build something from source
First of all, you need to get your currently installed nginx version simply by executing:
(function(org, notificationType) { | |
// org: | |
// the organizazione name | |
// notificationType: | |
// 'included' = participating and @mentions, | |
// 'subscribed' = all activity, | |
// 'ignore' = ignore | |
let qx = $x; | |
let unwatch = function(org, notificationType) { |
You need to create a new user and give it sudo privleges: | |
$adduser username | |
Set password prompts: | |
Enter new UNIX password: | |
Retype new UNIX password: | |
passwd: password updated successfully | |
Changing the user information for username | |
Enter the new value, or press ENTER for the default | |
Full Name []: |
$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf
# Copy the daemon configuration file into place.
$ sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/
$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
// https://betterprogramming.pub/synchronous-state-in-react-using-hooks-dc77f43d8521 | |
import { useState } from 'react'; | |
export function useStateWithCallback<T>(initialValue: T) { | |
const [value, setValue] = useState(initialValue); | |
const setValueAndCallback = (newValue: T, callback: (prevValue: T, newValue: T) => void) => { | |
setValue((prevValue) => { | |
if (callback) { | |
callback(prevValue, newValue); |
#!/bin/bash | |
script="myscript" | |
#Declare the number of mandatory args | |
margs=2 | |
# Common functions - BEGIN | |
function example { | |
echo -e "example: $script -m0 VAL -m1 VAL -o1 -o2 VAL" | |
} |