Skip to content

Instantly share code, notes, and snippets.

@agibsonsw
agibsonsw / hide_element
Created February 5, 2012 16:35
JS Bookmarklet to hide an element on click
javascript:(function(){var%20d=document,useMine=true,prevEl;function%20AddHandler(orig,mine)
{return%20function(e){if(useMine)mine(e);else%20if(orig)orig(e);};}function%20Myonmouseover(e)
{var%20evt=e||window.event;var%20elem=evt.target||evt.srcElement;elem.style.outline='2px%20solid%20gray';
prevEl=elem;}function%20Myonmouseout(e){var%20evt=e||window.event;var%20elem=evt.target||evt.srcElement;elem.style.outline='';}
function%20Myonclick(e){var%20evt=e||window.event;var%20elem=evt.target||evt.srcElement;elem.style.display='none';}
function%20Myonkeydown(e){var%20evt=e||window.event;if(evt.keyCode==27){prevEl.style.outline='';useMine=false;}}
d.onmouseover=AddHandler(d.onmouseover,Myonmouseover);d.onmouseout=AddHandler(d.onmouseout,Myonmouseout);
d.onclick=AddHandler(d.onclick,Myonclick);d.onkeydown=AddHandler(d.onkeydown,Myonkeydown);})()
@sandeepmistry
sandeepmistry / BLEPeripheral_NeoPixel.ino
Created March 25, 2015 23:14
BLEPeripheral + NeoPixel
// Import libraries (BLEPeripheral depends on SPI)
#include <SPI.h>
#include <BLEPeripheral.h>
#include <Adafruit_NeoPixel.h>
// define pins (varies per shield/board)
#define BLE_REQ 10
#define BLE_RDY 2
#define BLE_RST 9
@tzapu
tzapu / docker-compose.yml
Last active September 26, 2022 05:13
docker compose file for local server, plex, transmission, sonarr, radarr, ombi, netdata, nextcloud
version: '2.1'
services:
transmission:
container_name: transmission
image: dperson/transmission
restart: unless-stopped
depends_on:
- plex
network_mode: host
environment:
@dfontana
dfontana / CmderZSH.md
Last active March 12, 2023 21:45
My setup guide for installing Cgywin, Mintty, Cmder, and ZSH.

What's this?

Instructions to obtain ZSH on a windows environment, without the input funny business presented by some other attempted solutions.

The final result is ZSH running on a mintty terminal, emulated by cygwin, and being handled by the popular cmder.

Why is this here?

For the benefit of myself and others. I've already followed these instructions twice. It took me hours to figure all this out, maybe someone else can save a few.

What exactly is covered?

  • Installing and setting up cmder
@chubin
chubin / Enable-wttr.in-for-PowerShell
Created February 22, 2016 22:19
How to enable wttr.in in a PowerShell console
# To enable ANSI sequences in a PowerShell console run the following commands.
# After that you can use wttr.in in you PowerShell just lake that:
# (curl http://wttr.in/ -UserAgent "curl" ).Content
#
# More on it:
# http://stknohg.hatenablog.jp/entry/2016/02/22/195644 (jp)
#
Add-Type -MemberDefinition @"
[DllImport("kernel32.dll", SetLastError=true)]
@rtfpessoa
rtfpessoa / handle-ctrl-c.py
Created March 19, 2016 11:28
Handle CTRL+C in Python
#!/usr/bin/env python
import signal
import sys
def signal_handler(signal, frame):
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)

BLE Nano and the nRF51822 SDK

If you've tried using the nRF51822 SDK with the BLE Nano (after following the RedBearLab guide) you may have come to a dead end.

Even the simplest examples didn't work for me. I assumed I had a dead Nano (despite the upload process seeming to work fine).

The reason turned out to be that the latest SDK versions assume you have a nRF51822 chip with 32KB of RAM rather than the 16KB that the nRF51822 on the Nano has.

James Willcox explains this in a post to the RedBearLab BLE Nano support forum.

/*
ffmpeg -i "$file" -f s32be -acodec pcm_s32be -ar 44100 -af "volume=0.5" tcp://espip:5522
*/
#include "i2s.h"
#include <ESP8266WiFi.h>
const char* ssid = "***********";
const char* password = "**********";
WiFiServer pcmServer(5522);
static WiFiClient pcmClient;
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active March 12, 2024 22:46
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@natelandau
natelandau / .bash_profile
Last active April 30, 2024 18:07
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management