Skip to content

Instantly share code, notes, and snippets.

[ 314.954141] usb 3-3: new high-speed USB device number 6 using xhci_hcd
[ 315.194677] qmi_wwan 3-3:1.4: cdc-wdm0: USB WDM device
[ 315.210690] qmi_wwan 3-3:1.4 wwan0: register 'qmi_wwan' at usb-0000:00:14.0-3, WWAN/QMI device, e2:b6:a9:66:78:fb
[ 315.222505] usb-storage 3-3:1.5: USB Mass Storage device detected
[ 315.230527] scsi host2: usb-storage 3-3:1.5
[ 316.274970] scsi 2:0:0:0: Direct-Access SD Storage 0000 PQ: 0 ANSI: 2
[ 316.289713] scsi 2:0:0:1: CD-ROM Mass Storage 0000 PQ: 0 ANSI: 2
[ 316.303764] sd 2:0:0:0: [sda] Unit Not Ready
[ 316.310053] sd 2:0:0:0: [sda] Sense Key : 0x5 [current]
[ 316.311444] sr 2:0:0:1: [sr0] scsi-1 drive
package chainsaw
import (
"reflect"
"testing"
)
/*
goos: darwin
goarch: arm64
func stringIt(value interface{}) string {
switch v := value.(type) {
case nil:
return "<nil>"
case string:
return value.(string)
case []byte:
return string(value.([]byte))
case encoding.TextMarshaler:
return safeMarshal(value.(encoding.TextMarshaler))
package main
/*
This is an example of using the paho.golang (supporting MQTT5) library in a way where
the connect call will block and wait for the connection to go down.
I use something like this as I need to generate a TLS cert before each connect.
*/
import (
@perbu
perbu / error.go
Last active January 23, 2021 10:16
go-error-handling
body, err := ioutil.ReadAll(res.Body)
if err != nil {
return forecast, err // return an error and let the caller handle it
}
err = json.Unmarshal(body, &forecast)
if err != nil {
log.Fatalf("error unmarshaling body %s: %s", url, err.Error())
}
forecast.Expires, err = http.ParseTime(res.Header.Get("Expires"))
if err != nil {
@perbu
perbu / filebeat.yum
Last active December 16, 2020 12:29
[elastic-7.x]
name=Elastic repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
package integration
import io.ktor.application.Application
import io.ktor.http.HttpMethod
import io.ktor.http.HttpStatusCode
import io.ktor.server.testing.TestApplicationEngine
import io.ktor.server.testing.handleRequest
import io.ktor.server.testing.withTestApplication
import ombruk.backend.module
import org.junit.Test
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: dag-diamond-
spec:
entrypoint: diamond
templates:
- name: diamond
dag:
tasks:
#!/bin/zsh
#
# Auto activate a python virtualenv when entering the project directory.
# Installation:
# source virtualenv-auto-activate.sh
#
# Usage:
# Function `venvconnect`:
# Connect the currently activated virtualenv to the current directory.
#
function signalHandle(signal) {
console.log('Received signal ', signal);
server.em.emit("serverShutdown", "Shutdown initiated by signal "+signal);
}
process.on('SIGINT', signalHandle);
process.on('SIGTERM', signalHandle);