Skip to content

Instantly share code, notes, and snippets.

View kasparsd's full-sized avatar

Kaspars Dambis kasparsd

View GitHub Profile
@kasparsd
kasparsd / mail-attachments-fix.md
Created November 15, 2018 12:11
Storage for Contact Form 7: Link to attachment URLs even when not sending the attachment

Replace the wpcf7_mail_components() method in src/class-cf7-storage.php with the following:

function wpcf7_mail_components( $components, $form ) {
    $submission = WPCF7_Submission::get_instance();

    if ( ! empty( $components['body'] ) && $submission ) {
        $components['body'] = $this->mail_replace_file_urls( $components['body'], $submission->uploaded_files() );
    }
@kasparsd
kasparsd / boot.py
Last active November 10, 2018 18:59
Wemos ESP8266 Home Assistant Binary Sensor Example
import network
SSID = ''
PASSWORD = ''
def do_connect():
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to network...')

WS-Federācijas protokola specifikāciju vai Shibbolech WebSSO profilu.

$ sudo cat /sys/kernel/debug/usb/devices

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  5 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bbb ProdID=0195 Rev= 2.42
S:  Manufacturer=Alcatel
S:  Product=Mobilebroadband
S:  SerialNumber=1234567890ABCDE
C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=500mA
@kasparsd
kasparsd / vip-deploy.sh
Last active August 9, 2018 20:14
Deploy script for WordPress VIP
#!/usr/bin/env bash
# Set this to -ex for verbose output.
set -e
# Set the working directory to the repository root.
cd "$(dirname "$0")/.."
DEPLOY_BRANCH="$2"
SVN_REPO="$1"
@kasparsd
kasparsd / readme.md
Last active July 30, 2018 15:31
Power on the SIM800 radio via pin 11 or GPIO17

Modem config /etc/network/interfaces.d/fona:

auto fona
iface fona inet ppp
        provider fona
        pre-up /home/pi/radio
        post-up /home/pi/tunnel

Running WordPress Unit Tests Inside Docker Inside Vagrant

We start in the theme folder.

  1. Capture the current composer command and store it as $CMD.

  2. Find the relative path to our current working directory from the root of the project directory. Find the path to the Vagrantfile levels down from the current directory. There must be one because our theme is in a subdirectory of the site repository.

  3. Store the relative path to our theme folder as $RELATIVE_CWD. Use pwd -P to get the realpath to the current directory. Substract the absolute path to the Vagrantfile from the theme directory to get the relative theme directory.

RFM69_initialise

  • Set MY_RFM69_POWER_PIN mode to OUTPUT, if defined.

  • Power up the radio RFM69_powerUp().

  • Reset radio module, if MY_RFM69_RST_PIN is defined.

  • Configure radio:

  • 37 million accounts
  • 1 million transactions per day?
@kasparsd
kasparsd / rf-wishlist.md
Last active April 29, 2018 19:11
RF Button Wishlist

Must have:

  • ATMega chip
  • USBasp header for programming on the side
  • Integrated RFM69CW
  • Pins for a button
  • Battery voltage measured to ATMega analog pin via voltage divider.
  • Three status LEDs.