Skip to content

Instantly share code, notes, and snippets.

View lgawin's full-sized avatar

Łukasz Gawin lgawin

  • FoQuS
  • Warsaw, Poland
View GitHub Profile
diegohkd / DialogFragment+FullscreenWithCustomStatusBarColor.kt
Last active April 25, 2024 13:04
Show DialogFragment in full screen with status bar, change status bar background color and update status bar components color depending on background color to make them more readable
class MyDialogFragmentDialog : DialogFragment() {
private val statusBarColorRes = R.color.colorPrimaryDark
private var previousSystemUiVisibility: Int? = null
override fun getTheme(): Int =
cschiewek /
Last active May 15, 2024 08:26
X11 in docker on macOS

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz:
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
2E0PGS /
Last active May 11, 2024 06:48
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local

vxhviet /
Created July 11, 2016 06:36
Add ripple effect with xml (recommended over the RippleDrawable method)

Source: Self

Question: How to add ripple effect with xml instead of using RippleDrawable?



<?xml version="1.0" encoding="utf-8"?>
srayhunter /
Created August 29, 2015 05:38
Android Gradle Build Properties for Mac OSX
# project by srayhunter@github
# run the daemon on builds
org.gradle.jvmargs=-Djava.awt.headless=true -Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
myusuf3 /
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
JakeWharton / build.gradle
Created July 19, 2014 00:17
Adding support-annotations jar to a Java module.
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
def logger = new
def sdkHandler = new, logger)
for (File file : sdkHandler.sdkLoader.repositories) {
project.repositories.maven {
url = file.toURI()
nicktoumpelis /
Created April 23, 2014 13:00
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
yuta-imai / UserData script for setup CloudWatch
Last active March 13, 2022 01:28
With this user data script, you can set up cron job to put some custom metrics for CloudWatch at instance initiation.
cd /home/ec2-user
chown ec2-user:ec2-user aws-scripts-mon
echo "*/5 * * * * ec2-user /home/ec2-user/aws-scripts-mon/ --mem-util --disk-space-util --disk-path=/ --from-cron" >> /etc/crontab