Skip to content

Instantly share code, notes, and snippets.

View jandrop's full-sized avatar

Alejandro jandrop

View GitHub Profile
@jandrop
jandrop / how-to-install-telegram-send
Created January 9, 2021 00:53 — forked from CHERTS/how-to-install-telegram-send
Fail2ban + Telegram using telegram-send
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.9 (jessie)
Release: 8.9
Codename: jessie
Installing telegram-send
# pip install telegram-send
@jandrop
jandrop / UNMS-Unifi-Pi-Buster.md
Created January 21, 2020 12:09 — forked from codeniko/UNMS-Unifi-Pi-Buster.md
Setup UNMS and Unifi network controller on Raspberry pi 4 Raspbian buster

Setup Raspbian Buster

I'm using debian 10 as my daily so these are *nix commands. Mac should work with these too but you're on your own if you're using Windows. Goal for me is to make a headless raspberry pi I can SSH into and connect to my network using Ethernet. You should be comfortable in command line if you choose to follow this guide.

  1. Go to https://www.raspberrypi.org/downloads/raspbian and download Raspbian lite archive
  2. unzip the image
  3. Plug in sdcard. Run lsblk to see drives and mount points. Likely, the sdcard will show up in /dev/sda or /dev/sdb and may have some partitions like /dev/sda1 and /dev/sda2.
  4. If partitions are mounted, unmount all of them. Ex: umount /dev/sda1 and umount /dev/sda2
  5. Copy the raspbian image to the sdcard with sudo dd if=RASPBIAN_IMAGE_FILE.img of=/dev/sda bs=4M
  6. Run sync to ensure the written contents are flushed
  7. OPTIONAL: To start ssh server on boot, Unplug sdcard and reinsert to remount new partitions. You'll have two with raspbian.
JsonObject json = (JsonObject)parser.parse(new Gson().toJson(myPojo));
@jandrop
jandrop / CheckUpdate.java
Created May 30, 2016 10:09
PlayStore checker
/*
* Copyright [2016] [Alejandro Platas Mallo]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@jandrop
jandrop / BaseActivity.java
Last active September 11, 2018 19:32
Base Activity with toolbar
package es.atrapandocucarachas.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import es.atrapandocucarachas.R;
/**
* @author Alejandro Platas Mallo
@jandrop
jandrop / IntentUtils.java
Last active September 11, 2018 19:32
Collection of Intents
package es.atrapandocucarachas.utils;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.provider.Settings;
import android.text.TextUtils;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by khaled bakhtiari on 10/26/2014.
* <a href="http://about.me/kh.bakhtiari">
*/
@jandrop
jandrop / MarqueeToolbar.java
Created March 17, 2016 11:00 — forked from InsanityOnABun/MarqueeToolbar.java
A Marquee-able Android Toolbar.
import android.content.Context;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.widget.TextView;
import java.lang.reflect.Field;
public class MarqueeToolbar extends Toolbar {
private static final int PICK_PHOTO_FOR_AVATAR = 0;
public void pickImage() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, PICK_PHOTO_FOR_AVATAR);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software