Skip to content

Instantly share code, notes, and snippets.

@anjuan
anjuan / sideload_android_ota_update_using_adb.md
Last active September 11, 2024 14:48
Sideload Android OTA Update Using ADB

Pre-Work

  1. Make sure you backup any personal data such as photos before applying update.
  2. Get the latest adb tool from the Android SDK Platform-Tools package.
  3. Add adb to your PATH environment variable or, as the instructions below assume, change into the directory containing the executable.
  4. Enable USB debugging for your device as described here.

On Machine

  1. Change into the directory containing the adb executable.
  2. Download the latest OTA image (appropriate for your device) from https://developers.google.com/android/ota into the adb directory.
@wojteklu
wojteklu / clean_code.md
Last active November 20, 2024 10:49
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

// Three mostly separate examples: Adding, reading/listening, and removing multiple items from firebase
// Firebase V3.0.0
// one school has many courses and many studens
// one course has many students and is in only one school
// one student is in many courses and only one school
const db = firebase.database().ref('test');
const userId = firebase.auth().currentUser.uid;
/* -- ADDING -- */
@rajabishek
rajabishek / semaphore.c
Created March 19, 2015 16:32
Semaphore - Reader Writer Problem
#include<stdio.h>
#include<pthread.h>
#include<semaphore.h>
sem_t mutex,writeblock;
int data = 0,rcount = 0;
void *reader(void *arg)
{
int f;
@katowulf
katowulf / firebase_copy.js
Last active July 29, 2022 15:58
Move or copy a Firebase path to a new location
function copyFbRecord(oldRef, newRef) {
oldRef.once('value', function(snap) {
newRef.set( snap.value(), function(error) {
if( error && typeof(console) !== 'undefined' && console.error ) { console.error(error); }
});
});
}
@joeladdison
joeladdison / hamming.py
Last active May 16, 2021 02:55
Python functions for Hamming encoding and decoding, as used in CSSE3010 Prac 4 and Project 1. Manchester encoding is also included as a reference.
"""
Hamming and Manchester Encoding example
Author: Joel Addison
Date: March 2013
Functions to do (7,4) hamming encoding and decoding, including error detection
and correction.
Manchester encoding and decoding is also included, and by default will use
least bit ordering for the byte that is to be included in the array.