Skip to content

Instantly share code, notes, and snippets.

View BrentonPoke's full-sized avatar

Brenton Poke BrentonPoke

  • Lansing, MI
View GitHub Profile
@BrentonPoke
BrentonPoke / Main.java
Created March 14, 2018 01:48
Example Animal insertion Main class
import beans.Animal;
import beans.Genus;
import beans.Location;
import beans.Species;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.springframework.orm.hibernate5.HibernateTemplate;
class Solution {
public static int countPalindromes(String s) {
return findAllPalindromesUsingCenter(s);
}
public static int findAllPalindromesUsingCenter(String input) {
List<String> palindromes = new ArrayList<>();
for (int i = 0; i < input.length(); i++) {
palindromes.addAll(findPalindromes(input, i, i + 1));
palindromes.addAll(findPalindromes(input, i, i));
if (response.code() != 200) {
Converter<ResponseBody, WeatherServiceException> errorConverter =
TestWeatherServiceGenerator.retrofit.responseBodyConverter(
WeatherServiceException.class, new Annotation[0]);
// Convert the error body into our Error type.
WeatherServiceException error = errorConverter.convert(response.errorBody());
}

Keybase proof

I hereby claim:

  • I am brentonpoke on github.
  • I am brentonpoke (https://keybase.io/brentonpoke) on keybase.
  • I have a public key ASDMbfsxJjpnCeb-4OVltSyeLedxizy7PYhu-PXZIpkq5wo

To claim this, I am signing this object:

@BrentonPoke
BrentonPoke / bitwarden-update.sh
Created August 7, 2020 01:49
updates Bitwarden. Doesn't create desktop file.
wget -O Bitwarden-x86-64.AppImage 'https://vault.bitwarden.com/download/?app=desktop&platform=linux'
mv Bitwarden-x86-64.AppImage /usr/local/bin/
chmod +x /usr/local/bin/Bitwarden-x86-64.AppImage
@BrentonPoke
BrentonPoke / ServiceGenerator.java
Created August 18, 2020 14:36
Retrofit service generator example
public class WeatherServiceGenerator {
private static final String BASE_URL = "https://api.weather.gov";
static ObjectMapper mapper = new ObjectMapper();
private static Retrofit.Builder builder
= new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(JacksonConverterFactory.create(mapper));
@BrentonPoke
BrentonPoke / Dockerfile
Last active October 2, 2020 19:52
This work well enough for me now and I will likely update it with better scripts and conventions
FROM openjdk:8-jdk-alpine
WORKDIR /backend/neo4j
EXPOSE 8080
ARG JAR_FILE=target/backend-2.0.0.RELEASE.jar
COPY ${JAR_FILE} app.jar
COPY target/dependency/* dependency
ENTRYPOINT ["java","-jar","app.jar"]
@BrentonPoke
BrentonPoke / nbaiot.py
Created January 1, 2022 22:39
Python script that trains on IoT intrusions
# %% [markdown]
# # IoT Intrusion Detection
#
# The N-BaIoT Dataset contains traffic data for 9 IoT devices. The data comprise of both benign traffic and of a variety of malicious attacks. Here we run three deep neural networks to identify cyberattacks on a Provision PT-737E Security Camera.
# %% [code] {"jupyter":{"outputs_hidden":false}}
import datetime
import numpy as np
import pandas as pd
#include <BLEAdvertisedDevice.h>
#include <BLEDevice.h>
#include <BLEScan.h>
const int PIN = 2;
const int CUTOFF = -60;
void setup() {
pinMode(PIN, OUTPUT);
BLEDevice::init("");
@BrentonPoke
BrentonPoke / coords.cpp
Created August 16, 2022 20:52
Generating GPS coords within radius
#include <iostream>
#include <string>
#include <random>
#include <cmath>
void getLocation(double x0, double y0, int radius) {
std::random_device rd;
std::uniform_int_distribution<int> dist(0,49);
// Convert radius from meters to degrees
double radiusInDegrees = radius / 111000.0;