Skip to content

Instantly share code, notes, and snippets.

Steps to get Capacitor working with SvelteKit

  1. Set up a SvelteKit project as usual.
npm create svelte@latest my-app
cd my-app
npm install
npm run dev -- --open
@mitjakukovec
mitjakukovec / devices.c
Created January 7, 2022 13:47 — forked from courtneyfaulkner/devices.c
List OpenCL platforms and devices
#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
int main() {
@mitjakukovec
mitjakukovec / boost_log_example.cpp
Created October 22, 2021 10:09 — forked from silgon/boost_log_example.cpp
Boost Log example with channel and file generation.
// compile with
// g++ -std=c++11 test_log_default.cpp -DBOOST_LOG_DYN_LINK -lboost_log -lboost_thread -lpthread -lboost_system
#include <iostream>
#include <boost/log/expressions.hpp>
#include <boost/log/sources/severity_channel_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/utility/setup/console.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/sinks.hpp>
@mitjakukovec
mitjakukovec / async_result.cpp
Created January 8, 2021 08:22 — forked from inetic/async_result.cpp
Example usage of boost::asio::async_result
// Example of how to use boost::asio::async_result
#include <iostream>
#include <boost/asio.hpp>
#if BOOST_VERSION >= 106600
template<typename CompletionToken>
typename boost::asio::async_result
<CompletionToken, void(boost::system::error_code, std::string)>::return_type
@mitjakukovec
mitjakukovec / object_malloc.c
Created April 3, 2018 19:20 — forked from Wollw/object_malloc.c
A simple implementation of an object in C using malloc an free for creation and destruction.
/*
* A simple example of an object in ANSI C.
* This example uses malloc to create the new object.
*
* Note that with C++ the "this" variable is pretty much just implicit.
*
*/
#include <stdio.h>
#include <stdlib.h>
@mitjakukovec
mitjakukovec / class.c
Created April 3, 2018 19:18 — forked from Wollw/class.c
Object Encapsulation in ANSI C
#include <malloc.h>
#include "class.h"
/* This is the actual implementation of the class.
* Because this file isn't included by main.c
* code in main.c can not access foo except through
* the functions declared in class.h.
*/
struct my_class_s {
int foo;
@mitjakukovec
mitjakukovec / deque.c
Created April 3, 2018 19:16 — forked from Wollw/deque.c
Deque in C
#include <stdlib.h>
#include <assert.h>
#include "deque.h"
struct node_struct {
struct node_struct *next;
struct node_struct *prev;
deque_val_type val;
};
@mitjakukovec
mitjakukovec / 74HC595_example.c
Created April 3, 2018 19:15 — forked from Wollw/74HC595_example.c
ATMega328P 74HC595 Example
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t bits_type;
#define CFG_SHIFT_DDR DDRB
#define CFG_SHIFT_PORT PORTB
#define CFG_SHIFT_SRCLK PB1
#define CFG_SHIFT_RCLK PB2
@mitjakukovec
mitjakukovec / adc_example.c
Created April 3, 2018 19:12 — forked from Wollw/adc_example.c
ATmega328P ADC conversion example
/* A simple ADC example that checks the analog reading on ADC0 and turns
* an LED on if the reading is higher than a threshold value and turns if
* off if it is under that value. */
#include <avr/io.h>
#include <stdint.h>
/* Which analog pin we want to read from. The pins are labeled "ADC0"
* "ADC1" etc on the pinout in the data sheet. In this case ADC_PIN
* being 0 means we want to use ADC0. On the ATmega328P this is also
* the same as pin PC0 */
@mitjakukovec
mitjakukovec / m328p_fastpwm.c
Created April 3, 2018 19:11 — forked from Wollw/m328p_fastpwm.c
ATmega328P PWM Example
/**
* A PWM example for the ATmega328P using the 8-Bit Fast PWM mode.
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
#include <util/delay.h>
int main (void) {