Tested on NCA-1510B Lanner Electronics Inc.
- Ubuntu machine with network connection for making bootable USB.
- An 8GiB USB.
- Download latest ubuntu server distro image. Recommend ubuntu-server 18.04
| mkdir -p "$HOME/Library/LaunchAgents" | |
| tee "$HOME/Library/LaunchAgents/com.sd.autobackup.plist" >/dev/null <<'EOF' | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>com.sd.autobackup</string> | |
| <key>WatchPaths</key> | |
| <array> |
| from django.core.paginator import Paginator | |
| class SimpleCountPaginator(Paginator): | |
| def _get_count(self): | |
| try: | |
| first_id = self.object_list.first().id | |
| last_id = self.object_list.last().id | |
| if (first_id is None) or (last_id is None): | |
| return 0 | |
| max_id = max(last_id, first_id) |
Tested on NCA-1510B Lanner Electronics Inc.
| public static String makePasswordHash(String text) { | |
| byte[] salt = "yoursalt".getBytes(Charsets.UTF_8); | |
| try { | |
| char[] chars = text.toCharArray(); | |
| final int iterations = 10; | |
| // Generate a 256-bit key | |
| final int outputKeyLength = 256; |
| #import <CommonCrypto/CommonCrypto.h> | |
| + (NSString*)onewayHash:(NSString *)text { | |
| NSMutableData *key = [NSMutableData dataWithLength:kCCKeySizeAES256]; | |
| NSString *password = text; | |
| NSString* saltText = @"salt"; | |
| NSData* salt = [saltText dataUsingEncoding:NSUTF8StringEncoding]; | |
| int result = CCKeyDerivationPBKDF(kCCPBKDF2, // algorithm |
| package com.zuhlke.lsapi; | |
| import org.bouncycastle.crypto.PBEParametersGenerator; | |
| import org.bouncycastle.crypto.digests.SHA3Digest; | |
| import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator; | |
| import org.bouncycastle.crypto.params.KeyParameter; | |
| import org.bouncycastle.crypto.prng.DigestRandomGenerator; | |
| import java.util.Base64; |
| protocol UIntToBytesConvertable { | |
| var toBytes: [UInt8] { get } | |
| } | |
| extension UIntToBytesConvertable { | |
| func toByteArr<T: BinaryInteger>(endian: T, count: Int) -> [UInt8] { | |
| var _endian = endian | |
| let bytePtr = withUnsafePointer(to: &_endian) { | |
| $0.withMemoryRebound(to: UInt8.self, capacity: count) { | |
| UnsafeBufferPointer(start: $0, count: count) |
| void CGImageWriteToFile(CGImageRef image, NSString *path) { | |
| CFURLRef url = (__bridge CFURLRef) [NSURL fileURLWithPath:path]; | |
| CGImageDestinationRef destination = CGImageDestinationCreateWithURL(url, kUTTypePNG, 1, NULL); | |
| CGImageDestinationAddImage(destination, image, nil); | |
| if (!CGImageDestinationFinalize(destination)) { | |
| NSLog(@"Failed to write image to %@", path); | |
| } | |
| } |