Skip to content

Instantly share code, notes, and snippets.

View farshadmb's full-sized avatar
👨‍💻
Developing

Farshad Mousalou farshadmb

👨‍💻
Developing
View GitHub Profile
@itsmikita
itsmikita / macos-iso.md
Last active November 12, 2024 10:53
Extract ISO image from macOS Somona installer
@opentaq
opentaq / mailserver.md
Last active November 14, 2024 16:49
Mailserver Installation

Fail2Ban

sudo install fail2ban

UFW

sudo install ufw

UFW Settings

sudu ufw default deny incomoing

sudo ufw default allow outgoins

@Nielio
Nielio / compose.yml
Last active October 11, 2024 17:44
Gitlab CE with build in Container Registry behind Traefik 2 with Letsencrypt
version: "3.6"
services:
gitlab:
image: gitlab/gitlab-ce
volumes:
- gitlab-data:/var/opt/gitlab
- gitlab-logs:/var/log/gitlab
- gitlab-config:/etc/gitlab
networks:
- traefik-public
@orgmir
orgmir / PagingDataExt.kt
Created August 26, 2020 08:19
Extract list of data from a androidx.paging.PagingData object
/**
* Extracts the list of data from a PagingData object.
* Useful for testing transformations on PagingData.
*
* flowOf(PagingData.from(listOf(model)).toList() == listOf(model)
*
* When nothing else is left, Java reflection will always be there to help us out.
*/
@Suppress("UNCHECKED_CAST")
private suspend fun <T : Any> PagingData<T>.toList(): List<T> {
@osipxd
osipxd / .editorconfig
Last active September 9, 2024 19:11
EditorConfig for Android projects with mapping to IntelliJ IDEA's config
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
@zfael
zfael / load-test.ts
Last active October 7, 2024 19:24
Node script for load testing!
/**
* Usage
* - npm install loadtest
* - npx ts-node load-test.ts
*/
import loadtest from 'loadtest';
const method = 'GET';
@thsaravana
thsaravana / MyApplication.java
Created March 2, 2020 04:23
To know if App has gone to background or is in foreground
public class MyApplication implements LifecycleObserver {
@Override
public void onCreate() {
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
}
@OnLifecycleEvent(Lifecycle.Event.ON_START)
public void onStart() {
Log.d("App in foreground");
@Karn
Karn / LogController.kt
Last active August 5, 2024 17:09
An example implementation of a process to write logs to disk asynchronously using RxJava
typealias LogElement = Triple<String, Int, String?>
object LogController {
private var flush = BehaviorSubject.create<Long>()
private var flushCompleted = BehaviorSubject.create<Long>()
private var LOG_LEVELS = arrayOf("", "", "VERBOSE",
"DEBUG",
"INFO",
//
// DayCellView.swift
// T-Shifts
//
// Created by Roberto Esposito on 09/02/2017.
// Copyright © 2017 Roberto Esposito. All rights reserved.
//
import Foundation
import JTAppleCalendar
@sgr-ksmt
sgr-ksmt / AnyObserver+.swift
Last active September 9, 2022 10:07
MVVM + RxSwift + Property Wrapper
extension AnyObserver {
static func create<E>(_ relay: PublishRelay<E>) -> AnyObserver<E> {
return .init { event in
guard case let .next(value) = event else { return }
relay.accept(value)
}
}
static func create<E>(_ relay: BehaviorRelay<E>) -> AnyObserver<E> {
return .init { event in