Skip to content

Instantly share code, notes, and snippets.

View sasq64's full-sized avatar
⌨️
Coding

Jonas Minnberg sasq64

⌨️
Coding
View GitHub Profile

IntelliJ / Android Studio / CLion

Editor > General > Soft Wraps

  • Soft-wrap files: Change to * (or add *.java, *.cpp etc)
  • Check "Use original line's indent for wrapped parts"

Vim

@sasq64
sasq64 / analog.md
Last active July 3, 2021 14:54
Anlog playback control of digital media

Anlog playback control of digital media

This is the basic idea;

  • Use a standard D2A algorithm (check out the winmodem source in the linux kernel for instance) to record a sequence of timestamps onto a cassette tape, Compact Disc or even Vinyl record.

  • Connect the output of your choosen playback device to audio input of a computer (Raspberry PI).

  • Insert your media (casette) into your playback device and start playing.

@sasq64
sasq64 / callback.cpp
Last active April 5, 2021 14:27
C++ Callbacks
#include <functional>
#include <vector>
#include <memory>
template<typename... X> struct Callback;
template <typename R, typename ...ARGS> struct Callback<R(ARGS...)>
{
struct BaseFx
{
virtual R call(ARGS...) = 0;
XPOS = $07
PATTERN = $0800; 48 columns * 48 rows * 8 bytes + 48 columns = $4830 bytes
SCALEDBMP = $8c00; 25 columns * 25 rows * 8 bytes = $1388 bytes
pointer = $7a
pointer2 = $33
pointer3 = $35
pointer4 = $22
; C64 Koala viewer
!macro VicAdr(adr) {
!assert (adr & 0x3fff) == 0
lda #((~adr)&0xffff)>>14
sta $dd00
}
!macro BitmapAndScreen(bm_offs, scr_offs) {
!assert (bm_offs & 0xdfff) == 0
### Keybase proof
I hereby claim:
* I am sasq64 on github.
* I am sasq (https://keybase.io/sasq) on keybase.
* I have a public key ASBf1KbF3trwDCi8CXhFKIw14R-tU3-yxP35WcGAt5jlbwo
To claim this, I am signing this object:
@sasq64
sasq64 / djinni.cmake
Last active May 17, 2019 16:45
Automate creation of djinni targets
# ADD_DJINNI_TARGET(name java_package)
#
# Set up a custom command that will run djinni on name.idl and
# generate variables such as NAME_ALL_SOURCES for inclusion in
# real build targets.
#
# These variables should be set by the caller:
# DJINNI_CMD - The djinni command to run, for instance
# 'java -jar ${CMAKE_CURRENT_SOURCE_DIR}/extras/djinni.jar'
#

C++ Developer Guide

Please note; these rules are not random; nor are they my personal preferences. They represent -- for the most part -- an emerging 'de facto' standard for how modern C++ code is developed.

Basics

C++14 "modern" style

@sasq64
sasq64 / design.md
Last active November 13, 2018 08:17

Always strive for simplicty. Avoid redundancy.

Start writing non generic code, top down, doing just what is needed.

Later, refactor anything that looks like a generic construct and break it out to a separate component. And test it.

Iterate.

@sasq64
sasq64 / java.cpp
Last active November 9, 2018 14:39
JNIEXPORT jlong JNICALL Java_com__getComponent(JNIEnv* env, jclass, jstring name)
{
std::shared_ptr<Component> component = sm->getComponent(JString{name, env});
if (!component)
return 0;
return (jlong)(new std::shared_ptr<Component>(component));
}
JNIEXPORT void JNICALL Java_com_releaseComponent(JNIEnv*, jclass, jlong component)
{