Skip to content

Instantly share code, notes, and snippets.

View AlmightyOatmeal's full-sized avatar

Jamie Ivanov AlmightyOatmeal

View GitHub Profile
@dannguyen
dannguyen / selenium-screenshotting.md
Last active February 15, 2023 15:59
Using Selenium and Python to screenshot a javascript-heavy page

Using Selenium and Python to screenshot a javascript-heavy page

As websites become more JavaScript heavy, it's harder to automate things like screenshotting for archival purposes. I've seen examples and suggestions to use PhantomJS for visual testing/archiving of websites, but have run into issues such as the non-rendering of webfonts. I've never tried out Selenium until today...and while I'm not thinking about performance implications yet, Selenium seems far more accurate than PhantomJS...which makes sense since it actually opens a real browser. And it's not too hard to script to do complex interactions: here's an [example of how to log in to Twitter, write a tweet, upload an image, and send a tweet via Selenium and DOM element selection](https://gist.github.com/dannguyen/8a6fa49253c1d6a0eb92

@ozen
ozen / Selenium PhantomJS Python Header.py
Last active September 6, 2021 05:12
How to set request headers when using Selenium Python with PhantomJS driver
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
desired_capabilities = DesiredCapabilities.PHANTOMJS.copy()
desired_capabilities['phantomjs.page.customHeaders.User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) ' \
'AppleWebKit/537.36 (KHTML, like Gecko) ' \
'Chrome/39.0.2171.95 Safari/537.36'
driver = webdriver.PhantomJS(desired_capabilities=desired_capabilities)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Martin Raspaud
# Author(s):
# Martin Raspaud <martin.raspaud@smhi.se>
# This program is free software: you can redistribute it and/or modify
@DrPaulBrewer
DrPaulBrewer / HamGridSquare.js
Last active December 12, 2020 17:18
find Maidenhead grid square from latitude and longitude
// HamGridSquare.js
// Copyright 2014 Paul Brewer KI6CQ
// License: MIT License http://opensource.org/licenses/MIT
//
// Javascript routines to convert from lat-lon to Maidenhead Grid Squares
// typically used in Ham Radio Satellite operations and VHF Contests
//
// Inspired in part by K6WRU Walter Underwood's python answer
// http://ham.stackexchange.com/a/244
// to this stack overflow question:
@steve-jansen
steve-jansen / README.md
Last active June 30, 2024 17:19
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@tbicr
tbicr / Pyparsion.ipynb
Created June 27, 2014 11:51
pyparsing example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dschuetz
dschuetz / gtb
Last active August 2, 2022 10:32
Hackish script to compute Google Authenticator tokencodes and launch a Tunnelblick VPN with the appropriate computed password+tokencode
#!/usr/bin/python
import hmac, struct, time, base64, hashlib # for totp generation
import re, sys, subprocess # for general stuff
from getopt import getopt, GetoptError # pretending to be easy-to-use
#
# gtb - Google(auth) + Tunnelblick
#
@fdelbos
fdelbos / FreeBSD_node_monit.md
Last active February 17, 2020 13:38
FreeBSD 10 Nodejs setup with nginx, mongo and monit

FreeBSD 10 Nodejs setup with nginx, mongodb, redis and monit

This my receipe for installing a complete nodejs server on FreeBSD 10. The parameters used in this configuration are for a very small private server that I use for demo purpose only, so for a production server, you should somehow set the limits in pair with your ressources.

I use monit so I don't have to write rc scripts for node and it should take care of process lifecycle management for me. Alternatives exists such as supervisord or circus.

Installing mongodb

@jsok
jsok / phantom.py
Created March 12, 2014 06:42
Use PhantomJS and Python Selenium bindings to take screenshots of websites.
import StringIO
from selenium import webdriver
from PIL import Image
# Install instructions
#
# npm install phantomjs
# sudo apt-get install libjpeg-dev
# pip install selenium pillow
@stormpython
stormpython / README.md
Last active March 21, 2022 13:45
Data Visualization with Elasticsearch Aggregations and D3 (Tutorial)

Data Visualization with Elasticsearch Aggregations and D3

Link to the Elasticsearch Blog.