Skip to content

Instantly share code, notes, and snippets.

@eliagbenu
eliagbenu / website-monitor-example.py
Created February 27, 2019 07:32 — forked from ogrigas/website-monitor-example.py
Example Python script that pings a website and sends email alert in case it's unreachable
from urllib2 import urlopen
def send_alert():
from smtplib import SMTP
from email.mime.text import MIMEText
msg = MIMEText('nuf said')
msg['Subject'] = 'inventi.lt is unreachable'
msg['From'] = 'osvaldas@inventi.lt'
@eliagbenu
eliagbenu / insert.php
Created January 26, 2019 22:14
Save a single record
<?php
$conn = mysqli_connect("localhost", "xxxx", "xxxx", "test");
Header("Content-Tye: application/json; charset=UTF-8");
if (mysqli_connect_errno()) {
echo json_encode(array("data"=>"Connection failed"));
exit();
}
@eliagbenu
eliagbenu / update.php
Created January 26, 2019 22:13
Update a single record
<?php
$conn = mysqli_connect("localhost", "xxxx", "xxxx", "test");
Header("Content-Tye: application/json; charset=UTF-8");
if (mysqli_connect_errno()) {
echo json_encode(array("data"=>"Connection failed"));
exit();
}
@eliagbenu
eliagbenu / single.php
Created January 26, 2019 22:12
Fetch a single resource
<?php
$conn = mysqli_connect("localhost", "xxxx", "xxxx", "test");
Header("Content-Tye: application/json; charset=UTF-8");
if (mysqli_connect_errno()) {
echo json_encode(array("data"=>"Connection failed"));
exit();
}
@eliagbenu
eliagbenu / index.php
Created January 26, 2019 22:10
Pull all records
<?php
$conn = mysqli_connect("localhost", "xxxx", "xxxx", "test");
Header("Content-Tye: application/json; charset=UTF-8");
if (mysqli_connect_errno()) {
echo json_encode(array("data"=>"Connection failed"));
exit();
}
@eliagbenu
eliagbenu / README-Template.md
Created December 13, 2018 10:34 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

####in your nginx.conf server block
server {
# the port your site will be served on
listen 7002;
server_name localhost;
charset utf-8;
# Finally, send all non-media requests to the Django server.
AndroidManifest.xml =>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.agbenu.splashscreenexample" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:fullBackupContent="true"
## in models.py
class CustomerUserManager(BaseUserManager):
def _create_user(self, national_id, password,
is_staff, is_superuser, **extra_fields):
now = timezone.now()
if not national_id:
@eliagbenu
eliagbenu / gist:749bc965b1f5500e2471
Created February 29, 2016 15:36
Sample configuration for Nginx with Django
#Sample nginx server block and uwsgi .ini configuration
#path to ini
/etc/uwsgi/apps-available/site.ini
#path to nginx server block
/etc/nginx/sites-available/site
#sample nginx config server blk