Skip to content

Instantly share code, notes, and snippets.

View yusuphwickama's full-sized avatar

Yusuph Wickama yusuphwickama

View GitHub Profile
@yusuphwickama
yusuphwickama / listener.sh
Last active December 5, 2018 08:13
Used to download links with a specific keyword from a link.
#!/bin/bash
url="downloads.wickerlabs.com"
if [[ $(http "https://$url" | grep -i -c "$1") -eq 0 ]]; then
echo "[+] Not found, skipping downloading."
else
echo "[+] Starting downloading"
link="https://$url/$(http https://downloads.wickerlabs.com | sed -n 's/.*href="\([^"]*\).*/\1/p' | grep -i "$1" )"
echo "Link: $link"
@yusuphwickama
yusuphwickama / Logger.java
Created December 5, 2018 07:43
A logger that works only when the app is in debug mode.
import android.util.Log;
public class Logger {
private static final String TAG = "LOGGER";
public static void debug(String msg) {
if (BuildConfig.DEBUG) {
Log.d(TAG, "[+] ".concat(msg));
}
@yusuphwickama
yusuphwickama / endless_list.java
Last active December 5, 2018 08:03
Load more items on a list view when scrolling to the bottom.
boolean isLoading = false;
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
if (listAdapter != null &&
scrollState == SCROLL_STATE_IDLE &&
listView.getLastVisiblePosition() == (listView.getCount() - 1) &&
!isLoading && (listAdapter.getCount() != itemsProvider.getTotal())) {
@yusuphwickama
yusuphwickama / TZPhoneNumberUtils.java
Last active December 5, 2018 07:17
This is a class that can be used to Validate phone numbers in Tanzania based on a telecomm network, or if it fits the standard phone number format. It can also accept unformated number and return one that fits the format.
/*
* Copyright (c) 2018, Yusuph Wickama (WickerLabs). All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,