Skip to content

Instantly share code, notes, and snippets.

View wimhaanstra's full-sized avatar

Wim Haanstra wimhaanstra

View GitHub Profile
@wimhaanstra
wimhaanstra / backup.sh
Last active July 25, 2024 06:05
backup.sh
#!/bin/bash
# Array of directories you want to backup. It will loop through these directories and backup any
# directory inside it. Files will be ignored
directories_to_backup=("/storage/docker")
# Simple YYYYmmdd based foldername
time_stamp=$(date +%Y%m%d)
# If you want all files to be set to a certain owner, before backing up
@wimhaanstra
wimhaanstra / README.md
Created March 27, 2024 06:18
Getting Bluetooth to work on HomeAssistant Docker on Ubuntu 23

Dockerfile

Volumes

Make sure you have the following volume mounted in your Dockerfile:

volumes:
  - /var/run/dbus:/var/run/dbus
assert(getprop("ro.product.device") == "charlotte" || getprop("ro.build.product") == "charlotte" ||
getprop("ro.product.device") == "kirin970" || getprop("ro.build.product") == "kirin970" || abort("E3004: This package is for device: charlotte,kirin970; this device is " + getprop("ro.product.device") + "."););
assert(huawei.verify_vendor_build_id("P") == "1");
ui_print("Target: Huawei/lineage_charlotte/charlotte:9/PQ3A.190801.002/4eade15b97:userdebug/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup", "/system/system");
w3wp.exe Error: 0 : [IdentityServer3.Core.Configuration.Hosting.ErrorPageFilterAttribute]: 07/07/15 04:14:12 +00:00 -- Exception accessing: /identity/permissions
System.InvalidOperationException: Sequence contains more than one element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, Js
@wimhaanstra
wimhaanstra / CocoaLumberjack.swift
Last active August 29, 2015 14:06
CocoaLumberjack Swift Wrapper, fixed for Xcode 6 B6 and up
// Created by Ullrich Schäfer on 16/08/14.
// Bitmasks are a bit tricky in swift
// See http://natecook.com/blog/2014/07/swift-options-bitmask-generator/
//enum LogFlag: Int32 {
// case Error = 0b1
// case Warn = 0b10
// case Info = 0b100
@wimhaanstra
wimhaanstra / SBCircleProgressBar.h
Created November 19, 2011 07:19
A circle as progressbar
//
// SBCircleProgressBar.h
//
// Created by Wim Haanstra on 17-11-11.
// Copyright (c) 2011 Sorted Bits. All rights reserved.
//
@interface SBCircleProgressBar : UIView
// The maximum value of the progressbar
@wimhaanstra
wimhaanstra / gist:1302265
Created October 20, 2011 20:28
NSURLConnection in its own thread
NSString* url = @"http://your.url/here";
NSURL* nsurl = [NSURL URLWithString:url];
NSMutableURLRequest* urlReq = [[NSMutableURLRequest alloc] initWithURL:nsurl];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:urlReq delegate:self];
while(!finished) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
}
- (void) connectionDidFinishLoading:(NSURLConnection *)connection
@wimhaanstra
wimhaanstra / gist:1302242
Created October 20, 2011 20:21
Placing curved text on an UIImage
NSArray* sections = [[NSArray alloc] initWithObjects:@"text1", @"text2", @"text3", @"text4", nil];
- (UIImage*) createMenuRingWithFrame:(CGRect)frame
{
// First fix the frame to make sure it uses the right scaling (iPhone 4 / iPad compatibility).
frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width * scale, frame.size.height * scale);
// Same for the text radius
float scaledTextRadius = textRadius * scale;
float scaledRingWidth = ringWidth;
@wimhaanstra
wimhaanstra / LocalizationHelper.h
Created October 20, 2011 19:39
LocalizationHelper
//
// LocalizationHelper.h
//
// Created by Wim Haanstra on 9/30/10.
// Copyright 2010 Wim Haanstra. All rights reserved.
//
#import
@interface LocalizationHelper : NSObject { }
@wimhaanstra
wimhaanstra / LocalizationHelper.h
Created October 20, 2011 19:38
LocalizationHelper
//
// LocalizationHelper.h
//
// Created by Wim Haanstra on 9/30/10.
// Copyright 2010 Wim Haanstra. All rights reserved.
//
#import
@interface LocalizationHelper : NSObject { }