Skip to content

Instantly share code, notes, and snippets.

View gurre's full-sized avatar

Gustav Svalander gurre

  • Göteborg, Sweden
  • 03:19 (UTC +02:00)
View GitHub Profile
@gurre
gurre / promtail.yml
Created January 29, 2023 07:44
Promtail configuration for systemd and logs from all nomad task directories using consul service discovery
positions:
filename: /tmp/data/positions.yaml
server:
log_level: warn
#disable: true
http_listen_address: {{ env "NOMAD_IP_http" }}
http_listen_port: {{ env "NOMAD_PORT_http" }}
grpc_listen_address: {{ env "NOMAD_IP_grpc" }}
grpc_listen_port: {{ env "NOMAD_PORT_grpc" }}
@gurre
gurre / steps.md
Last active December 15, 2022 19:58
Mounting Windows and Linux disks with write permissions on MacOS Mojave

Mounting NTFS disk with write permissions on macOS Mojave (10.14)

brew install --cask macfuse
brew tap gromgit/homebrew-fuse
brew install ntfs-3g-mac

sudo mkdir /Volumes/NTFS
sudo /usr/local/sbin/mount_ntfs /dev/diskXsY /Volumes/NTFS
@gurre
gurre / withErrorFallback.js
Created December 2, 2017 21:53
How to create an error fallback using componentDidCatch in recompose
import { omit } from 'ramda';
import {
compose,
withState,
branch,
lifecycle,
mapProps,
renderComponent,
setDisplayName
} from 'recompose';
@gurre
gurre / ramda-selectors-reselect.js
Created October 6, 2017 14:58
How to write memoized selectors in ramda without reselect
import {prop, memoize, converge} from "ramda"
const state = {
foo: 1,
bar: 2
}
const fooSelector = prop("foo") // 1
const barSelector = prop("bar") // 2
@gurre
gurre / attiny85-on-sierra.md
Last active June 7, 2023 12:28
How to program the ATTiny85 on MacOS Sierra

How to program the ATTiny85 on MacOS Sierra

Check MacOS version

$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.11.6
BuildVersion:	15G1611
@gurre
gurre / sync-pipep.js
Created July 18, 2017 17:47
Ramda sync and async promises using pipeP
const { apply, concat, identity, pipe, pipeP, unapply } = require('ramda');
/**
* Similar to `pipe` and `pipeP`, but this method allows interpolation of
* async and sync functions by preceding all the passed in functions with a
* resolved promise. All functions must be unary (unlike the first argument
* of it's sister functions).
*/
module.exports =
pipe(
@gurre
gurre / ramda-reducer.js
Created July 18, 2017 16:40
Redux Reducer using Ramda
import R from 'ramda'
import { Jobs } from '../actions/index'
const reducer = (state = [], action) => R.cond([
[ R.equals(Jobs.TYPE.receive), R.always(action.payload) ],
[ R.T, R.always(state) ]
])(action.type)
export default reducer
@gurre
gurre / svtplay.sh
Created April 19, 2017 19:40
Ladda ner från Svtplay med ffmpeg
ffmpeg -i "http://svtplay8g-f.akamaihd.net/i/se/open/20170414/1373874-001A/PG-1373874-001A-DOXTHATSUGAR-02_,988,240,348,456,636,1680,2796,.mp4.csmil/index_5_av.m3u8?null=0" -vcodec copy -strict experimental "file:dox-sockerfilmen-avsnitt-1.mp4"
@gurre
gurre / Terratec G1 Grabby on RPi
Created January 23, 2017 22:14
Terratec G1 Grabby on RPi
$ lsusb
Bus 001 Device 005: ID 0ccd:10af TerraTec Electronic GmbH
Bus 001 Device 004: ID 148f:7601 Ralink Technology, Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ dmesg
[2702794.172946] usb 1-1.5: new high-speed USB device number 5 using dwc_otg
[2702794.277932] usb 1-1.5: New USB device found, idVendor=0ccd, idProduct=10af
uuidgen | tr "[:upper:]" "[:lower:]"