Skip to content

Instantly share code, notes, and snippets.

View jandrop's full-sized avatar

Alejandro jandrop

View GitHub Profile
@codeniko
codeniko / UNMS-Unifi-Pi-Buster.md
Last active June 22, 2023 02:23
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.
@jorgeassuncao
jorgeassuncao / ESP_Energy_Monitor_MQTT.ino
Last active January 23, 2019 19:19
ESP_Energy_Monitor_MQTT
/**
* This script is based on these sources:
*
* To count pulses using interruptions: https://github.com/mysensors/MySensors/blob/master/examples/EnergyMeterPulseSensor/EnergyMeterPulseSensor.ino
* To connect to Wifi and publish MQTT messages: https://github.com/knolleary/pubsubclient/blob/master/examples/mqtt_esp8266/mqtt_esp8266.ino
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
@xoan
xoan / FoldaRap - 1.2.9.ini
Last active February 15, 2016 00:06
Slic3r 1.2.9 configuration for FoldaRap
# generated by Slic3r 1.2.9 on Mon Feb 15 00:27:19 2016
avoid_crossing_perimeters = 0
bed_shape = 0x0,140x0,140x140,0x140
bed_temperature = 0
before_layer_gcode =
bottom_solid_layers = 2
bridge_acceleration = 0
bridge_fan_speed = 100
bridge_flow_ratio = 1
bridge_speed = 40
@bunjix
bunjix / Activity_or_Fragment.java
Last active January 9, 2020 10:28
Pick an image on Android
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) {
@ec84b4
ec84b4 / gist:d56c00fb5fd2dfaf279b
Last active June 26, 2018 06:22
recycler view header adapter
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">
*/
@chrisbanes
chrisbanes / FloatLabelLayout.java
Last active September 4, 2024 05:58
FloatLabelLayout
/*
* Copyright 2014 Chris Banes
*
* 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
@patrickhammond
patrickhammond / gist:7598623
Last active August 13, 2021 03:03
Adds list dividers between children in a linear layout. showDividers takes a set of flags (ex: you can specify beginning|middle|end to get dividers at the start of the layout, through the layout, and at the end of the layout. API 11+ http://developer.android.com/reference/android/widget/LinearLayout.html#setShowDividers(int)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="middle"
android:divider="?android:listDivider"
android:dividerPadding="16dp">
</LinearLayout>
@carlosefonseca
carlosefonseca / GPXWriter.java
Created August 2, 2013 20:26
Writes a list of timed coordinates to a GPX file.
package pt.beware.core;
import android.location.Location;
import pt.beware.common.utils.Log;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;