View DOM Template
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
<?php | |
$page_max = 123; | |
$leadurl = ''; | |
$results = array(); | |
for ($page=1; $page<$page_max; $page++) { | |
$doc = new DOMDocument(); | |
$doc->loadHTML(file_get_contents($leadurl.$page)); | |
$elems = $doc->getElementsByTagName('div'); |
View DateTime String
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
function convert_datetime($datetime, $dateonly = false) { | |
$values = explode(" ", $datetime); | |
$dates = explode("-", $values[0]); | |
$times = explode(":", $values[1]); | |
$newdate = mktime($times[0], $times[1], $times[2], $dates[1], $dates[2], $dates[0]); | |
$newdate2 = $_SERVER['REQUEST_TIME']-$newdate; | |
$newdate2+=DB_TIME_OFFSET; | |
if ($newdate2>172799 || $dateonly) | |
return date("F j, Y",$newdate); | |
else if ($newdate2>86399) |
View vshieldExport
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
import java.io.*; | |
import java.net.*; | |
import javax.net.ssl.*; | |
import java.security.cert.*; | |
class vshieldExportImport { | |
public static void main(String[] args) { | |
try { | |
String output = httpGet("https://10.x.x.x/api/2.0/app/firewall/datacenter-2/config?list=config"); | |
System.out.println(output); |
View MY_Cart.php
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 MY_Cart extends CI_Cart { | |
private function _is_identical($a, $b) { | |
sort($a); | |
sort($b); | |
return $a == $b; | |
} | |
public function insert($data) { | |
foreach ($this->contents() as $item) { |
View migration.sh
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/bash | |
echo -n "Enter your MySQL root password, followed by [ENTER]: " | |
read mysqlrootpwd | |
echo -n "Enter your remote hosts root password, followed by [ENTER]: " | |
read remoterootpwd | |
apt-get -y update; | |
apt-get -y upgrade; | |
apt-get -y install sshpass; |
View Python Alarms
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
import smtplib | |
import os | |
import syslog | |
import requests | |
import subprocess | |
from email.mime.text import MIMEText | |
def alarmLocalHTTPPing(): | |
millis = requests.get("http://127.0.0.1").elapsed.microseconds # /1000 ? | |
if millis > 100: |
View download_cloudfronted_bucket.py
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
import requests | |
import xml.etree.ElementTree | |
import pprint | |
import re | |
import os | |
import threading | |
base_address = "https://xxxxxxxxxxxxxxxx.cloudfront.net/" | |
def createAndOpen(filename): |
View deeplens_leds.py
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
import os | |
from time import sleep | |
gpio_path = "/sys/class/gpio/" | |
with open(gpio_path + "gpio437/direction", 'w') as direction: | |
direction.write('out') | |
with open(gpio_path + "gpio443/direction", 'w') as direction: | |
direction.write('out') |
View darkenScreenAroundArea.py
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
import wx | |
import time | |
from multiprocessing import Process, Lock | |
def darkenScreenAroundArea(lock, x, y, width, height): | |
app = wx.App(False) | |
screensize = wx.GetDisplaySize() | |
frm = DarkFrame(lock, 0, 0, screensize[0], y) # top | |
frm = DarkFrame(lock, 0, y, x, height) # left | |
frm = DarkFrame(lock, (x + width), y, (screensize[0] - x + width), height) # right |
View logpush.py
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
from __future__ import print_function | |
import json | |
import base64 | |
import zlib | |
from elasticsearch import Elasticsearch | |
from elasticsearch.connection import create_ssl_context | |
from datetime import datetime | |
def handler(event, context): |
OlderNewer