Skip to content

Instantly share code, notes, and snippets.

@satnami
satnami / bijective.rb
Created May 21, 2023 19:59 — forked from zumbojo/bijective.rb
Simple bijective function (base(n) encode/decode)
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join
@satnami
satnami / android-backup-apk-and-datas.md
Created April 27, 2023 10:22 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

Fetch application APK

@satnami
satnami / update-expired-apt-keys.sh
Last active September 14, 2021 10:27
Update expired apt keys
# https://serverfault.com/questions/7145/what-should-i-do-when-i-got-the-keyexpired-error-message-after-an-apt-get-update
# hkp://keyserver.ubuntu.com:80
# keys.gnupg.net
# for key in $(sudo apt-key list | awk -v FS='[ /:]+' '/expire[sd]/ {print $3}'); do sudo apt-key adv --recv-keys --keyserver keys.gnupg.net $key; done
for key in $(apt-key list | awk -v FS='[ /:]+' '/expire[sd]/ {print $3}'); do apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 $key; done
@satnami
satnami / takeout_gmail_senders_cleanup.sh
Last active September 1, 2021 05:17
Finding the Most Frequent Senders in Your Gmail Account
# From https://ryanfb.github.io/etc/2019/08/26/finding_the_most_frequent_senders_in_your_gmail_account.html
# Go to https://takeout.google.com/
# Select only Mail as mbox file
grep '^From:' ~/Downloads/Takeout/Mail/All\ mail\ Including\ Spam\ and\ Trash.mbox | cut -d'<' -f2 | tr -d '>' | sort | uniq -c | sort -rn > senders.txt
@satnami
satnami / dump-db-to-yml-fixture.rake
Created June 1, 2021 09:24
Dump DB to YML Fixtures
# https://stackoverflow.com/a/12188782
namespace :db do
namespace :fixtures do
desc 'Create YAML test fixtures from data in an existing database. Defaults to development database. Specify RAILS_ENV=production on command line to override.'
task :dump => :environment do
sql = 'SELECT * FROM %s ORDER BY ID'
skip_tables = ['schema_migrations']
# ActiveRecord::Base.establish_connection(Rails.env)
(ActiveRecord::Base.connection.tables - skip_tables).each do |table_name|
i = '000'
@satnami
satnami / system-design-template.md
Last active August 30, 2021 09:57
System Design Template

(1) FEATURE EXPECTATIONS [5 min]

    (1) Use cases
    (2) Scenarios that will not be covered
    (3) Who will use
    (4) How many will use
    (5) Usage patterns

(2) ESTIMATIONS [5 min]

    (1) Throughput (QPS for read and write queries)
    (2) Latency expected from the system (for read and write queries)

(3) Read/Write ratio

@satnami
satnami / 0000_feature_template.md
Created May 2, 2021 23:03
RFC Feature Template
  • Feature Name: (fill me in with a unique ident, my_awesome_feature)
  • Start Date: (fill me in with today's date, YYYY-MM-DD)
  • RFC PR: project/rfcs#0000
  • Proect Issue: project/rust#0000

Summary

<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1578057396" LAST_MODIFIED="0" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
@satnami
satnami / index.js
Last active August 30, 2021 10:05
S3 routing with react routing
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { createBrowserHistory } from "history";
import configureStore from "./redux/configureStore";
import * as serviceWorker from "./serviceWorker";
import App from "./App";
import ErrorBoundary from "./pages/ErrorBoundary";
const store = configureStore();

AD-XX: <TOPIC - short, concise summary>

  • Date: <DATE - when the decision was made>
  • Deciders: <DECIDERS - list everyone involved in the decision>
  • Status: [PROPOSED | ACCEPTED | SUPERSEDED | DEPRECATED]
  • Category: <CATEGORY - use a simple grouping to help organize the set of decisions (e.g. backend, payment, user management, ...)>

Related