Skip to content

Instantly share code, notes, and snippets.

View Pinwheeler's full-sized avatar

Anthony Dreessen Pinwheeler

View GitHub Profile
// COPYRIGHT 2020 MIT Open Source - Anthony Dreessen
// This file is basically a slightly modified StackOverflow answer
// and should be owned by nobody- honestly it should be a part of React itself
// full license at the bottom
import { useEffect, useMemo, useRef } from "react";
export const usePrevious = (value: any, initialValue: any) => {
const ref = useRef(initialValue);
useEffect(() => {
Hello!
Found chip PN532
Firmware ver. 1.6
Waiting for an ISO14443A Card ...
Found an ISO14443A card
UID Length: 7 bytes
UID Value: 0x04 0xE5 0xDA 0x01 0x40 0x3A 0x03
Seems to be an NTAG2xx tag (7 byte UID)
PAGE 00: 04 E5 DA B3 .⸮ڳ
import React from "react"
import { View, Text } from "react-native"
import { ActivityIndicator } from "react-native-paper"
import Theme from "src/lib/Theme"
interface Props {
loading: boolean
}
export const LoadingScreen: React.FC<Props> = (props) => {
@Pinwheeler
Pinwheeler / app.tsx
Created August 8, 2021 17:40
CodePush FC
import moment from "moment"
import React, { useEffect, useState } from "react"
import { AppState } from "react-native"
import CodePush from "react-native-code-push"
import ContextStack from "src/app/ContextStack"
import { ErrorBoundary } from "src/app/ErrorBoundary"
import RootNavigator from "src/app/RootNavigator"
import { LoadingScreen } from "src/shared/LoadingScreen"
const MIN_BACKGROUND_DURATION_IN_MIN = 30
@Pinwheeler
Pinwheeler / log.txt
Created February 10, 2021 02:47
Parrit server crash 1/9/21
This file has been truncated, but you can view the full file.
-- Logs begin at Sun 2021-01-17 22:10:27 UTC, end at Wed 2021-02-10 01:59:10 UTC. --
Jan 17 22:10:27 ubuntu-s-1vcpu-1gb-lon1-01 java[17293]: 2021-01-17 22:10:27.643 ERROR 17293 --- [o-8080-exec-178] c.p.c.ExceptionHandlerController : Uncaught exception...
Jan 17 22:10:27 ubuntu-s-1vcpu-1gb-lon1-01 java[17293]: java.lang.NullPointerException: null
Jan 17 22:44:22 ubuntu-s-1vcpu-1gb-lon1-01 java[17293]: 2021-01-17 22:44:22.541 ERROR 17293 --- [o-8080-exec-183] c.p.c.ExceptionHandlerController : Uncaught exception...
Jan 17 22:44:22 ubuntu-s-1vcpu-1gb-lon1-01 java[17293]: java.lang.NullPointerException: null
Jan 18 00:59:08 ubuntu-s-1vcpu-1gb-lon1-01 java[17293]: 2021-01-18 00:59:08.409 ERROR 17293 --- [o-8080-exec-184] c.p.c.ExceptionHandlerController : Uncaught exception...
Jan 18 00:59:08 ubuntu-s-1vcpu-1gb-lon1-01 java[17293]: java.lang.NullPointerException: null
Jan 18 01:29:56 ubuntu-s-1vcpu-1gb-lon1-01 java[17293]: 2021-01-18 01:29:56.483 ERROR 17293 --- [o-8080-exec-182] c.p.c.Exc
@Pinwheeler
Pinwheeler / application.properties
Created January 30, 2021 06:13
externalized database
spring.datasource.url=jdbc:postgresql://dbname.db.elephantsql.com:5432/db_user_name
spring.datasource.username=db_user_name
spring.datasource.password=password
./gradlew bootJar
scp build/libs/myapp.jar username@ip_address:
ssh -t username@ip_address 'sudo /bin/systemctl restart myapp'
@Pinwheeler
Pinwheeler / application.properties
Created March 17, 2020 21:07
Sample application.properties file
# Here, spring.jpa.hibernate.ddl-auto can be none, update, create, create-drop, refer to the Hibernate documentation for details
# https://spring.io/guides/gs/accessing-data-mysql/
spring.jpa.hibernate.ddl-auto=none
# Connection details
spring.datasource.url=jdbc:postgresql://localhost:5432/db_name
spring.datasource.username=username
spring.datasource.password=password
@Pinwheeler
Pinwheeler / build.gradle
Last active March 17, 2020 20:38
sample build.gradle for externalizing Postgres
plugins {
//...
id "org.flywaydb.flyway" version "6.3.1"
}
dependencies {
//...
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.flywaydb:flyway-core'
runtimeOnly 'org.postgresql:postgresql'
[Unit]
Description=My Java Application
After=syslog.target
[Service]
Environment="MY_DATABASE_PASSWORD=<database_password>"
User=<droplet_username>
ExecStart=/usr/bin/java -Xmx256m -Dspring.profiles.active=<profile> -jar /home/<droplet_username>/myapp.jar
SuccessExitStatus=143