Skip to content

Instantly share code, notes, and snippets.

View maxnowack's full-sized avatar
🍷
digitalizing viticulture

Max Nowack maxnowack

🍷
digitalizing viticulture
View GitHub Profile
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active July 26, 2024 20:21
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@jareiko
jareiko / codeship-meteor-script.md
Last active March 6, 2016 00:03
Deploying to Meteor with Codeship.io

Deploying to Meteor with Codeship.io

Project structure

You'll need to use a subdirectory within your git repo for the Meteor project. This allows you to clone Meteor into your repo without it trying to deploy itself. If you find a better way, please let me know.

Provide the name of the subdirectory to the deploy script with the SUBDIRECTORY environment variable.

@bland-industries
bland-industries / StartUpWorkspaces
Created February 26, 2015 15:33
Applescript to place specific window at full screen when there are multiple monitors. Works with some caveats.
set duetApps to {"Mail", "HipChat", "Console", "iTerm"}
set laptopApps to {"Safari", "Google Chrome", "Tower"}
set topApps to {"Sublime"}
-- toggle full screen
on toggleFullScreen()
set isFullScreenAfter to false
tell application "System Events"
@chaeplin
chaeplin / _01.temp_sensor_01.ino
Last active June 24, 2024 18:48
esp8266+dht22+mqtt
// Code based on
// https://github.com/adafruit/DHT-sensor-library/blob/master/examples/DHTtester/DHTtester.ino
// https://gist.github.com/igrr/7f7e7973366fc01d6393
// https://github.com/iot-playground/Arduino/blob/master/ESP8266ArduinoIDE/DS18B20_temperature_sensor/DS18B20_temperature_sensor.ino
// esp8266 + dht22 + mqtt
#include "DHT.h"
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
@d-akara
d-akara / JavaScriptSafeNavigation.md
Last active April 11, 2024 16:18
JavaScript Safe Navigation

Experimental Safe JavaScript Navigation

Implemented using ES6 Proxies and Symbols

The purpose of this function is to provide a way to avoid deep nested conditionals when traversing a hierarchy of objects. Some languages use an operator such as '?.' to perform this capability. This is sometimes called safe navigation or null conditional operators.

You can somewhat think of this as how a xpath select works. If any nodes along the path are not found, your result is simply not found without throwing an exception and without needing to check each individual node to see if it exists.

Suggestions for improvements welcome!

@du5rte
du5rte / autoStore.js
Last active March 8, 2023 12:10
Auto saving to localStorage with MobX
import mobx from "mobx"
import store from "store"
export default function(_this) {
let firstRun = true
// will run on change
mobx.autorun(() => {
// on load check if there's an existing store on localStorage and extend the store
if (firstRun) {
@DieterReuter
DieterReuter / user-data-wifi.yml
Created October 31, 2017 11:08
HypriotOS cloud-init configuration for RPi3 WiFi Client
#cloud-config
# vim: syntax=yaml
#
# The current version of cloud-init in the Hypriot rpi-64 is 0.7.9
# When dealing with cloud-init, it is SUPER important to know the version
# I have wasted many hours creating servers to find out the module I was trying to use wasn't in the cloud-init version I had
# Documentation: http://cloudinit.readthedocs.io/en/0.7.9/index.html
# Set your hostname here, the manage_etc_hosts will update the hosts file entries as well
@ArseniySavin
ArseniySavin / FirstFrame_ffmpeg.go
Last active May 29, 2022 14:13
Getting first frame used ffmpeg. Read / Write into stdin /stdout
func FirstFrame(path string, data []byte) (*bufio.Reader, error) {
cmd := exec.Command(path,
"-i", "-", // read from stdin
"-vframes", fmt.Sprint(1), // frame
"-s", fmt.Sprintf("%dx%d", 640, 360), // size
"-q:v", fmt.Sprint(2), // quality
"-f", "singlejpeg", // jpeg binary
"-", // read from stdout
)
// stdin read
anchors:
tf_init: &tf_init |
terraform init -lock=false \
-backend-config="resource_group_name=terraform" \
-backend-config="key=${{ env.TF_BACKEND_KEY }}" \
-backend-config="access_key=${{ secrets.TF_BACKEND_ACCESS_KEY }}" \
-backend-config="storage_account_name=${{ secrets.TF_BACKEND_SA }}"
setup_backend_key: &setup_backend_key "githubdeployment.${{ github.event.inputs.environment }}.aks_setup.terraform.tfstate"
configure_backend_key: &configure_backend_key "githubdeployment.${{ github.event.inputs.environment }}.aks_configure.terraform.tfstate"
@pesterhazy
pesterhazy / building-sync-systems.md
Last active July 22, 2024 15:06
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles