This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo multipass set local.driver=virtualbox # errors on my work laptop | |
# Default driver | |
sudo multipass set local.driver=hyperkit | |
# Create a VM | |
multipass launch --name ubuntu2004 | |
# Create a VM with custom parameters | |
multipass launch \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCurrentPositionTask(positionConfig) { | |
const { geolocation } = navigator | |
return new Promise((resolve, reject) => { | |
const handleSuccess = ({ coords }) => { | |
resolve(coords) | |
} | |
const handleError = error => { reject(error) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Environment variable names config | |
const env = { | |
ACCESS_TOKEN: '_token', // This env var will be created by the script | |
AUTH_TIME: '_authTime', // This env var will be created by the script | |
BASE_URL: 'baseUrl', | |
ID: 'username', | |
SECRET: 'password' | |
} | |
// API config | |
const api = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MyService.Core.Models; | |
namespace MyService.Providers.Mappers | |
{ | |
public interface IMyMapper<in T> where T : ISomething | |
{ | |
MappedSomething MapToSomething(T somethingGeneric); | |
} | |
public class MyConcreteMapper : IMyMapper<SomethingA> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for m4aFile in *.m4a; \ | |
do ffmpeg -i "$m4aFile" \ | |
-ab 128k \ | |
ogg/"${m4aFile%.m4a}.ogg"; \ | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namei -om /path/to/a/dir-or-file | |
# Sample output | |
# | |
# f: /usr/local/bin/nginx_modsite | |
# drwxr-xr-x root root / | |
# drwxr-xr-x root root usr | |
# drwxr-xr-x root root local | |
# drwxr-xr-x root root bin | |
# -rwxr-xr-x root root nginx_modsite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kafkacat -L -b <BROKER_URL:PORT> -t <KAFKA_TOPIC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /var/log/apt -name 'history.log*' -exec zgrep -- '<YOUR SEARCH TERM>' {} + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {asin, cos, sin, sqrt, PI} = Math | |
const EARTH_RADIUS_KM = 6371 | |
const METERS_IN_KM = 1000 | |
// const deg2rad = n => Math.tan(n * (Math.PI / 180)) | |
const convertDegToRad = degries => degries * (PI / 180) | |
/** | |
* is One Point within Another |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dependency injection helper | |
const injectLambdaDependencies = (handle, dependencyMap) => (event, context) => { | |
const enhancedContext = Object.assign({}, context, dependencyMap) | |
return handle(event, enhancedContext) | |
} | |
// Dependencies, possibly returned by a factory | |
const dependencyMap = { doSomething: () => 'foo bar' } |