Skip to content

Instantly share code, notes, and snippets.

View ainsofs's full-sized avatar

Ainsof So'o ainsofs

View GitHub Profile
@ainsofs
ainsofs / mount.sh
Last active February 10, 2021 22:23
mount / unmount volumes in linux
# list volumes
sudo fdisk -l
# create a mount location
mkdir -p /mnt/some-vol
# mount
mount /dev/xvdf /mnt/some-vol
# unmount
@ainsofs
ainsofs / add_https.bat
Last active November 24, 2020 21:51
Use this snippet to add https to an IIS7 site
appcmd set site /site.name:"<IISSiteName>" /+bindings.[protocol='https',bindingInformation='*:443:<hostHeaderValue>']
# https://www.sslshopper.com/article-ssl-host-headers-in-iis-7.html
@ainsofs
ainsofs / template.yml
Created September 16, 2020 04:07
custom wodby stack - IPT
metadata:
type: drupal8
infrastructure: ^5.1
services:
ipt:
enabled: true
required: true
image: 'gbif/ipt:2.4.2'
ports:
- 'edge::80:8080/tcp'
@ainsofs
ainsofs / drupal console commands.txt
Created August 24, 2020 23:42
export content type using drupal console
# export content type using drupal console
drupal config:export:content:type page \
--module="demo" \
--optional-config \
--remove-uuid \
--remove-config-hash
more: https://drupalconsole.com/docs/en/commands/config-export-content-type
@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
@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" />
-- 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 / 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/*
## 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 / PagedResult<T>
Last active March 15, 2019 03:37
Web Api Config - Can be used for DnnApiController
// For returning objects
public class PagedResult<T> {
public List<T> Items { get; set; }
public long CurrentPage { get; set; }
public long ItemsPerPage { get; set; }
public long TotalItems { get; set; }
public long TotalPages { get; set; }
public string Text { get; set; }
public int ItemsDisplayed { get; set; }