Skip to content

Instantly share code, notes, and snippets.

View fourlastor's full-sized avatar

Daniele Conti fourlastor

  • World
View GitHub Profile
@fourlastor
fourlastor / app.js
Created December 18, 2021 16:24
Automatically trigger other Eufy stations alarms
const WebSocket = require('ws');
const base64 = require('base-64');
// SETTINGS
const HOST = "127.0.0.1";
const PORT = 3000;
const INTERVAL_IN_SECONDS = 10;
const TRIGGER_ALARM_IN_SECONDS = 10;
// DO NOT TOUCH AFTER THIS LINE
@fourlastor
fourlastor / viewer.html
Created February 17, 2020 13:26
Espresso hierarchy dump analyzer
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
<textarea id="hierarchy-text" cols="30" rows="10">
+>DecorView{id=-1, visibility=VISIBLE, width=320, height=470, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=WM.LayoutParams{(0,0)(fillxfill) sim=#3 ty=1 fl=#81810100 pfl=0x20000 wanim=0x10302f6 needsMenuKey=2 colorMode=0}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
#!/bin/bash
# usage: nordvpn [server=nl21] [protocol=udp|tcp]
nordvpn() {
default_server="nl21"
default_protocol="udp"
# folder where you extracted the openvpn config files from https://nordvpn.com/api/files/zip
config_location="{$HOME}/path/to/your/config/folder"
server=${1:-$default_server}
protocol=${2:-$default_protocol}
@fourlastor
fourlastor / Curry.kt
Created October 27, 2016 08:00
curry+partial
operator fun <P1, P2, R> ((P1, P2) -> R).invoke(): (P1) -> (P2) -> R {
return {p1: P1 -> { p2: P2 -> this(p1, p2) } }
}
operator fun <P1, P2, P3, R> ((P1, P2, P3) -> R).invoke(): (P1) -> (P2) -> (P3) -> R {
return {p1: P1 -> { p2: P2 -> { p3: P3 -> this(p1, p2, p3) }}}
}
fun add(p1: Int, p2: Int): Int = p1 + p2
@fourlastor
fourlastor / grabdng.py
Last active March 20, 2016 13:39 — forked from rock3r/grabdng.py
Grabs all DNG files from the connected Android device's camera roll
#!/usr/bin/python
import argparse, os, subprocess
# Grab the script directory to use as default
current_directory = os.path.dirname(os.path.abspath(__file__))
def parse_cli_arguments():
parser = argparse.ArgumentParser(description = 'Grabs all DNG files from the connected Android device\'s camera roll.')
parser.add_argument('--output-path', type = str, help = 'The path to download the DNGs to. Default: {script_path}/raw',
/*
* Original requirement:
* if a > b, return 1, if a == b return 0, if a < b return -1
*/
/*
* Day 1
* Paul comes in and does untested code which has a bug
*/