This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > adb-screenshot-$(date +%Y%m%d-%H%M%S).png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The MIT License (MIT) | |
Copyright (c) 2014, Marty Glaubitz | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int pirLedPin = 31; | |
const int distanceLedPin = 32; | |
const int pirPin = 33; | |
const int echoPin = 22; | |
const int trigPin = 24; | |
const int distanceMeasureTimeout = 1000; | |
long lastDistanceMeasureTimestamp = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example of BH1750 library usage. | |
This example initalises the BH1750 object using the default | |
high resolution mode and then makes a light level reading every second. | |
Connection: | |
VCC-5v | |
GND-GND | |
SCL-SCL(analog pin 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int ledPin = 31; // define ledPin Interface | |
const int shockPin = 30; // define the percussion Sensor Interface | |
int val; // define numeric variables val | |
long lastKnockTimestamp = 0; | |
int knockTimeout = 2000; | |
void setup () { | |
Serial.begin(9600); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public int solution(int[] A) { | |
long left = 0; | |
long right = 0; | |
long sum = sum(A); | |
for (int i = 0; i < A.length; i++) { | |
right = sum - left - A[i]; | |
if (left == right) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int relayPin = 3; | |
int pirPin = 2; | |
int ledPin = 13; // just a LED on Arduino board. Not that huge ~18W LED lamp. | |
long lastDetection = 0; // millis | |
long DELAY = 3 * 1000; // N seconds (also adjustable at PIR sensor too) | |
void setup() { | |
pinMode(relayPin, OUTPUT); | |
pinMode(pirPin, INPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
float TIMELAPSE_SPEED = 5; // N:1 | |
long COOLDOWN = 2000 * TIMELAPSE_SPEED; | |
long CYCLE = 20000 * TIMELAPSE_SPEED; | |
long ANGLE_MIN = 45; | |
long ANGLE_MAX = 135; | |
long angleRange = ANGLE_MAX - ANGLE_MIN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
Gson gson = new GsonBuilder() | |
.registerTypeAdapter(NumberOfPeople.class, NumberOfPeople.getDeserializer()) | |
.create(); | |
return new Retrofit.Builder() | |
... | |
.addConverterFactory(GsonConverterFactory.create(gson)) | |
.client(client) | |
.build(); |
OlderNewer