Skip to content

Instantly share code, notes, and snippets.

@jtpaasch
jtpaasch / install_newrelic_plugins
Last active March 24, 2019 10:14
Installs the nginx and logwatcher plugins for newrelic on a CentOS system.
#!/bin/bash
# ----------------------------------------------------------------------
# Prelimenary checks
# ----------------------------------------------------------------------
# Make sure there's a license key file.
KEYFILE="LICENSEKEY"
if [ ! -e $KEYFILE ]; then
echo "No LICENSEKEY found."
@cbednarski
cbednarski / camera.py
Last active February 17, 2024 05:54
Webcam capture for python - Pops up a preview from your webcam and snaps a picture when you press 'q'
import cv2
# Windows dependencies
# - Python 2.7.6: http://www.python.org/download/
# - OpenCV: http://opencv.org/
# - Numpy -- get numpy from here because the official builds don't support x64:
# http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
# Mac Dependencies
# - brew install python
@rahul286
rahul286 / full-install.sh
Last active April 12, 2018 03:19
newrelic setup
# get NEWRELIC_LICENSE_KEY from https://rpm.newrelic.com/accounts/
# export NEWRELIC_LICENSE_KEY=___CHANGE___THIS___TO___NEWRELIC_LICENSE_KEY____
[ -z "$NEWRELIC_LICENSE_KEY" ] && { echo "Please export NEWRELIC_LICENSE_KEY"; exit 1; }
#debian repo
echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list
wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install newrelic-php5 newrelic-sysmond
#!/bin/bash
# Run this script just before you put the laptop in the bin for security scanning.
# You can add the seconds the laptop will be waiting before speaking. The default
# is waiting for 180 seconds (3 minutes).
# Switch to the login screen, effectively locking the screen.
function lockscreen() {
/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend
}
@jasperf
jasperf / wget
Created June 29, 2016 01:55 — forked from bueckl/wget
Wget examples
#Spider Websites with Wget – 20 Practical Examples
Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute.
1. Download a single file from the Internet
wget http://example.com/file.iso
2. Download a file but save it locally under a different name
wget ‐‐output-document=filename.html example.com
@Sisyphus67
Sisyphus67 / study_template.py
Last active January 19, 2021 12:15
This program outputs a csv file that can be used as a ToDoist template. The template is to create a study plan for a text book.
#!/usr/bin/python
"""
Copyright (C) 2016 Jeffrey S. McAnarney
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
@RupGautam
RupGautam / download.js
Created November 14, 2017 19:20
Get all the hrefs from webpage
var links = document.querySelectorAll('#content a');
for(var i = 0; i < links.length; i++){
console.table(links[i].href);
};