Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# https://github.com/Nyr/openvpn-install
#
# Copyright (c) 2013 Nyr. Released under the MIT License.
if grep -qs "14.04" /etc/os-release; then
echo "Ubuntu 14.04 is too old and not supported"
exit
@scottydelta
scottydelta / mem_report.sh
Created August 17, 2017 05:15 — forked from epicserve/mem_report.sh
A quick script for printing out memory usage of various services
CELERY=`ps -A -o pid,rss,command | grep celeryd | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'`
GUNICORN=`ps -A -o pid,rss,command | grep gunicorn | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'`
REDIS=`ps -A -o pid,rss,command | grep redis | grep -v grep | awk '{total+=$2}END{printf("%d", total)}'`
NGINX=`ps -A -o pid,rss,command | grep nginx | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'`
OTHER=`ps -A -o pid,rss,command | grep -v nginx | grep -v celeryd | grep -v gunicorn | grep -v redis | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'`
websites=`ps -A -o user,pid,rss,command | grep gunicorn | egrep -o "[a-z_]+\.py$" | sort | uniq | perl -wpe 's|\.py$||;' | xargs`
printf "%-10s %3s MB\n" "Celery:" $CELERY
printf "%-10s %3s MB\n" "Gunicorn:" $GUNICORN
printf "%-10s %3s MB\n" "Nginx:" $NGINX
printf "%-10s %3s KB\n" "Redis:" $REDIS
import requests
from BeautifulSoup import BeautifulSoup as bs
import re
import ho.pisa as pisa
import os
import sys
import cgi
import cStringIO
import logging
payload = {'username' : '106111062' , 'password': '5' ,'login': 'Log In'}
@scottydelta
scottydelta / AdFly autoredirect TamperMoneky Script
Created October 11, 2014 17:41
TamperMoneky Script to autoredirect AdFly after timer expires.
// ==UserScript==
// @name Adfly
// @namespace http://pastemehere.com
// @version 0.1
// @require http://code.jquery.com/jquery-latest.js
// @description TamperMonkey script to automate Adfly wait
// @author https://github.com/scottydelta
// @match http://adf.ly/*
// @grant none
// ==/UserScript==
@scottydelta
scottydelta / xorg_touchpad.py
Created January 6, 2014 14:44
Python script to disable and re-enable touch-pad in Xorg to fix touchpad freeze problem in Luna Elementary. Requires "sh" python module which can be installed using pip.
#!/usr/bin/env python
import sh,json
for line in sh.xinput("list"):
if "TouchPad" in line:
b = line.split()
idno = b[5]
idno = idno[3:]
for line in sh.xinput("list-props", int(idno)):
if "Enabled" in line:
@scottydelta
scottydelta / imgur.php
Created December 15, 2013 11:37
A php script to upload images to Imgur anonymously using Imguy API V3. The input is an image and Output is a direct ink.
<?php
$client_id = 'xxxxxxxx';
$file = file_get_contents("test-image.png");
$url = 'https://api.imgur.com/3/image.json';
$headers = array("Authorization: Client-ID $client_id");
$pvars = array('image' => base64_encode($file));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL=> $url,