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

<!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>

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

@satnami
satnami / bb2gh.sh
Created March 25, 2021 15:20 — forked from leosoto/bb2gh.sh
Moves all your organization's bitbucket repositories to GitHub. Note that when a repository is correctly uploaded to GitHub it is *removed* from BitBucket. Requires https://bitbucket.org/zhemao/bitbucket-cli/. Set the variables BB_* with your bitbucket credentials and GH_* variables with your GitHub credentials.
#!/bin/bash
set -e
repos=$(bb list -u $BB_USERNAME -p $BB_PASSWORD --private | grep $BB_ORG | cut -d' ' -f3 | cut -d'/' -f2)
for repo in $repos; do
echo
echo "* Processing $repo..."
echo
git clone --bare git@bitbucket.org:$BB_ORG/$repo.git
cd $repo.git
echo
@satnami
satnami / docker-aliases.sh
Created February 21, 2021 04:41 — forked from jgrodziski/docker-aliases.sh
Useful Docker Aliases
############################################################################
# #
# ------- Useful Docker Aliases -------- #
# #
# # Installation : #
# copy/paste these lines into your .bashrc or .zshrc file or just #
# type the following in your current shell to try it out: #
# wget -O - https://gist.githubusercontent.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb/raw/d84ef1741c59e7ab07fb055a70df1830584c6c18/docker-aliases.sh | bash
# #
# # Usage: #
@satnami
satnami / ladder.md
Created January 4, 2021 04:44 — forked from jamtur01/ladder.md
Kickstarter Engineering Ladder
require 'rack/utils'
Rack::Utils.module_eval do
def self.set_cookie_header!(header, key, value)
case value
when Hash
domain = "; domain=" + value[:domain] if value[:domain]
path = "; path=" + value[:path] if value[:path]
max_age = "; max-age=" + value[:max_age] if value[:max_age]
expires = "; expires=" +
@satnami
satnami / rack_stats.rb
Created June 10, 2020 19:20 — forked from Gowiem/rack_stats.rb
Rack Middleware for collecting Rails stats on Controller, Action, and Global response times and response code
# Heavily inspired by:
# scout_statsd_rack -- https://github.com/scoutapp/scout_statsd_rack/blob/master/lib/scout_statsd_rack.rb
# trashed -- https://github.com/basecamp/trashed
# Add to Rails App: `config.middleware.use RackStats`
class RackStats
attr_accessor :app
def initialize(app)
@app = app
end
@satnami
satnami / Makefile
Created April 1, 2020 03:04 — forked from wshihadeh/Makefile
Dokcer Image Makefile
# The Project namespace, wshihadeh by default
NAMESPACE ?= wshihadeh
# Image name: simply we can use the application name
IMAGE_NAME := simple-rails
# The URL of Docker registry used to host the image.
REGISTRY ?= index.docker.io
# Docker image full name