Skip to content

Instantly share code, notes, and snippets.

cd ~/Library/Android/sdk/platform-tools/
# Get the hash of the mitmproxy-ca certificate.
openssl x509 -inform PEM -subject_hash_old -in ~/.mitmproxy/mitmproxy-ca.pem | head -1
# We will use this hash value, append '.0' (dot zero) and use this as the filename for the resulting Android certificate
cat ~/.mitmproxy/mitmproxy-ca.pem > c8750f0d.0
openssl x509 -inform PEM -text -in ~/.mitmproxy/mitmproxy-ca.pem -out /dev/null >> c8750f0d.0
# In an other terminal, we will start the emulator with writable /system volume
@scyto
scyto / docker-swarm-architecture.md
Last active May 8, 2024 09:15
My Docker Swarm Architecture
@khannasarthak
khannasarthak / InterviewRoadmap.md
Last active May 8, 2024 09:15
My Interview Study roadmap

Coding Interview University

I originally created this as a short to-do list of study topics for becoming a software engineer, but it grew to the large list you see today. After going through this study plan, I got hired as a Software Development Engineer at Amazon! You probably won't have to study as much as I did. Anyway, everything you need is here.

The items listed here will prepare you well for in an interview at just about any software company, including the giants: Amazon, Facebook, Google or Microsoft. >

@dergachev
dergachev / ssh-forward-clipboard.md
Last active May 8, 2024 09:15
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

@imyelo
imyelo / frpc.service
Last active May 8, 2024 09:14
run frp client as a service on windows and ubuntu / debian
# 1. put frpc and frpc.ini under /usr/local/frpc/
# 2. put this file (frpc.service) at /etc/systemd/system
# 3. run `sudo systemctl daemon-reload && sudo systemctl enable frpc && sudo systemctl start frpc`
# Then we can manage frpc with `sudo service frpc {start|stop|restart|status}`
# See also: https://nosame.net/use-frp-to-reverse-proxy-your-nas/
# Alternative for server:
# - Offical: https://github.com/fatedier/frp/blob/a4cfab6/conf/systemd/frpc%40.service
[Unit]
@skagedal
skagedal / WorkaroundWebViewController.swift
Created September 6, 2018 08:19
A simplified WKWebView view controller with workarounds for setting cookies.
import UIKit
import WebKit
class WorkaroundWebViewController: UIViewController, WKNavigationDelegate {
let request: URLRequest
private let websiteDataStore = WKWebsiteDataStore.default()
private var webView: WKWebView!
private var initialDummyNavigation: WKNavigation?
@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 09:12
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

Alpine.directive('typed', (el, { expression, modifiers }, { evaluateLater, effect, cleanup }) => {
const getStrings = evaluateLater(expression);
const modifierValue = (key, fallback) => {
if (-1 === modifiers.indexOf(key)) {
return fallback;
}
const value = modifiers[modifiers.indexOf(key) + 1];
@hakerdefo
hakerdefo / sources.list
Created June 11, 2023 18:47
Debian 12 "bookworm" complete sources.list
deb https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware
@zhangyoufu
zhangyoufu / 99-replica-set.sh
Created June 10, 2019 11:07
ugly hack to initialize replica set for MongoDB docker container, put under /docker-entrypoint-initdb.d/
#!/bin/bash
: "${FORKED:=}"
if [ -z "${FORKED}" ]; then
echo >&2 'mongod for initdb is going to shutdown'
mongod --pidfilepath /tmp/docker-entrypoint-temp-mongod.pid --shutdown
echo >&2 'replica set will be initialized later'
FORKED=1 "${BASH_SOURCE[0]}" &
unset FORKED
mongodHackedArgs=(:) # bypass mongod --shutdown in docker-entrypoint.sh