Skip to content

Instantly share code, notes, and snippets.

View snetts's full-sized avatar

Victor Okech snetts

View GitHub Profile
@snetts
snetts / MyTabLayout.kt
Created November 15, 2021 12:31 — forked from pjonceski/MyTabLayout.kt
Custom views at TabLayout with custom text style and indicator at selected tab
class MyTabLayout : TabLayout {
private val mTitles: MutableList<String> = arrayListOf()
private var mUnselectedTypeFace: Typeface? = null
constructor(context: Context?) : super(context) {
init(context, null)
}
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
init(context, attrs)
@snetts
snetts / gdrive_download.md
Created July 31, 2019 17:42 — forked from vladalive/gdrive_download.md
Download Google Drive files from linux terminal via wget

Setup:

  1. Add this code to your ~/.bash_aliases file.
function gdrive_download () {
  CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
  wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2
  rm -rf /tmp/cookies.txt
}
@snetts
snetts / instagram_mine.py
Created June 30, 2019 12:37 — forked from rubinovitz/instagram_mine.py
A python script for downloading all of the instagram photos of a certain hashtag I wrote for a friend in 20 minutes (forgive sloppiness). Warning: you're only allowed 30 API requests an hour. Requires your own access token set as environment variable "access_token".
from datetime import datetime
import urllib2
import urllib
import json
import os
def ajaxRequest(url=None):
"""
Makes an ajax get request.
url - endpoint(string)
@snetts
snetts / Staging&ProductionUsingGit
Created February 20, 2018 16:58 — forked from mediabeastnz/Staging&ProductionUsingGit
Staging and Production Server using Git.
If you are running a large website where you will need to test new features on a seperate url before pushing them live then the following instructions are for you ;)
For this example imagine your url is apple.com and you want a development/staging site on a subdomain which is dev.apple.com
#Setup#
1. First thing you'll want to do is go ahead and create your website in plesk and add the subdomain dev.apple.com at the same time.
2. ssh into the server e.g. $ ssh username@ipaddress
3. Once logged in cd into the private directory (this will be where all git repos are stored) e.g. $ cd ~/private
4. Create the main repo e.g. $ git init --bare apple.git
5. Now to clone this new repo on your local machine. $ git clone ssh://username@ipaddres/~/private/apple.com
public class Json {
public static JSONObject getJson(String url){
InputStream is = null;
String result = "";
JSONObject jsonObject = null;
// HTTP
try {