Skip to content

Instantly share code, notes, and snippets.

View justingreenberg's full-sized avatar

justin justingreenberg

View GitHub Profile
@KidkArolis
KidkArolis / feathers.js
Created November 20, 2019 17:24
Feathers Client with robust reauthentication
import createFeathersClient from '@feathersjs/feathers'
import auth from '@feathersjs/authentication-client'
import socketio from '@feathersjs/socketio-client'
import io from 'socket.io-client'
export function createFeathers() {
const socket = io()
const feathers = createFeathersClient()
feathers.configure(socketio(socket))
feathers.configure(
@santosh-rumsan
santosh-rumsan / axios-cookies.js
Created November 19, 2019 04:48
Using Axios to programmatically login to a website and requesting a secure page using cookies
const axios = require("axios").default;
const axiosCookieJarSupport = require("axios-cookiejar-support").default;
const tough = require("tough-cookie");
const qs = require("qs");
axiosCookieJarSupport(axios);
const cookieJar = new tough.CookieJar();
let loginAndGetContent = async () => {
try {

Various search databases and backends as alternatives to Elasticsearch.

Rust

@timhwang21
timhwang21 / curry-record.md
Last active January 9, 2023 21:34
Curry unary functions that take a record as an argument

curryRecord

This is an example of a function whose logic lives in the type definition rather than in the function body.

/**
 * @name `curryRecord`
 *
 * Takes a unary function that takes a record as an argument, and makes the
 * record partially applicable. Returns a new function that takes a partial of
@fogfish
fogfish / aws-cdk-pure.ts
Last active March 8, 2020 06:31
defines pure functions to solve embarrassingly obvious composition problem in AWS CDK
//
// Copyright (C) 2019 Dmitry Kolesnikov
//
// This pure.ts file may be modified and distributed under the terms
// of the MIT license.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@obstschale
obstschale / autostart
Last active December 21, 2020 18:36
Raspberry Pi Script to autostart Chromium
# /home/pi/.config/lxsession/LXDE-pi/autostart before Buster
# /etc/xdg/lxsession/LXDE-pi/autostart on Buster
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@sh /home/pi/bin/start-chromium.sh
@bradtraversy
bradtraversy / mongodb_cheat_sheet.md
Last active April 16, 2025 20:59
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@rampfox
rampfox / Chromium-at-startup.md
Last active November 19, 2024 17:22
How to open Chromium in full screen at startup on the Raspberry Pi

(debian 10 buster)

First, it seems that ~/.config/lxsession/LXDE-pi/autostart does not exist by default.

  1. copy the autostart
cp /etc/xdg/lxsession/LXDE-pi/autostart ~/.config/lxsession/LXDE-pi/
@jeffehobbs
jeffehobbs / vibration_sensor_ESP32_HA_how_to.txt
Last active March 31, 2025 04:04
Vibration Sensor for ESPHome/Home Assistant
GOAL: Send a push notification after the (vibrations from the) dryer cycle has completely stopped.
USING:
* Inexpensive hardware (see below)
* ESPhome (http://esphome.io) for chip firmware
* Home Assistant (http://hass.io) for sensor state machine and push notification.
---
SHOPPING LIST:
const {useCallback, useEffect, useReducer, useRef} = require('react');
let effectCapture = null;
exports.useReducerWithEmitEffect = function(reducer, initialArg, init) {
let updateCounter = useRef(0);
let wrappedReducer = useCallback(function(oldWrappedState, action) {
effectCapture = [];
try {
let newState = reducer(oldWrappedState.state, action.action);