Skip to content

Instantly share code, notes, and snippets.

View andymccall's full-sized avatar

Andy McCall andymccall

View GitHub Profile
@andymccall
andymccall / virtual_keys.inc
Last active December 20, 2024 15:49
FabGL / Agon Keycodes
VK_NONE: EQU $00 ; No character (marks the first virtual key)
VK_SPACE: EQU $01 ; Space
VK_0: EQU $02 ; Number 0
VK_1: EQU $03 ; Number 1
VK_2: EQU $04 ; Number 2
VK_3: EQU $05 ; Number 3
VK_4: EQU $06 ; Number 4
VK_5: EQU $07 ; Number 5
andymccall@earth:~/$ pacmd list-cards
3 card(s) available.
index: 0
name: <alsa_card.pci-0000_01_00.1>
driver: <module-alsa-card.c>
owner module: 7
properties:
alsa.card = "1"
alsa.card_name = "HDA NVidia"
alsa.long_card_name = "HDA NVidia at 0xdf080000 irq 17"
@andymccall
andymccall / gist:78c349d2a15e407ae32fabc73b0df944
Created October 1, 2018 16:56 — forked from kingbin/gist:9435292
Manually Start/Stop PostgresSQL on Mac
# Stop PostgreSQL from auto starting
sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
# Enable PostgreSQL to auto start
sudo launchctl load -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.3.plist
# Start postgres
$ sudo su postgres
Password:
bash-3.2$ pg_ctl -D /Library/PostgreSQL/9.3/data/ start
Application
===========
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args); // never coverered!
}
<option th:each="authority : ${authoritiesList}"
th:value="${authority.LocalAuthorityId}"
th:text="${authority.Name}"
th:if="${authority.LocalAuthorityId == localAuthorityId}" th:selected="selected">
</option>
public class Main {
public static void main(String[] args) {
int numberOfPosts = 45;
int pageSize = 3;
int numberOfPages = numberOfPosts / pageSize;
int lastPage = 0;
int firstPage = 0;
System.out.println(startDate + "-" + endDate);
==============================================
Sun Jan 01 00:00:00 GMT 2017-Sun Dec 31 23:59:59 GMT 2017
Hibernate
=========
package co.twibble.model;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.util.Date;
/**
* The Post class is the class that holds blog posts
*
@andymccall
andymccall / gist:2958fd6fda68ce1529f5b055ea4bfe77
Created February 25, 2017 15:35
MySQL, Java HQL Date Hell!
public List<Post> getPostByYear(int year) {
List<Post> posts = new ArrayList<>();
try {
Query query;
Date startDate;
Date endDate;
startDate = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(year + "-" + 01 + "-" + 01);