Skip to content

Instantly share code, notes, and snippets.

@alex-shpak
alex-shpak / gogs-on-rpi.md
Created February 4, 2017 16:41
Gogs on raspberry pi

Update and install dependencies

apt-get update; apt-get upgrade

dphys-swapfile swapoff
dphys-swapfile uninstall

apt-get remove -y --purge wolfram-engine triggerhappy xserver-common lightdm sonic-pi minecraft-pi pigpio
apt-get autoremove -y
@alex-shpak
alex-shpak / build.gradle
Created August 14, 2016 15:20
Idea gradle plugin workaround for kapt. This will create separate source root even if generated folder is excluded. For 2016.1+
apply plugin: 'kotlin'
kapt {
generateStubs = true
}
sourceSets {
generated.java {
srcDir file("build/generated/source/kapt/main")
}
@alex-shpak
alex-shpak / querydsl.gradle
Last active January 9, 2020 05:45
Gradle script for querydsl-apt processor with separate classpath
// apply plugin: 'idea'
sourceSets {
generated.java
main.java.srcDirs += generated.java.srcDirs
}
configurations {
querydslapt
}
@alex-shpak
alex-shpak / proguard-custom.txt
Last active November 2, 2015 12:56
Play Services 8.1.0 and MADS proguard rules
# MADS
-keep class com.madsadview.* { ; }
-keep class com.mads.adview.* { ; }
-dontwarn com.madsadview.**
-dontwarn com.mads.adview.**
# Play Ads 8.1.0
-dontwarn android.security.NetworkSecurityPolicy
@alex-shpak
alex-shpak / copy-icons.py
Created July 23, 2015 17:33
Script for copying multi-dimen files from material design icon set to working directories
#!/usr/local/bin/python3
import os, re, shutil
white = "white"
grey = "grey600"
black = "black"
dimensions = ["mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi"]
@alex-shpak
alex-shpak / swapon.sh
Last active July 20, 2022 11:03
swapon.sh /swap 2G
#!/bin/bash
FILE=${1-"/swapfile"}
SIZE=${2-"4G"}
fallocate -l $SIZE $FILE
chmod 600 $FILE
ls -lh $FILE
mkswap $FILE
@alex-shpak
alex-shpak / Interceptor.java
Last active June 14, 2024 02:40
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON