Skip to content

Instantly share code, notes, and snippets.

View suzukieng's full-sized avatar

Alex Suzuki suzukieng

View GitHub Profile
@suzukieng
suzukieng / hello.asm
Last active January 17, 2018 07:53
Atari 2600 Hello World
PROCESSOR 6502
INCLUDE "vcs.h"
INCLUDE "macro.h"
NUM_SCANLINES = 242 ; 242 scanlines for PAL, 192 for NTSC
ORG $F000 ; Start of "cart area" (see Atari memory map)
; Vertical sync
@suzukieng
suzukieng / Info.plist
Created February 20, 2018 15:11
JavaFX CFBundleURLTypes example
<?xml version="1.0" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSMinimumSystemVersion</key>
<string>10.9</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
static ble_gap_adv_params_t m_adv_params;
static uint8_t m_beacon_info[APP_BEACON_INFO_LENGTH];
static ble_advdata_manuf_data_t m_manuf_specific_data;
void advertising_start(uint8_t *beacon_uuid, uint16_t major, uint16_t minor) {
uint32_t err_code;
ble_advdata_t adv_data;
uint8_t flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED;
uint16_t short_val;
#include "uart_cmd.h"
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <nrf_uart.h>
#include <app_uart.h>
#include "hex_utils.h"
// Types of commands received
typedef enum {
CONFIGURATION,
INFORMATION
} uart_cmd_evt_type_t;
// Event data structure
typedef struct {
uart_cmd_evt_type_t evt_type;
typedef struct {
uint8_t beacon_uuid[16];
uint16_t beacon_major;
uint16_t beacon_minor;
} configuration_t;
uint32_t nvconfig_init();
uint32_t nvconfig_save(configuration_t* cfg);
uint32_t nvconfig_load(configuration_t* cfg);
@suzukieng
suzukieng / Main.java
Created August 25, 2021 13:03
Calling the JTouchID library from Java
package com.classycode.touchidexample;
import com.sun.jna.Native;
import javax.swing.*;
import java.awt.*;
public class Main {
private JButton button;
@suzukieng
suzukieng / JTouchID.h
Created August 25, 2021 13:07
JTouchID header
#import <Foundation/Foundation.h>
// Functions called from Java using JNI or JNA need to follow C calling conventions
typedef void (*auth_cb_t)(int32_t success, int32_t laError);
#ifdef __cplusplus
extern "C" {
#endif
@suzukieng
suzukieng / JTouchID.m
Created August 25, 2021 13:08
JTouchID implementation
#import "JTouchID.h"
#import <LocalAuthentication/LocalAuthentication.h>
int32_t touchid_supported(void) {
BOOL supportsTouchID = [[LAContext new] canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil];
NSLog(@"Supports TouchID: %d", supportsTouchID);
return supportsTouchID;
}
@suzukieng
suzukieng / JTouchID.java
Created August 25, 2021 13:29
JTouchID interface
package com.classycode.touchidexample;
import com.sun.jna.Callback;
import com.sun.jna.Library;
interface JTouchID extends Library {
interface AuthCallback extends Callback {
void callback(int result, int laError);