Skip to content

Instantly share code, notes, and snippets.

@baosiek
baosiek / root-ca.cnf
Last active June 26, 2021 04:50
Root CA Configuration file
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# Note that you can include other files from the main configuration
# file using the .include directive.
#.include filename
# This definition stops the following lines choking if HOME isn't
@noamtamim
noamtamim / README.md
Last active June 12, 2024 13:15
Markdown with PlantUML

How to use PlantUML with Markdown

PlantUML is a really awesome way to create diagrams by writing code instead of drawing and dragging visual elements. Markdown is a really nice documentation tool.

Here's how I combine the two, to create docs with embedded diagrams.

Step 0: Setup

Get the command-line PlantUML from the download page or your relevant package manager.

@fscm
fscm / install_tree.md
Last active February 28, 2024 12:15
[macOS] Install 'tree' command from source

[macOS] Install 'tree' command from source

Instructions on how to install the tree command on macOS from source.

Prerequisites

macOS Command Line Tools need to be installed on your local computer.

To install the Command Line Tools run the following command:

@objcode
objcode / ConcurrencyHelpers.kt
Last active May 31, 2024 13:31
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@RohitSurwase
RohitSurwase / CoroutineIntentService.kt
Last active May 22, 2024 22:54
IntentService (Service) using Kotlin Coroutines instead of Handler+Looper.
import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.support.annotation.Nullable
import android.support.annotation.WorkerThread
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.channels.actor
import kotlin.coroutines.CoroutineContext
@wellsie
wellsie / has-space.sh
Created March 18, 2016 17:08
Function to determine if a string contains a space in bash
#!/bin/bash -eux
function has-space {
[[ "$1" != "${1%[[:space:]]*}" ]] && return 0 || return 1
}
if has-space "sadfsdf" ; then
echo "SPACE"
fi
@NarendraDodiya
NarendraDodiya / StepValueSeekbar.java
Last active April 2, 2021 22:10
seekbar with step value and min max or range values
package tyrantgit.sample;
import android.view.View;
import android.widget.SeekBar;
/**
* Created by narendra on 30/9/15.
*/
public class StepValueSeekbar {
@st-f
st-f / ThreeLevelExpandableListView.java
Last active August 15, 2023 22:52
A 3 level expandable list view
package net.stf.threelevelexpandablelistview;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
@JakeWharton
JakeWharton / ForegroundImageView.java
Created July 10, 2014 16:42
An ImageView which supports a foreground drawable.
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
public class ForegroundImageView extends ImageView {
private Drawable foreground;
@staltz
staltz / introrx.md
Last active June 18, 2024 06:15
The introduction to Reactive Programming you've been missing