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
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
...
import androidx.fragment.app.DialogFragment
...
class MyDialogFragmentDialog : DialogFragment() {
...
private val statusBarColorRes = R.color.colorPrimaryDark
private var previousSystemUiVisibility: Int? = null
...
override fun getTheme(): Int = R.style.FullscreenDialog
...
@cschiewek
cschiewek / x11_docker_mac.md
Last active April 25, 2024 19:35
X11 in docker on macOS

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

  1. Install XQuartz: https://www.xquartz.org/
  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:
 environment:
@2E0PGS
2E0PGS / linux-usb-file-copy-fix.md
Last active April 12, 2024 13:19
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
vxhviet / rippleEffect_2.md
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?

Answer:

test_layout.xml:

<?xml version="1.0" encoding="utf-8"?>
@srayhunter
srayhunter / gradle.properties
Created August 29, 2015 05:38
Android Gradle Build Properties for Mac OSX
# project gradle.properties by srayhunter@github
# run the daemon on builds
org.gradle.daemon=true
org.gradle.jvmargs=-Djava.awt.headless=true -Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
@myusuf3
myusuf3 / delete_git_submodule.md
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
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 com.android.build.gradle.internal.LoggerWrapper(project.logger)
def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger)
for (File file : sdkHandler.sdkLoader.repositories) {
project.repositories.maven {
url = file.toURI()
@nicktoumpelis
nicktoumpelis / repo-rinse.sh
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
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.
#!/bin/sh
cd /home/ec2-user
wget http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip
unzip CloudWatchMonitoringScripts-v1.1.0.zip
rm CloudWatchMonitoringScripts-v1.1.0.zip
chown ec2-user:ec2-user aws-scripts-mon
echo "*/5 * * * * ec2-user /home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-util --disk-space-util --disk-path=/ --from-cron" >> /etc/crontab