Skip to content

Instantly share code, notes, and snippets.

View ainsofs's full-sized avatar

Ainsof So'o ainsofs

View GitHub Profile
-- create drupal databases
mysql -u root -p
CREATE DATABASE drupal;
CREATE USER drupaluser@localhost IDENTIFIED BY 'password';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER,CREATE TEMPORARY TABLES,LOCK TABLES ON drupal.* TO drupaluser@localhost;
FLUSH PRIVILEGES;
@ainsofs
ainsofs / gist:1cd158f02886cc51bf44
Created June 20, 2015 01:51
drush common modules
drush dl ckeditor
drush en -y ckeditor
drush ckeditor-download
drush make-generate [fileName].make
@ainsofs
ainsofs / gist:d45f7f8944309d61a721
Last active August 29, 2015 14:23
Setup Site Alias on Apache Ubuntu 12
#ubuntu 12
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/example.com
#ubuntu 14
sudo cp /etc/apache2/sites-available/000-default.config /etc/apache2/sites-available/example.com.config
sudo nano /etc/apache2/sites-available/example.com
ServerName example.com
@ainsofs
ainsofs / DnnLogger.cs
Created February 23, 2016 21:59
Utility class for using Dnn Event Logger
public class DnnLogger {
private EventLogController Controller;
public DnnLogger() {
Controller = new EventLogController();
}
public void AddLog(string message)
{
var log = CreateLogDefaults();
@ainsofs
ainsofs / IWebApiResponse.cs
Created April 26, 2016 00:32
Utility Classes for Creating Web Api Endpoints
interface IWebApiResponse {
bool ApiSuccess { get; set; }
string ApiError { get; set; }
string ApiStackTrace { get; set; }
}
@ainsofs
ainsofs / update_drupal_commands
Last active May 4, 2020 23:15
Command lines to update Drupal
# ensure you have backed up the database and files before running these commands
# mysql/mariadb
drush sql-dump --gipz --result-file
#postgres
pg_dump -U postgres -h localhost "[YOUR_DATABASE]" | gzip > [dbname]-[date]00.sql.gz
# remove old files
rm -rf images/ includes/ misc/ modules/ profiles/ scripts/ themes/
rm -f .* *.php *.txt *.config
## login to a database
psql -U [username] [database_name]
## check database size
SELECT pg_size_pretty( pg_database_size('dbname') );
## check table sizes (top 5)
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
@ainsofs
ainsofs / reindex_alfresco_solr
Created October 17, 2019 19:12
reindex alfresco solr
For Alfresco 4.x and Solr 1.4:
#! /bin/bash
export ALF_HOME=/opt/alfresco4
export SOLR_HOME=/opt/alfresco4/alf_data/solr
$ALF_HOME/alfresco.sh stop
sleep 10
rm -rf $SOLR_HOME/workspace/SpacesStore/*
-- kill all connections For MS SQL Server 2000, 2005, 2008
USE master;
DECLARE @kill varchar(8000); SET @kill = '';
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), spid) + ';'
FROM master..sysprocesses
WHERE dbid = db_id('MyDB')
EXEC(@kill);
@ainsofs
ainsofs / web.config
Last active March 18, 2020 19:12
web.config redirect http to https
<!-- requires url rewrite module --->
<!-- https://docs.microsoft.com/en-us/archive/blogs/dawiese/redirect-from-http-to-https-using-the-iis-url-rewrite-module -->
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect http to https" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTPS}" pattern="off" />