Skip to content

Instantly share code, notes, and snippets.

@dzindra
dzindra / LibnfcJava.java
Last active June 7, 2017 17:48
Quick and dirty way how to use libnfc in java
package nfc;
import javax.smartcardio.CommandAPDU;
public class LibnfcJava {
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
public static String bytesToHex(byte[] bytes, int count) {
int len = Math.min(bytes.length, count);
char[] hexChars = new char[len * 3];
@dzindra
dzindra / webunarch.m
Created April 3, 2015 08:37
Extracting safari webarchive
//
// main.m
// webarchivedump
//
// Created by Jindrich Dolezy on 03.04.15.
// Copyright (c) 2015 Jindrich Dolezy. All rights reserved.
//
#import <Foundation/Foundation.h>
@dzindra
dzindra / dump.m
Created January 30, 2016 11:20
NSURLSessionConfiguration dump
- (void)dumpConfig:(NSURLSessionConfiguration *)config {
NSLog(@"config.identifier = %@", config.identifier);
NSLog(@"config.requestCachePolicy = %d", config.requestCachePolicy);
NSLog(@"config.timeoutIntervalForRequest = %lf", config.timeoutIntervalForRequest);
NSLog(@"config.timeoutIntervalForResource = %lf", config.timeoutIntervalForResource);
NSLog(@"config.networkServiceType = %d", config.networkServiceType);
NSLog(@"config.allowsCellularAccess = %d", config.allowsCellularAccess);
NSLog(@"config.discretionary = %d", config.discretionary);
NSLog(@"config.sharedContainerIdentifier = %@", config.sharedContainerIdentifier);
NSLog(@"config.sessionSendsLaunchEvents = %d", config.sessionSendsLaunchEvents);
class NotificationHelper {
let notificationCenter: NSNotificationCenter
var observers: [AnyObject] = []
init(notificationCenter: NSNotificationCenter = NSNotificationCenter.defaultCenter()) {
self.notificationCenter = notificationCenter
}
deinit {
observers.forEach { self.notificationCenter.removeObserver($0) }
@dzindra
dzindra / install.sh
Last active June 24, 2022 15:45
Raspberry PI read only filesystem with writable overlay
#!/bin/bash
cp overlay /etc/initramfs-tools/scripts/
echo "overlay" >> /etc/initramfs-tools/modules
mkdir /overlay /overlay/temp /overlay/base
update-initramfs -c -k `uname -r`
echo "initramfs initrd.img-`uname -r`" >> /boot/config.txt
echo "boot=overlay `cat /boot/cmdline.txt`" > /boot/cmdline.txt
@dzindra
dzindra / player.py
Last active May 23, 2017 10:42
Simple push button controlled song player for Raspberry Pi
#!/usr/bin/env python
import sys
import RPi.GPIO as GPIO
import signal
import subprocess
from time import sleep
pinOutput = 12
pinInput = 16
@dzindra
dzindra / STRV-printer-config.ini
Last active August 2, 2017 08:35
Strv printer config
# generated by Slic3r 1.36.2-prusa3d on Wed Aug 2 10:34:28 2017
[filament:Prusa PLA 1.75mm]
bed_temperature = 55
bridge_fan_speed = 100
cooling = 1
disable_fan_first_layers = 1
extrusion_multiplier = 1
fan_always_on = 1
fan_below_layer_time = 100
@dzindra
dzindra / homebridge.initd
Created March 11, 2018 10:59
Homebridge init.d service (Ubuntu)
#!/bin/sh
### BEGIN INIT INFO
# Provides: homebridge
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
@dzindra
dzindra / JLCPCB_CPL+BOM.ulp
Created March 5, 2021 07:52
JLCPCB BOM and CPL generator for Eagle
#usage "<b>Data generation for JLCPCB Assembly service</b>\n"
"<p>"
"Generates files for smds on the top and bottom layers "
"wich can be used with mounting machines. "
"The x and y coordinates (units: mm) of the SMD elements are calculated "
"as mean of maximum and mimimum value of the smds origin points. "
"The calculated value does not necessarily fit with the origin "
"point of the part in the layout."
"All SMD elements populated in currently set assembly variant are considered."
"</p>"
@dzindra
dzindra / overlay
Created October 6, 2022 18:31
/etc/initramfs-tools/scripts/overlay
# /etc/initramfs-tools/scripts/overlay
# default file generated by /usr/bin/raspi-config
# add highlighted lines to access lower and upper filesystems
# Local filesystem mounting -*- shell-script -*-
#
# This script overrides local_mount_root() in /scripts/local
# and mounts root as a read-only filesystem with a temporary (rw)
# overlay filesystem.