Skip to content

Instantly share code, notes, and snippets.

View sprklinginfo's full-sized avatar

Lingling Jiang sprklinginfo

  • Sheridan College Library
  • Mississauga, ON, Canada
View GitHub Profile
@sprklinginfo
sprklinginfo / readme.md
Last active March 28, 2024 01:16
Online PDF Viewer for BookStack App

Setup

Download PDFJS prebuilt version from https://mozilla.github.io/pdf.js/getting_started/#download

Unzip the file to 'pdfjs' folder and move it to the BookStack app 'public' folder. Ensure both 'build' and 'web' folders and its files are there.
pdfjs-folder

Copy and paste the following code to Custom HTML Head Content field on Settings page:

@sprklinginfo
sprklinginfo / deployment_guide.md
Created June 5, 2020 20:20 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
@sprklinginfo
sprklinginfo / hook_update_N.php
Created January 30, 2020 19:31 — forked from sumanthkumarc/hook_update_N.php
Drupal 8: Create a new table in database using hook_update_N()
<?php
/**
*The numbers are normally composed of three parts:
* - 1 or 2 digits for Drupal core compatibility (Drupal 8, 9, 10, etc.). This
* convention must be followed.
* - 1 digit for your module's major release version; for example, for 8.x-1.*
* use 1, for 8.x-2.* use 2, for Core 8.0.x use 0, and for Core 8.1.x use 1.
* This convention is optional but suggested for clarity.
@sprklinginfo
sprklinginfo / nodemaker_term_create.php
Created September 19, 2019 20:27 — forked from himerus/nodemaker_term_create.php
Create a taxonomy term programmatically in Drupal 8.
<?php
/**
* @file
* Contains various helper functions.
*/
use Drupal\taxonomy\Entity\Term;
/**
@sprklinginfo
sprklinginfo / ExampleCreateTermProgrammatically.php
Created September 19, 2019 20:27 — forked from dreambubbler/ExampleCreateTermProgrammatically.php
Drupal 8 Create Taxonomy Term programmatically
$new_term = \Drupal\taxonomy\Entity\Term::create([
'vid' => 'example_vocabulary_machine_name',
'name' => 'Example term name',
]);
$new_term->enforceIsNew();
$new_term->save();
@sprklinginfo
sprklinginfo / mysql-docker.sh
Created August 8, 2019 03:00 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@sprklinginfo
sprklinginfo / docker-help.md
Created May 7, 2019 16:34 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@sprklinginfo
sprklinginfo / db_backup.sh
Created May 29, 2018 19:47 — forked from NARKOZ/db_backup.sh
MySQL backup shell script
#!/bin/bash
# Shell script to backup MySQL database
# Set these variables
MyUSER="" # DB_USERNAME
MyPASS="" # DB_PASSWORD
MyHOST="" # DB_HOSTNAME
# Backup Dest directory
DEST="" # /home/username/backups/DB
@sprklinginfo
sprklinginfo / oaipmh-count.py
Created December 15, 2017 16:05 — forked from rlskoeser/oaipmh-count.py
Script to count records returned by an OAI-PMH provider
#!/usr/bin/env python
"""
A simple command line script to count the number of records returned by an OAI-PMH provider
OAI-PMH protocol documentation: https://www.openarchives.org/OAI/openarchivesprotocol.html
To install dependencies:
pip install lxml requests beautifulsoup4
@sprklinginfo
sprklinginfo / setup_selenium.sh
Created December 26, 2016 22:15 — forked from curtismcmullan/setup_selenium.sh
Setup Selenium Server on Ubuntu 14.04
#!/bin/bash
# Following the guide found at this page
# http://programmingarehard.com/2014/03/17/behat-and-selenium-in-vagrant.html
echo "\r\nUpdating system ...\r\n"
sudo apt-get update
# Create folder to place selenium in