Skip to content

Instantly share code, notes, and snippets.

View dansku's full-sized avatar
🌮
Focusing on tacos

Daniel Andrade dansku

🌮
Focusing on tacos
View GitHub Profile
@dansku
dansku / Two_Adafruit_MMA8451.ino
Last active October 29, 2016 10:24
Interfacing two MMA8451 accelerometers at the same time
/*
Code for interfacing two Adafruit MMA8451 accelerometers in one arduino via I2C.
Daniel Andrade - www.danielandrade.net
October 2016
*/
#include <Wire.h> // I2C Wire Library
// Adafruit Libraries
#include <Adafruit_MMA8451.h> // https://github.com/adafruit/Adafruit_MMA8451_Library
#!/bin/bash
#today variable as YYYY-MM-DD
NOW=$(date +"%Y-%m-%d")
#Upload all files to our dated folder in the selected bucket
gsutil cp /home/backups/files/* gs://bucket-name/$NOW
#Delete all the files after uploading them
rm /home/backups/files/*
@dansku
dansku / submenu.php
Created April 1, 2015 04:46
add custom post type submenu to wordpress
add_action('admin_menu', 'email_api');
function email_api()
{
add_submenu_page( 'edit.php?post_type=email-campaign', 'Segment Creator', 'Segment Creator', 'manage_options', 'segment-creator', 'email_api_main');
}
function email_api_main()
{
echo '<h1>HERE WE ADD THE REST OF THE CODE...</h1>';
@dansku
dansku / button.html
Last active August 29, 2015 14:17
jQuery Custom slide Button
<div id="expand_button_container">
<div id="expand_button_slide" class="expand_button expand_button_slide">
EXPAND HERE <span class="button_close">╳</span>
</div>
<div id="slider_div" style="display:none; margin-top:20px;">
<b>Name Goes Here</b><br>
The dude!<br>
[email protected]<br>
<br>
@dansku
dansku / jquery-test
Created February 26, 2015 00:05
Check if jQuery is working
<script type="text/javascript">
$(document).ready(function(){
$("div").css("border", "3px solid red");
});
</script>
@dansku
dansku / data.php
Created November 23, 2014 04:10
JSON API DATA Acquisitions
<?php
//---[BITCOIN DATA]------------------
$bitcoinURL = "http://api.bitcoincharts.com/v1/weighted_prices.json";
$bitcoinDATA = json_decode(file_get_contents($bitcoinURL), true);
$bitcoinPRICE = $bitcoinDATA['USD']['24h'];
//---[USD Turismo]-------------------
$usdURL = "http://developers.agenciaideias.com.br/cotacoes/json";
$usdDATA = json_decode(file_get_contents($usdURL), true);
@dansku
dansku / all_db_backup.sh
Created September 24, 2014 13:15
Backup
#!/bin/bash
for database in $(mysql -e "show databases"|awk -F " " '{print $1}'); do
mysqldump $database | gzip -9 > $database.sql.gz
done
@dansku
dansku / arduino_ad5204.ino
Last active April 25, 2017 17:25
ad5204 example code
/*
AD5204 - Arduino Example
www.danielandrade.net - daniel spillere andrade
https://github.com/dansku/ad5204
June 2014
*/
#include "SPI.h" // SPI Library
const int CS = 10; // Chip Select For the AD5204
@dansku
dansku / resursizeUnrar.sh
Last active August 29, 2015 14:02
recursive unrar
find . -name '*.rar' -execdir unrar e '{}' + && find . -name '*.zip' -execdir unzip -tq '{}' +
find . -name '*.rar' -execdir unrar e -o- {} /unrar_to/dir/ \;
#Makefile
MAIN = blink.c
MCU = atmega32
F_CPU = 16000000
BAUD = 9600
PROGRAMMER_TYPE = usbtiny
## Defined programs / locations
CC = avr-gcc