Skip to content

Instantly share code, notes, and snippets.

View gotev's full-sized avatar

Aleksandar 'Alex' Gotev gotev

View GitHub Profile
@gotev
gotev / README.md
Created August 24, 2016 19:56
Check gradle dependency update
Settings > Editor > Inspections > "Newer Library Versions Available"

The description for this inspection:

Newer Library Versions Available This detector checks with a central repository to see if there are newer versions available for the dependencies used by this project. This is similar to the GradleDependency check, which checks for newer versions available in the Android SDK tools and libraries, but this works with any MavenCentral dependency, and connects to the library every time, which makes it more flexible but also much slower.

Because of the slowdown this can introduce I'd recommend running it manually periodically, rather than having it always on. You can do this by:

@gotev
gotev / ScreenshotDetector.java
Created November 5, 2016 20:25
Android Screenshot Detector
package net.gotev.gapp.utils;
import android.content.Context;
import android.net.Uri;
import android.os.Environment;
import android.os.FileObserver;
import android.os.Handler;
import android.util.Log;
import java.io.File;
@gotev
gotev / UIColorFromRGB.swift
Last active December 5, 2017 12:23
Color from Hex String in Swift 3
//
// UIColorFromRGB.swift
//
//
// Created by Alex Gotev on 21/11/16.
//
//
import Foundation
import UIKit
@gotev
gotev / ThrottledSearch.java
Last active February 6, 2021 08:47
Android Throttled Search
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import java.util.Timer;
import java.util.TimerTask;
/**
@gotev
gotev / ProximitySensor.java
Last active February 26, 2019 10:44
Android Proximity Sensor helper
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Build;
import android.os.PowerManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
@gotev
gotev / preBuildGradleTask.groovy
Created December 21, 2016 18:24
Pre build gradle task
// add this after dependencies section in a module
// this script has to be in the same path as the module
// otherwise, relative or absolute paths has to be used
task someScript(type: Exec) {
commandLine 'sh', '-c', './some_script.sh'
}
preBuild.dependsOn someScript
@gotev
gotev / listServerSideCipherSuites.md
Last active January 6, 2022 05:45
List server-side cipher suites

On OS X:

brew install nmap
nmap --script ssl-enum-ciphers -p 443 example.server.com

Example output

Starting Nmap 7.40 ( https://nmap.org ) at 2017-05-18 15:34 CEST
Nmap scan report for example.server.com (1.2.3.4)
Host is up (0.036s latency).
@gotev
gotev / AutoIncrementPodSpec.md
Created July 10, 2017 08:13
Auto increment podspec build

The problem

Auto increment podspec version. I have a MyPodName.podspec file like this:

Pod::Spec.new do |s|
  s.name         = "MyPodName"
  s.version      = "1.0.32"
  s.summary       = "My pod summary"
 s.description = <<-DESC
@gotev
gotev / RemoteHostChecks.md
Last active September 10, 2017 00:19
Remote host checks cheatsheet from linux

Check host reachability

IPv4

ping hostname_or_ip

IPv6

ping6 hostname_or_ip
@gotev
gotev / remove-submodule.sh
Last active May 10, 2019 05:03
Remove git submodule
#!/bin/bash
NAME="$1"
if [ "x$NAME" == "x" ]; then
echo "please tell me the submodule name to remove"
exit -1
fi
TMP_NAME="${NAME}_tmp"