Skip to content

Instantly share code, notes, and snippets.

arberg

Block or report user

Report or block arberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arberg
arberg / MyActivity.Java
Created Feb 1, 2018
RxJava with AutoDispose: Provoke error after life cycle ends
View MyActivity.Java
package dk.bnr.androidbooking;
import android.arch.lifecycle.Lifecycle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import com.uber.autodispose.AutoDispose;
import com.uber.autodispose.AutoDisposePlugins;
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider;
@arberg
arberg / gw-simple.ps1
Last active Mar 4, 2018
Wrapping the gradle wrapper with Powershell
View gw-simple.ps1
#Finds the first gradle in the list below
#Runs gradle with the arguments to this script in current dir
$gradlePaths = @("./gradlew","../gradlew", "gradle")
$currentGradlePaths = ( $gradlePaths | ?{ gcm $_ -erroraction 'silentlycontinue' } )
if ($currentGradlePaths.Length -gt 0) {
if ($currentGradlePaths -is [array]) {
$gradle = $currentGradlePaths[0]
} else {
@arberg
arberg / Get-TodoistBackup.ps1
Last active Jun 11, 2018 — forked from dansmith65/Get-TodoistBackup.ps1
Powershell script to download the latest backup from Todoist - With logging and win10 notifications on failure
View Get-TodoistBackup.ps1
# Get-TodoistBackup.ps1
# Created By: Daniel Smith dan@dansmith65.com
#
# Download the latest backup from Todoist
#
# https://gist.github.com/dansmith65/7a753ddb89c9db145d41b0c4b3c7fac0
# https://gist.github.com/arberg/5c905272dd3ba41d767e0907b46cd675
# Powershell Notifications: Install-Module -Name BurntToast
$useToast=(Get-Command New-BurntToastNotification -errorAction SilentlyContinue)
@arberg
arberg / Apache Tomcat 8 Start stop script init.d script
Last active Oct 17, 2018 — forked from miglen/Apache Tomcat 8 Start stop script init.d script
Apache Tomcat init script (or startup/controll script). Works fine for version 7/8. Read the comments for release history. Feel free to modify, copy and give suggestions. (c) GNU General Public License
View Apache Tomcat 8 Start stop script init.d script
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
@arberg
arberg / WindowsHub4ComSerialRedirectToTcpPortWithTraceAndBaudRate.cmd
Last active Nov 25, 2018
In windows redirect RS232 Serial Port traffic (in+out) to TCP port. Its possible to connect with telnet to tcp-port. Short circuit COM pin 2+3 (in+out) to do loop-back test of connection without device attached, see http://www.ni.com/tutorial/3450/en/
View WindowsHub4ComSerialRedirectToTcpPortWithTraceAndBaudRate.cmd
del log\*.log
rem Dependent on Hub4Com
rem Hub4Com Project page and download
rem https://sourceforge.net/projects/com0com/files/hub4com/
rem https://sourceforge.net/p/com0com/news/2012/06/hub4com-v2100-released/
rem Parent com0com project page (unused)
rem https://sourceforge.net/projects/com0com/
@arberg
arberg / linuxRedirectSerialPortToTcpWithLog.sh
Created Nov 25, 2018
In linux redirect RS232 Serial Port traffic (in+out) to TCP port. Log all input + output to files. Its possible to connect with telnet to tcp-port. Short circuit COM pin 2+3 (in+out) to do loop-back test of connection without device attached, see http://www.ni.com/tutorial/3450/en/
View linuxRedirectSerialPortToTcpWithLog.sh
#!/bin/bash
# netcat -l 7000 </dev/ttyUSB0 >/dev/ttyUSB0 &
cat /dev/ttyUSB0 | tee /var/log/lyngdorfSerial.ComToTcp.log | netcat -l 7000 | tee /var/log/lyngdorfSerial.TcpToCom.log > /dev/ttyUSB0 &
# Linux resets state when netcat closes com-port, so we need to se this after opening netcat
stty -F /dev/ttyUSB0 115200 cs8 -cstopb -parenb
killtree() {
@arberg
arberg / linuxRedirectSerialPortToTcpWithLog.sh
Last active Nov 25, 2018
In linux redirect RS232 Serial Port traffic (in+out) to TCP port. Log all input + output to files. Its possible to connect with telnet to tcp-port. Short circuit COM pin 2+3 (in+out) to do loop-back test of connection without device attached, see http://www.ni.com/tutorial/3450/en/
View linuxRedirectSerialPortToTcpWithLog.sh
#!/bin/bash
pid=$$
pgid=$(ps -o pgid= $$ | awk '{$1=$1;print}')
# netcat -l 7000 </dev/ttyUSB0 >/dev/ttyUSB0 &
cat /dev/ttyUSB0 | tee /var/log/lyngdorfSerial.ComToTcp.log | netcat -l 7000 | tee /var/log/lyngdorfSerial.TcpToCom.log > /dev/ttyUSB0 &
# Linux resets state when netcat closes com-port, so we need to se this after opening netcat
stty -F /dev/ttyUSB0 115200 cs8 -cstopb -parenb -echo
@arberg
arberg / downloadWith-YoutubeDl.sc
Created Dec 7, 2018
Download from youtubeDl with my custom video quality preference and downnload subtitles and convert vtt to srt with ffmpeg.
View downloadWith-YoutubeDl.sc
import ammonite.ops._
import ujson.Js.Value
import upickle.default.{macroRW, ReadWriter => RW}
//import scala.math.Ordering.Implicits._
//https://transform.now.sh/json-to-scala-case-class
case class Da(ext: String, url: String)
object Da { // uPickle 0.7.1 needs these to parse the objects. Really ugly, maybe gson is better?
implicit val rw: RW[Da] = macroRW
@arberg
arberg / downloadWith-YoutubeDl.sc
Created Dec 7, 2018
Download from youtubeDl with my custom video quality preference and downnload subtitles and convert vtt to srt with ffmpeg. Written in scala ammonite, so needs Ammonite to run it.
View downloadWith-YoutubeDl.sc
import ammonite.ops._
import ujson.Js.Value
import upickle.default.{macroRW, ReadWriter => RW}
//import scala.math.Ordering.Implicits._
//https://transform.now.sh/json-to-scala-case-class
case class SubLanguage(ext: String, url: String)
object SubLanguage { // uPickle 0.7.1 needs these to parse the objects. Really ugly, maybe gson is better?
implicit val rw: RW[SubLanguage] = macroRW
You can’t perform that action at this time.