Skip to content

Instantly share code, notes, and snippets.

@indivisible
indivisible / backbrightness.py
Created July 3, 2017 20:24
ACPI backlight to panel gamma converter for Alienware 13 R3 OLED
#!/usr/bin/env python3
# based on:
# https://gist.github.com/joel-wright/68fc3031cbb3f7cd25db1ed2fe656e60
import os
import time
from pathlib import Path
from functools import lru_cache
@ravibhure
ravibhure / git_rebase.md
Last active April 3, 2024 08:38
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@jeffdgr8
jeffdgr8 / TimePickerDialogFixedNougatSpinner.java
Last active February 14, 2023 13:15
TimePickerDialog with fixed android:timePickerMode spinner in Nougat
package my.packagename;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.TimePicker;
import java.lang.reflect.Constructor;
@venator85
venator85 / LibraryProjectTestRunner.java
Created September 6, 2016 10:43
A Robolectric test runner for library projects compatible with Android Gradle plugin 2.2.0-alpha6 and later
import org.junit.runners.model.InitializationError;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.internal.bytecode.InstrumentationConfiguration;
import org.robolectric.manifest.AndroidManifest;
import org.robolectric.res.FileFsFile;
import org.robolectric.res.FsFile;
public class LibraryProjectTestRunner extends RobolectricTestRunner {
@nesquena
nesquena / PatternEditableBuilder.java
Last active October 21, 2022 10:20
PatternEditableBuilder - Easy way to create colored clickable spans within a TextView!
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.regex.Matcher;
@lopspower
lopspower / README.md
Last active May 3, 2024 13:26
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@jgravois
jgravois / _webserver.md
Last active April 12, 2024 00:21
a simple guide for getting a local web server set up

Do I have a web server running?


having a web server turned on doesn't necessarily mean you are serving pages on the world wide web. its what allows you to load your own static files (.html, .js etc.) in a browser via http://.

if you're not sure whether or not you have a web server running, no problem! its easy to confirm.

what happens when you visit http://localhost/?

@stasikos
stasikos / ImageUtils.java
Created July 2, 2015 21:39
Convert color temperature in Kelvins to RGB
public class ImageUtils {
/**
* Convert color temperature in Kelvins to RGB color for AWT
* @param temperature
* @return ready to use color object
*/
public static Color getRGBFromK(int temperature) {
// Used this: https://gist.github.com/paulkaplan/5184275 at the beginning
// based on http://stackoverflow.com/questions/7229895/display-temperature-as-a-color-with-c
// this answer: http://stackoverflow.com/a/24856307
@keyboardr
keyboardr / HeadlessFragment.java
Last active December 31, 2021 01:05
A file template for creating a headless Fragment. The attach() methods add the fragment to the parent if it doesn't already exist and returns the attached fragment. The methods ensure that the parent implements the parent interface. If needed, parameters may be added to the attach() methods to supply fragment arguments.
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
#parse("File Header.java")
public class ${NAME} extends Fragment {
private static final String FRAG_TAG = ${NAME}.class.getCanonicalName();