Skip to content

Instantly share code, notes, and snippets.

---
title: "The power of DRY"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
#rmarkdown::render("iwalk_script.Rmd")
library(dplyr)
library(forcats)
@su-vikas
su-vikas / screenshot.js
Created October 7, 2018 07:55
FRIDA script for bypassing Android FLAG_SECURE
Java.perform(function() {
var surface_view = Java.use('android.view.SurfaceView');
var set_secure = surface_view.setSecure.overload('boolean');
set_secure.implementation = function(flag){
console.log("setSecure() flag called with args: " + flag);
set_secure.call(false);
};
@novafacing
novafacing / RUST_OPTION_RESULT_CONVERSIONS.md
Created October 17, 2023 23:13
Rust Option/Result conversion functions

I used to have a site bookmarked with a table of all these functions, but the link is dead. Here's a matrix of Option and Result conversion functions. These become second nature once you have used Rust for any significant length of time, but it's useful to have a table reference.

For each of the below:

  • T is the value possibly contained in an input Ok Result or Some Option.
  • U is a new value created by transforming or replacing an input T. Note that when U appears in methods like map, U ?= T, for example by calling
@reinvented
reinvented / pdoc.php
Last active May 7, 2024 12:49
Automating the use of Canada Revenue's Payroll Deductions Online Calculator in PHP
<?php
/**
* get-pdoc.php - Scrape Canada Revenue Agency payroll deductions values
*
* This script takes an hourly amount, a number of hours, and a year,
* month and day of a pay period ending, and passes these to the
* Canada Revenue Agency Payroll Deductions Online Calculator
* (https://www.canada.ca/en/revenue-agency/services/e-services/e-services-businesses/payroll-deductions-online-calculator.html),
* returning the provincial tax, federal tax, CPP and EI amounts.
*
@gilbitron
gilbitron / CaddyController.php
Created June 16, 2021 10:55
Enabling HTTPS (SSL) for Laravel Sail using Caddy
<?php
# app/Http/Controllers/CaddyController.php
namespace App\Http\Controllers;
use App\Store;
use Illuminate\Http\Request;
class CaddyController extends Controller
{
@Aizazahmed-7
Aizazahmed-7 / DB27.226_microbiome_data.csv
Created May 7, 2024 11:12 — forked from baobabprince/DB27.226_microbiome_data.csv
Microbiome data for sample: DB27.226 . ASV column represent the sequence of specific bacteria. than there is the Taxonomic levels names. and the prevelance of specific bacteria in your gut and in the healthy population in israel. For further information about each bacteria, the last column contains a link to dbBact, showing information where the…
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
"Kingdom","Phyla","Class","Order","Family","Genus","Species","You","Population","ASV","link"
"k__Bacteria"," p__Bacteroidetes"," c__Bacteroidia"," o__Bacteroidales"," f__Prevotellaceae"," g__Prevotella"," s__copri",0.317892358258011,0.123966304244692,"TACGGAAGGTCCGGGCGTTATCCGGATTTATTGGGTTTAAAGGGAGCGTAGGCCGGAGATTAAGCGTGTTGTGAAATGTAGACGCTCAACGTCTGCACTGCAGCGCGAACTGGTTTCCTTGAGTACGCACAAAGTGGGCGGAATTCGTGG","http://dbbact.org/search_results?sequence=TACGGAAGGTCCGGGCGTTATCCGGATTTATTGGGTTTAAAGGGAGCGTAGGCCGGAGATTAAGCGTGTTGTGAAATGTAGACGCTCAACGTCTGCACTGCAGCGCGAACTGGTTTCCTTGAGTACGCACAAAGTGGGCGGAATTCGTGG"
"k__Bacteria"," p__Bacteroidetes"," c__Bacteroidia"," o__Bacteroidales"," f__S24-7"," g__"," s__",0.110209531635168,0.0315770158898006,"TACGGAGGATGCGAGCGTTATCCGGATTTATTGGGTTTAAAGGGAGCGCAGGCTGCGAGGCAAGTCAGCGGTCAAATGTCGGGGCTCAACCCCGGCCTGCCGTTGAAACTGTCCTGCTAGAGTTCGAGTGAGGTATGCGGAATGCGTTGT","http://dbbact.org/search_results?sequence=TACGGAGGATGCGAGCGTTATCCGGATTTATTGGGTTTAAAGGGAGCGCAGGCTGCGAGGCAAGTCAGCGGTCAAATGTCGGGGCTCAACCCCG

Kotlin clean code and best practices

Clean Code Rules

Our main aim is to have a clean code, avoid common silly mistakes and reduce the load on engineers during PR reviews. This is a team effort and If anyone has something that’s generally applicable, let’s talk and decide whether it should be baked into our style guide— so everyone can benefit from it

The bad code creates a lot of distractions. It causes developers to waste time and energy navigating through functions, classes, and files, and pouring over code trying to understand it.

Working on a project where developers care about clean code makes it easy to understand its virtues; the developer can read the code from top to bottom in one go and clearly understand what it does. It makes code manageable and maintainable in the long term, isolating changes and increasing the efficiency of the team.

@dvf
dvf / change-codec.md
Last active May 7, 2024 12:42
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@itewqq
itewqq / vscode-for-linux-kernel.md
Created February 19, 2023 14:37
Configure vscode for linux kernel source code
  1. Disable or uninstall the official C/C++ plugin.
  2. Install the clangd plugin.
  3. Build the kernel with clang:
/path/to/kernel_source$ make CC=clang defconfig
/path/to/kernel_source$ make CC=clang -j16
  1. Generate the compile_commands.json:
/path/to/kernel_source$ python ./scripts/clang-tools/gen_compile_commands.py