Skip to content

Instantly share code, notes, and snippets.

@tfcporciuncula
tfcporciuncula / 1 - ci.yml
Last active July 3, 2025 15:26
Keeping a project dependency graph on the README up to date automatically by always generating it on CI with a GitHub Action
generate-dependency-graph:
name: Generate Dependency Graph
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
@Cr4shOv3rrid3
Cr4shOv3rrid3 / keyboard.grub
Last active January 27, 2021 20:31
keyboard_suspend
i8042.direct - Put keyboard port into non-translated mode
i8042.dumbkbd - Pretend that controller can only read data from keyboard and cannot control its state (Don't attempt to blink the leds)
i8042.noaux - Don't check for auxiliary (== mouse) port
i8042.nokbd - Don't check/create keyboard port
i8042.noloop - Disable the AUX Loopback command while probing for the AUX port
i8042.nomux - Don't check presence of an active multiplexing controller
i8042.nopnp - Don't use ACPIPnP / PnPBIOS to discover KBD/AUX controllers
i8042.reset - Reset the controller during init and cleanup
i8042.unlock - Unlock (ignore) the keylock
@daluu
daluu / go_get_private_repos.txt
Last active March 26, 2023 08:51 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
```bash
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
```
@smhdk
smhdk / rxjava-switchmap-operator-example.kt
Created December 3, 2018 19:05
RxJava SwitchMap Operator Example with Kotlin
fun getModifiedObservable(integer: Int): Observable<Int> {
return Observable.create(object : ObservableOnSubscribe<Int> {
override fun subscribe(emitter: ObservableEmitter<Int>) {
emitter.onNext(integer * 2)
emitter.onComplete()
}
})
.subscribeOn(Schedulers.io())
}
@jenzz
jenzz / MultipleDataSourcesTest.java
Last active October 13, 2023 10:33
Proof of concept for RxJava Tidbits #4: Combining multiple data sources (https://medium.com/rxjava-tidbits/rxjava-tidbits-4-combining-multiple-data-sources-f921c1ad5358)
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.Scheduler;
import rx.functions.Func1;
import rx.observers.AssertableSubscriber;
import rx.schedulers.TestScheduler;
@dekalo-stanislav
dekalo-stanislav / versioning.gradle
Created March 21, 2017 10:21
Semantic Versioning for android application
/**
* Will generate versionCode from versionName that follows Semantic Versioning
*/
ext {
/**
* Application version is located version variable.
* And should follow next policy:
* X1.X2.X3-type-flavor, where X - any digits and type is optional alphabetical suffix.
* X1 - major version
* X2 - minor version
@VAdaihiep
VAdaihiep / AutoUpdateLocationService.java
Last active November 12, 2020 11:15
Tracking current location in background in interval. User google play service version 6.1.71. Use with newer google play service will be updated soon. Usage: context.startService(new Intent(context, AutoUpdateLocationService.class)); to start tracking. context.stopService(new Intent(context, AutoUpdateLocationService.class)); to stop tracking.
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.common.GooglePlayServicesUtil;
@ilyakatz
ilyakatz / largest.sql
Last active July 1, 2021 11:10
Largest tables (mysql)
/*
http://www.percona.com/blog/2008/02/04/finding-out-largest-tables-on-mysql-server/
*/
SELECT CONCAT(table_schema, '.', table_name) ,
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 ), 2), 'M') total_size,
ROUND(index_length / data_length, 2) idxfrac
@bjoernQ
bjoernQ / AndroidManifest.xml
Created October 14, 2013 13:02
Creating a System Overlay (Always on Top over all Apps) in Android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.mobilej.overlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application android:label="SystemOverlay" >
<activity
@Gautier
Gautier / CountDownTimer.java
Created December 12, 2010 00:58
Drop-in alternative for the Android CountDownTimer class, but which you can cancel from within onTick.
/*
* Copyright (C) 2008 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software