Skip to content

Instantly share code, notes, and snippets.

@54chi
54chi / Making it work for Mac OS.md
Last active July 15, 2021 20:06
LG UltraWide settings

How to create a 1280x1080 (among others) scaled resolutions for your non-standard monitor

Ultrawide monitors with PBP (Picture by Picture) are becoming more common these days. It allows you to split the screen and connect multiple sources to your monitor (e.g. 2 computers at the same time)

The problem is that the resolution is typically not supported out of the box (E.g. a 2560x1080 monitor, when split into 2 will require a 1280x1080 resolution, which is not standard in Mac OS as of Sierra)

Creating custom resolutions

First, we have to reboot in rootless mode, and disable the Integrity Protection, so we can create/override the screen file settings:

@LeCoupa
LeCoupa / cli.docker.sh
Last active November 21, 2023 07:33
Docker Cheatsheet + Tips & Tricks --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
docker build -t friendlyname . # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
docker exec -it [container-id] bash # Enter a running container
docker ps # See a list of all running containers
docker stop <hash> # Gracefully stop the specified container
docker ps -a # See a list of all containers, even the ones not running
docker kill <hash> # Force shutdown of the specified container
docker rm <hash> # Remove the specified container from this machine
docker rm $(docker ps -a -q) # Remove all containers from this machine
@ramboldio
ramboldio / runCertbot.sh
Last active September 9, 2021 16:16
Run Certbot in Docker
#!/bin/bash
# this folder needs to exist
mkdir ~/certs
# authenticate yourself (requires that nothing runs on ports 443 and 80)
docker run --rm -it -v ~/certs:/etc/letsencrypt -p 443:443 certbot/certbot certonly --authenticator standalone
# renewal
docker run --rm -it -v ~/certs:/etc/letsencrypt certbot/certbot renew
@vyaron
vyaron / README.md
Created February 25, 2017 21:36 — forked from japsu/README.md
Type-safe Redux reducers in TypeScript using Immutable.js and typed-immutable-record

Type-safe Redux reducers in TypeScript using Immutable.js and typed-immutable-record

Copyright (C) 2017 Leonidas Oy Ltd
Written by <santtu.pajukanta@leonidasoy.fi>
Licensed under the MIT license

We attempt to harness the friendly API of Immutable.js to build Redux reducers while trying to preserve as much type safety as possible.

State branches are TypedRecords. A combineReducers that outputs TypedRecords is provided.

@dch
dch / droplet.conf
Last active June 7, 2019 11:43
digital ocean's automatic setup script
# /etc/rc.digitalocean.d/droplet.conf
# Generated by bsdcloud-init 2017-01-31 08:52
hostname="wolf.example.org"
# Generated by bsdcloud-init 2017-01-31 08:52
ifconfig_vtnet0_alias0="inet 10.18.0.5 netmask 255.255.0.0"
# Generated by bsdcloud-init 2017-01-31 08:52
ifconfig_vtnet0="inet 188.166.73.162 netmask 255.255.192.0"
# Generated by bsdcloud-init 2017-01-31 08:52
defaultrouter="188.166.64.1"
@devfred
devfred / audio-api-wrapper.ts
Last active February 17, 2020 19:17
Typescript: HTML5 Audio Wrapper for angular2
/**
* @class
* @description
* Wrapper for HTML5 audio.
*/
import {Injectable, NgZone} from 'angular2/core';
import {Observer} from 'rxjs/Observer';
import {Observable} from 'rxjs/Observable';
declare var AudioContext:any;
@Rich-Harris
Rich-Harris / service-workers.md
Last active June 6, 2024 22:24
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@PieterScheffers
PieterScheffers / start_docker_registry.bash
Last active October 29, 2023 18:26
Start docker registry with letsencrypt certificates (Linux Ubuntu)
#!/usr/bin/env bash
# install docker
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
# install docker-compose
# https://docs.docker.com/compose/install/
# install letsencrypt
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
@gaearon
gaearon / connect.js
Last active April 11, 2024 06:46
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@shivshank
shivshank / vox_to_obj_exporter.py
Last active December 31, 2023 01:12
Exports from MagicaVoxel VOX to OBJ. Can preserve all edges for easy editing in a program like Blender.
"""
This script is designed to export a mass amount of MagicaVoxel .vox files
to .obj. Unlike Magica's internal exporter, this exporter preserves the
voxel vertices for easy manipulating in a 3d modeling program like Blender.
Various meshing algorithms are included (or to be included). MagicaVoxel
uses monotone triangulation (I think). The algorithms that will (or do)
appear in this script will use methods to potentially reduce rendering
artifacts that could be introduced by triangulation of this nature.