Skip to content

Instantly share code, notes, and snippets.

@AdySan
AdySan / ESP_Plasma.ino
Last active July 19, 2018 23:54
ESP8266/Arduino Plasma effect demo using esp8266-oled-ssd1306 library.
#include <Wire.h>
#include "SSD1306.h"
#define SET_BIT_HIGH(__mem, __x, __y) \
__mem[x + (y >> 3)*128] |= _BV( y - ((y >> 3) << 3) )
static const uint8_t sinustable[ 0x100 ] = {
0x80, 0x7d, 0x7a, 0x77, 0x74, 0x70, 0x6d, 0x6a,
0x67, 0x64, 0x61, 0x5e, 0x5b, 0x58, 0x55, 0x52,
0x4f, 0x4d, 0x4a, 0x47, 0x44, 0x41, 0x3f, 0x3c,
@AdySan
AdySan / download-tadpoles-media.js
Created August 23, 2018 15:30 — forked from yongheng/download-tadpoles-media.js
Download Tadpoles Media
// Step 1: Open https://www.tadpoles.com/parents and log in;
// Step 2: Select the 'all' tab (IMPORTANT STEP);
// Step 3: Select a month;
// Step 4: Open the JavaScript console in your browser (e.g., press
// Command + Alt + i in Google Chrome on a Mac, or press
// Ctrl + Shift + i in Google Chrome in Windows);
// Step 5: Copy this entire code snippet, paste it to the JavaScript console,
// and press Enter to run; all photos and videos will be downloaded
// to your default Downloads folder and they should have proper
// file names.
@AdySan
AdySan / Raspbian Stretch Headless Setup Procedure.md
Created September 26, 2018 04:07
Raspbian Stretch Headless Setup Procedure

To set any Raspberry Pi in headless mode, you'll only need your Pi with pre-loaded Raspbian OS (latest is Stretch) and your Wi-Fi network. Make sure you know your Wi-Fi SSID and Password in order to perform headless setup.

Once you've burned/etched the Raspbian image onto the microSD card, connect the card to your working PC and you'll see the card being mounted as "boot". Inside this "boot" directory, you need to make 2 new files. You can create the files using Atom code editor.

Step 1: Create an empty file. You can use Notepad on Windows or TextEdit to do so by creating a new file. Just name the file ssh. Save that empty file and dump it into boot partition (microSD).

Step 2: Create another file name wpa_supplicant.conf . This time you need to write a few lines of text for this file. For this file, you need to use the FULL VERSION of wpa_supplicant.conf. Meaning you must have the 3 lines of data namely country, ctrl_interface and update_config

@AdySan
AdySan / HueLight.ino
Created December 22, 2015 03:57
Philips Hue clone using ESP8266 and NeoPixels along with HAP-NodeJS
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <PubSubClient.h>
#include <Adafruit_NeoPixel.h>
#define PIN D4
Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, PIN, NEO_GRB + NEO_KHZ800);
@AdySan
AdySan / TrimLast18s
Created December 27, 2016 22:58
Bash script to trim last few seconds of video files (.mp4) downloaded with you-get using ffmpeg
#!/bin/bash
for f in *.mp4; do
duration=$(ffmpeg -i "$f" 2>&1 | grep "Duration"| cut -d ' ' -f 4 | sed s/,//)
length=$(echo "$duration" | awk '{ split($1, A, ":"); print 3600*A[1] + 60*A[2] + A[3] }' )
trim_start=0
trim_end=$(echo "$length" - 18 - "$trim_start" | bc)
ffmpeg -ss "$trim_start" -i "$f" -c copy -map 0 -t "$trim_end" "${f%.mp4}-trimmed.mp4"
done
@AdySan
AdySan / FiberOpticLamp.ino
Created January 14, 2016 04:40
Philips Hue Clone using ESP8266
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <PubSubClient.h>
#include <Adafruit_NeoPixel.h>
#define PIN D8
Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, PIN, NEO_GRB + NEO_KHZ800);
// Step 1: Open https://www.tadpoles.com/parents and log in;
// Step 2: Select the 'all' tab (IMPORTANT STEP);
// Step 3: Select a month;
// Step 4: Open the JavaScript console in your browser (e.g., press
// Command + Alt + i in Google Chrome on a Mac, or press
// Ctrl + Shift + i in Google Chrome in Windows);
// Step 5: Copy this entire code snippet, paste it to the JavaScript console,
// and press Enter to run; all photos and videos will be downloaded
// to your default Downloads folder and they should have proper
// file names.
@AdySan
AdySan / Digispark_Neopixel.ino
Last active November 20, 2023 20:54
Drive an WS2812b (NeoPixel) LED strip with a Digispark (ATTiny85)
#include <Adafruit_NeoPixel.h>
#define PIN 1
#define STRIPSIZE 80 // Limited by max 256 bytes ram. At 3 bytes/LED you get max ~85 pixels
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)