Skip to content

Instantly share code, notes, and snippets.

@haiderfaraz
haiderfaraz / moodle
Last active August 20, 2016 04:15
Bitnami Moodle init script
#!/bin/bash
# Moodle Startup Service script v1.0 by Faraz Haider 19 August 2016
# acts as startup service script for Learning Management System.
# USAGE: start|stop|status
#
case "$1" in
start)
echo "Starting Moodle."
su -c '/opt/moodle/ctlscript.sh start' user_name
;;
@haiderfaraz
haiderfaraz / default.conf
Last active August 15, 2016 11:30
Docker configuration files for Nginx + PHP-FPM7 set-up
server {
index index.php index.html;
server_name your_server_name;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /code;
location ~ \.php$ {
try_files $uri =404;
<?php
//Start of class
class xZip {
public function __construct() {}
public function __destruct() {}
public function zip($source = NULL, $destination = "./",$max_size_of_1_zip_archive) {
if (!$destination || trim($destination) == "") {
@plot([(x-1)^3],[x,-3,3])@
Differentiate \((x-1)^3\) with respect to \(x\).
[[input:ans1]]
[[validation:ans1]]
<link rel="stylesheet" type="text/css" href="http://localhost/moodle/custom/jsxgraph.css" media="screen" />
<script type="text/javascript" src="http://localhost/moodle/custom/jsxgraphcore.js"></script>
<script type="text/javascript" src="http://localhost/moodle/custom/GeonextReader.js"></script>
<script type="text/javascript" src="http://localhost/moodle/custom/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$$','$$'], ['@i','@i'], ["\\(","\\)"],["\\[","\\]"] ],
displayMath:[ ["\\(","\\)"], ['@d','@d'], ["\\[","\\]"] ],
processEscapes: true
}
//STEP 1. Import required packages
import java.sql.*;
public class JDBCTest {
// JDBC driver name and database URL
static final String JDBC_DRIVER = "com.octetstring.jdbcLdap.sql.JdbcLdapDriver";
static final String DB_URL = "jdbc:ldap://192.168.56.101:389/dc=dsu,dc=edu,dc=pk";
// Database credentials
static final String USER = "cn=Admin,ou=people,dc=dsu,dc=edu,dc=pk";
@haiderfaraz
haiderfaraz / spellCheck.rb
Created October 4, 2012 18:23
Ruby based Spell Check Bot
#!/usr/bin/env ruby
require 'rubygems'
require 'spider'
require 'raspell'
require 'hpricot'
#The URL below will be used by the crawler.
#The bot will take this URL and run a spell check on the page that it leads to.
#It will also perform the spell check on sub-pages emanating from the URL.
@haiderfaraz
haiderfaraz / apache_config_file_for_sympa
Created May 24, 2012 07:36
Integrating Sympa with Apache2
# Apache configuration file for Sympa
Alias /static-sympa /var/lib/sympa/static_content
#ScriptAlias /wws /usr/lib/cgi-bin/sympa/wwsympa.fcgi
#ScriptAlias /sympasoap /usr/lib/cgi-bin/sympa/sympa_soap_server.fcgi
ScriptAlias /wws /var/www/sympa/wwsympa.fcgi
ScriptAlias /sympasoap /var/www/sympa/sympa_soap_server.fcgi
<IfModule mod_fcgid.c>
IPCCommTimeout 120
MaxProcessCount 2
</IfModule>
@haiderfaraz
haiderfaraz / main.cf
Created May 24, 2012 07:25
Integrating Sympa with Postfix
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
@haiderfaraz
haiderfaraz / liferay
Created May 23, 2012 05:40
Service Script for LifeRay on Ubuntu 12.04
#!/bin/bash
# LifeRay Startup Service script v1.0 by Faraz Haider 6 May 2012
# acts as startup service script for LifeRay Portal.
# USAGE: start|stop|status|logs
#
case "$1" in
start)
echo "Starting LifeRay Web Portal."
export JAVA_HOME=/opt/j2sdk/jdk1.7.0_03
export JRE_HOME=/opt/j2sdk/jdk1.7.0_03/jre