Skip to content

Instantly share code, notes, and snippets.

@mvaisakh
mvaisakh / Bringup.md
Last active May 4, 2024 15:08
An Android Device Tree Bringup Guide

A small Device Tree Bringup Guide

Introduction

So, you guys might be wondering, how do these "Developers" get your favourite Custom roms, such as LineageOS, Paranoid Android etc., to their own devices. Well I'm here to Guide you on how to do it, specifically on how to bringup or make your own device tree from scratch or adapting.

Gist of this Guide: This is for people with genuine interest in Android OS porting/development. After going through this guide, you should be able to do a total device tree bringup on your own.

Prerequisite: Certain requirements are to be met before you start with this amazing journey.

@mid-kid
mid-kid / pdf-full-merge.js
Created October 18, 2023 21:39
Merge all attributes of multiple PDF files using MuPDF
// Merge all attributes of multiple PDF files (pdf-full-merge.js)
// Extended from MuPDF's docs/examples/pdf-merge.js
// Ever had problems with tools that don't copy certain attributes of a PDF?
// This script uses MuPDF to merge/join/concatenate as much as possible, including:
// - bookmarks / outlines / table of contents
// - link attributes of said outlines, such as viewrect and zoom
// - whether outlines appear open or closed by default
// - annotations
// - 3d objects / PDF3D
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active May 4, 2024 15:07
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@luqmanyusof
luqmanyusof / TM1637Basic.cpp
Created February 9, 2022 05:06
TM1637 without library
#define CLK 26
#define DIO 27
#include <Arduino.h>
uint8_t digits[] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f };
void start(void)
{
digitalWrite(CLK,HIGH);//send start signal to TM1637
digitalWrite(DIO,HIGH);
@rLinks234
rLinks234 / mmap_exec_ex1.cpp
Created January 31, 2017 06:09
Memory map executable code boilerplate (with mmap)
///
/// Author: Daniel Wright
///
/// Linux compile:
/// ${CC} -fPIC -fpie -std=c++14 -fno-exceptions -fno-rtti -lstdc++ -lm -lc -ldl mmap_exec_ex1.cpp -o mmap_exec_ex1
///
/// Tested on Android 7.1.1 (x86 emulator), as well as Ubuntu 16.04 (Core i5 3570k [targeting x64] using kernel 4.4.0-59)
#include <dlfcn.h>
#include <stdint.h>
@davidsteppenbeck
davidsteppenbeck / KeyframeView.swift
Created May 3, 2024 20:08
Keyframe Animation Example in SwiftUI
import SwiftUI
struct KeyframeValues {
var scale = 1.0
var horizontalStretch = 1.0
var verticalStretch = 1.0
var translation = 0.0
var rotation = Angle.zero
}
@drmalex07
drmalex07 / README-setup-tunnel-as-systemd-service.md
Last active May 4, 2024 15:04
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@djaiss
djaiss / progress_bar_migration_laravel.php
Last active May 4, 2024 15:03
Laravel: Use progress bars in migrations
<?php
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
class DoSomething extends Migration
{
public function up()
{
$output = new ConsoleOutput();
@vorce
vorce / jerry.swift
Last active May 4, 2024 15:02
Mouse move and click test thing for macos in swift
import Cocoa
import Foundation
// Move around and click automatically at random places in macos, kinda human like in a cheap way.
// Moves the mouse pointer to `moves` random locations on the screen and runs the `action` function at
// each point with the point as argument.
func mouseMoveWithAction(moves: Int, action: (CGPoint) -> Void = defaultAction) {
let screenSize = NSScreen.main?.visibleFrame.size
@bbengfort
bbengfort / locks.go
Created March 3, 2017 17:40
Synchronized, thread safe buffer using mutex embedding
package main
import (
"flag"
"fmt"
"log"
"sync"
"time"
)