Skip to content

Instantly share code, notes, and snippets.

Avatar

Don Phillips dptsolutions

  • Los Angeles, CA
View GitHub Profile
View dell-bios-fan-control.service
[Unit]
Description=Simple tool to enable or disable the SMBIOS fan (auto) fan control on Dell laptops
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/dell-bios-fan-control 0
RemainAfterExit=yes
ExecStop=/usr/local/bin/dell-bios-fan-control 1
StandardOutput=journal
@dptsolutions
dptsolutions / i8kmon.conf
Created Sep 29, 2019
i8kmon.conf file for Dell XPS 13 9350
View i8kmon.conf
# Sample i8kmon configuration file (/etc/i8kmon.conf, ~/.i8kmon).
# External program to control the fans
set config(i8kfan) /usr/bin/i8kfan
# Enable/Disable user configuration file at ~/.i8kmon (0 = Disable, 1 = Enable)
set config(use_conf) 0
# Report status on stdout, override with --verbose option
set config(verbose) 0
@dptsolutions
dptsolutions / dell-smm-hwmon.conf
Created Sep 29, 2019
dell-smm-hwmon.conf to force loading of dell-smm-hwmon module on "unsupported" Dell laptops (like XPS 13 9350)
View dell-smm-hwmon.conf
#Force loading of the Dell Laptop SMM BIOS hwmon driver
options dell-smm-hwmon ignore_dmi=1 restricted=0 force=1
#Added ignore_dmi=1 per https://www.reddit.com/r/Dell/comments/9pdgid/configuring_the_xps_to_play_nice_with_linux/
#Added force=1 per https://askubuntu.com/questions/1094485/dell-xps-15-9570-how-to-control-the-fans
@dptsolutions
dptsolutions / MimeTypes.kt
Last active Apr 6, 2021 — forked from markwhitaker/MimeTypes.java
Standard MIME type constants ready to use in a Kotlin project
View MimeTypes.kt
object MimeTypes {
object Application {
const val ATOM_XML = "application/atom+xml"
const val ATOMCAT_XML = "application/atomcat+xml"
const val ECMASCRIPT = "application/ecmascript"
const val JAVA_ARCHIVE = "application/java-archive"
const val JAVASCRIPT = "application/javascript"
const val JSON = "application/json"
const val MP4 = "application/mp4"
const val OCTET_STREAM = "application/octet-stream"
@dptsolutions
dptsolutions / RxjavaBitmapMergeView.java
Last active Apr 25, 2018
Using RxJava 2 to tint & merge an arbitrary number of Bitmaps into a single Bitmap and display the merged bitmap into an ImageView
View RxjavaBitmapMergeView.java
public class RxjavaBitmapMergeView {
SchedulersFacade schedulersFacade;
@BindView(R.id.map)
ImageView map;
@BindArray(R.array.impact_map_colors)
@ColorInt
int[] mapColors;
@dptsolutions
dptsolutions / gist:31e06d0990b7e18cea48b8277f152d7a
Created Apr 16, 2018
Name APK output file in following format - {AppName}-{ProductFlavorName}-{BuildTypeName}-{shortGitSha}.apk (Works with Android Gradle Plugin 3.x)
View gist:31e06d0990b7e18cea48b8277f152d7a
//1. Put this file in the root of your project
//2. Add apply from: "../artifacts.gradle" to the end of your app module's build.gradle file
android.applicationVariants.all { variant ->
def appName
def shortGitSha = 'git rev-parse --short HEAD'.execute().text.trim()
//Check if an applicationName property is supplied; if not use the name of the parent project.
if (project.hasProperty("applicationName")) {
appName = applicationName
} else {
@dptsolutions
dptsolutions / Glide4OkHttp3Dagger2Module.java
Created Jul 2, 2017
Example AppGlideModule Injecting OkHttpClient using Dagger 2
View Glide4OkHttp3Dagger2Module.java
/**
* {@link AppGlideModule} for the app
*/
@Excludes(OkHttpLibraryGlideModule.class)
@GlideModule
public class MyAppGlideModule extends AppGlideModule {
//Below override should only be used if not using legacy modules registered via manifest
@Override
public boolean isManifestParsingEnabled() {
@dptsolutions
dptsolutions / MyActivityOrFragment.java
Last active Dec 6, 2017
Vector Drawables used as menu icons at all API Levels
View MyActivityOrFragment.java
Toolbar toolbar;
//Call initToolBarMenuIcons after you've inflated the layout into your Activity/Fragment that holds your Toolbar.
@MainThread
@SuppressLint("NewApi") //suppress warning, since using DrawableCompat to set tint
public void initToolBarMenuIcons() {
toolbar.inflateMenu(R.menu.main);
//Manually adding icon since it's a vector drawable and we can't currently inflate from XML into menuitems
Drawable wrappedLogoutIcon = DrawableCompat.wrap(AppCompatResources.getDrawable(getContext(), R.drawable.ic_logout_black_24dp));
//Tint it too
View activity.xml
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--Below FrameLayout doesn't need to be a FrameLayout. Any ViewGroup will do -->
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"