Skip to content

Instantly share code, notes, and snippets.

Alex Shpak alex-shpak

  • Sweden
Block or report user

Report or block alex-shpak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alex-shpak
alex-shpak / gogs-on-rpi.md
Created Feb 4, 2017
Gogs on raspberry pi
View gogs-on-rpi.md

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 Aug 14, 2016
Idea gradle plugin workaround for kapt. This will create separate source root even if generated folder is excluded. For 2016.1+
View build.gradle
apply plugin: 'kotlin'
kapt {
generateStubs = true
}
sourceSets {
generated.java {
srcDir file("build/generated/source/kapt/main")
}
@alex-shpak
alex-shpak / querydsl.gradle
Last active Jan 9, 2020
Gradle script for querydsl-apt processor with separate classpath
View querydsl.gradle
// apply plugin: 'idea'
sourceSets {
generated.java
main.java.srcDirs += generated.java.srcDirs
}
configurations {
querydslapt
}
@alex-shpak
alex-shpak / proguard-custom.txt
Last active Nov 2, 2015
Play Services 8.1.0 and MADS proguard rules
View proguard-custom.txt
# 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 Jul 23, 2015
Script for copying multi-dimen files from material design icon set to working directories
View copy-icons.py
#!/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 Nov 14, 2016
swapon.sh /swap 2G
View swapon.sh
#!/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 Jan 15, 2020
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
View Interceptor.java
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
You can’t perform that action at this time.