Skip to content

Instantly share code, notes, and snippets.

View piksel's full-sized avatar
📠

nils måsén piksel

📠
View GitHub Profile
@piksel
piksel / issue413.cs
Created February 1, 2020 11:03
Solution to SharpZipLib issue #413
using ICSharpCode.SharpZipLib.BZip2;
using System;
using System.Diagnostics;
using System.IO;
namespace Issue413
{
class Program
{
static void Main(string[] args)
public class KeySeeder
{
const int KeySize = 8;
private Random random;
private int currIndex = 0;
private char[] keyBuffer = new char[KeySize];
private char[] keyChars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-_".ToCharArray();
import PropTypes from 'prop-types';
export function interfacePropType<T>(): PropTypes.Requireable<T> {
const validator = function(props: { [key: string]: any }, propName: string, componentName: string, location: string, propFullName: string)
{
return null;
}
validator.isRequired= function(props: {[key: string]: any}, propName: string, componentName: string){return null}
@piksel
piksel / _readme.md
Created August 1, 2019 11:27 — forked from stecman/_readme.md
Brother P-Touch PT-P300BT bluetooth driver python

Controlling the Brother P-Touch Cube label maker from a computer

The Brother PTP300BT label maker is intended to be controlled using the official Brother P-Touch Design & Print iOS/Android app. The app has arbitrary limits on what you can print (1 text object and up to 3 preset icons), so I thought it would be a fun challenge to reverse engineer the protocol to print whatever I wanted.

Python code at the bottom if you want to skip the fine details.

Process

Intitially I had a quick peek at the Android APK to see if there was any useful information inside. The code that handles the communication with the printer in Print&Design turned out to be a native library, but the app clearly prepares a bitmap image and passes it to this native library for printing. Bitmaps are definitely something we can work with.

@piksel
piksel / Program.cs
Last active December 24, 2018 15:36
Try() and Attempt() Example
using System;
namespace Piksel.TryAttemptExample
{
using static Piksel.Helpers.StaticFunctions;
static class Program
{
static int Main(string[] args)
{
@piksel
piksel / Program.cs
Created September 16, 2018 12:27
Reproduction results for SharpZipLib Issue #270
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
namespace npoi_test
{
class Program
nils @ piksel-nox ~
✔ ➡ curl -s https://pub.p1k.se/public.key | sudo apt-key add -
OK
nils @ piksel-nox ~
✔ ➡ sudo add-apt-repository https://pub.p1k.se/ubuntu
nils @ piksel-nox ~
✔ ➡ sudo apt install i-nex
...
@piksel
piksel / Program.cs
Created July 18, 2018 18:37
SharpZipLib v1.0.0-rc1 Jar File Test
using System;
using ICSharpCode.SharpZipLib.Zip;
namespace JarZipTest
{
class Program
{
static void Main(string[] args)
{
var outDir = "out";
@piksel
piksel / Program.cs
Created July 18, 2018 17:53
SharpZipLib v1.0.0-rc1 Chinese Filename Test
using System;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
namespace chinese_test
{
class Program
{
static void Main(string[] args)
{