https://stackoverflow.com/questions/51252160/can-i-copy-the-contents-of-one-doc-to-a-specific-spot-in-another-doc-google-ap
Mostly work related stuff which I would've entered into my "Log book". Instead of hosting it on an intranet site, outsourcing the hosting to blogger!
Wednesday, May 19, 2021
appending Google docs and adding header and footer
https://stackoverflow.com/questions/51252160/can-i-copy-the-contents-of-one-doc-to-a-specific-spot-in-another-doc-google-ap
Saturday, May 08, 2021
glitch.com for building web apps quickly
An interesting service to build Node.js web apps by "remixing" available code -
https://blog.glitch.com/post/google-docs-markdown-glitch
https://help.glitch.com/kb/article/17-what-are-the-technical-restrictions-for-glitch-projects/ - 1000 free project hours per month, 200 MB disk space, 4000 requests per hour.
https://flaviocopes.com/glitch/ has some interesting use cases - teaching, timed webhook and so on.
Friday, May 07, 2021
Getting started with Google Apps Script
A good example of using google apps scripts -
https://gist.github.com/colezlaw/29841885e7f2f49faa07
(also has link to explain google.script.run google script runner etc.)
Another excellent tutorial / collection of sample snippets is at
https://github.com/tanaikech/taking-advantage-of-Web-Apps-with-google-apps-script
There is also the google developers quick-start,
https://developers.google.com/docs/api/quickstart/apps-script
Delegating authority is mentioned at
https://developers.google.com/apps-script/guides/services/advanced#enable_advanced_services
Using service accounts to access api etc, step-by-step instructions are at
https://skaaptjop.medium.com/access-gsuite-apis-on-your-domain-using-a-service-account-e2a8dbda287c
and the gist is at
https://stackoverflow.com/questions/59435611/how-to-access-google-doc-api-with-service-account
Tuesday, May 04, 2021
calling a web app using curl in php
Just the syntax to use in php for using curl and making a GET or POST request to a google apps script - a slight modification from the answer given here, as curl_close was not needed for us -
$url = 'https://script.google.com/macros/s/ID_GOES_HERE/exec?optionname=OptionValue';
$schName = 'Some test';
$url = $url . urlencode($schName);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl,CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($curl);
echo $response;
Monday, May 03, 2021
enabling desktop app notifications on linux
I had mistakenly clicked on "Don't show this message again" or something like that, and wanted to re-enable the notification shown when a VPN connection is made (or fails). The way to do it was mentioned at https://forums.linuxmint.com/viewtopic.php?t=89627
sudo gsettings set org.gnome.nm-applet disable-connected-notifications false sudo gsettings set org.gnome.nm-applet disable-disconnected-notifications false sudo gsettings set org.gnome.nm-applet disable-vpn-notifications false
file written to google drive by service account
When using a service account to create a new file and add it to Google drive, the file owner is the service account.
Can transfer ownership using Google Apps Script also.
https://stackoverflow.com/questions/65256980/google-drive-api-v3-php-client-transfer-file-ownership
restarting remote desktop via ssh or azure portal
Bs series burstable Azure VMs seem to have an endemic problem of the remote desktop service dying or refusing connections after the VM sees some heavy loads. Initially I had no idea why RDesktop was not connecting ... anyway, a couple of workarounds -
- install ssh server and leave the ssh service running
ssh into the machine when RDP has issues,
ssh adminuser@server.tld -p port
powershell
get-service termservice
get-service termservice -dependentservices
stop-service UmRdpService
restart-service termservice
start-service UmRdpService - install Windows Admin Center on the VM and connect via the Azure portal, restarting the same services as above. We need to use the "Connect with Public IP address" method on the Azure portal.
Sunday, May 02, 2021
limits for google apps scripts execution
A six-minute script execution time is mentioned at
https://developers.google.com/apps-script/guides/services/quotas (also many more limits)
but if we run the script from the Script Editor, the limit is 30 minutes. Probably since our Google Workspace is a non-profit one, so the "paid" limit applies. And a programmatic workaround (which I've not used till now.)
Saturday, May 01, 2021
handling duplicates in an sql query
There was a database in which we needed to join three tables, asset id -> subtheme id -> subtheme and the subtheme ids had duplicates as well as multiple subthemes mapped to an asset id. Getting a go-ahead from the content lead, the solution chosen was to just take a single subtheme, using select distinct - something like the first method at https://www.sisense.com/blog/4-ways-to-join-only-the-first-row-in-sql/
left join (select distinct on (asset_id) *
from asset_subtheme_xref
order by asset_id asc
) as asx on asx.asset_id = tma.asset_id
left join subtheme_master lsm on lsm.subtheme_id = asx.subtheme_id
Edit: Later on, multiple subthemes were desired. Then, instead of using select distinct in this way, we would need some sort of subquery similar to the one used below for another field, using concat to add all the different subthemes together with CHR(10) - linefeed - between them - all enclosed in parentheses -
(select string_agg(concat(btwo.name,',',stwo.name,',',sutwo.NAME,',',ctwo.name), CHR(10))
as "Asset tagged to Board Standard Chapter"
from asset_bssc_xref tabxr
left join chapters ctwo on ctwo.chapter_id = tabxr.chapter_id
left join board_master btwo on btwo.board_id = ctwo.board_id
left join standard_master stwo on stwo.standard_id = ctwo.standard_id
left join subject_master sutwo on sutwo.subject_id = ctwo.subject_id
where
tabxr.asset_id = tma.asset_id) as "Asset Tagged to"
installing ssh client and server on Windows Server 2016
https://hostadvice.com/how-to/how-to-install-an-openssh-server-client-on-a-windows-2016-server/
Or maybe needs this,
https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH
or other solutions listed at
or maybe the powershell method listed at
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
Friday, April 23, 2021
demo of displaying content from google drive using a service account
Following
https://www.labnol.org/code/20375-service-accounts-google-apps-script
creating a service account and delegating authority domain-wide via the method at
https://developers.google.com/admin-sdk/directory/v1/guides/delegation
The google apps script's Code.gs has the following, and will work even when the doc is not shared with anyone except theuser@ourdomain.tld:
var JSON = {
"private_key": "-----BEGIN PRIVATE KEY-----\nMI -- snip -- pJKdnI=\n-----END PRIVATE KEY-----\n",
"client_email": "what-name-we-give@proj-name.iam.gserviceaccount.com",
"client_id": "1020123456872",
"user_email": "theuser@ourdomain.tld"
};
function getOAuthService() {
return OAuth2.createService("Service Account")
.setTokenUrl('https://accounts.google.com/o/oauth2/token')
.setPrivateKey(JSON.private_key)
.setIssuer(JSON.client_email)
.setSubject(JSON.user_email)
.setPropertyStore(PropertiesService.getScriptProperties())
.setParam('access_type', 'offline')
.setScope('https://www.googleapis.com/auth/drive');
}
function getUserFiles() {
var service = getOAuthService();
service.reset();
//Logger.log("Getting the Access Token:");
var atoken = service.getAccessToken()
//Logger.log(atoken);
if (service.hasAccess()) {
var url = 'https://drive.google.com/open?id=1qM_DOC_ID_5QiIJ0Ls';
var response = UrlFetchApp.fetch(url, {
headers: {
Authorization: 'Bearer ' + atoken
}
});
return response.getContentText()
}
}
function reset() {
var service = getOAuthService();
service.reset();
}
function doGet(e) {
var htmlout = HtmlService.createHtmlOutput(getUserFiles());
return htmlout
.setTitle('Our Team')
.setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
Thursday, April 22, 2021
Google sign in on Moodle
The user experience for google sign-in on Moodle is shown at
https://www.youtube.com/watch?v=1_HDZoir3eQ
and how to set up, for admins, is shown at
https://www.youtube.com/watch?v=cwUWvTiGSAk
- accurate as of Nov 2020, as google's api and set up screens keeps changing.
Tuesday, April 20, 2021
No matching client found - error for android app
As mentioned on this page -
https://stackoverflow.com/questions/34990479/no-matching-client-found-for-package-name-google-analytics-multiple-productf
the reason was that the package name in the google-services json and the local package name of the app had a discrepancy.
monitoring ram usage over time on windows server
- Start - Run - perfmon.exe
- User defined folder -> New -> Data Collector Set and give it a name.
- Choose Create Manually, and Next.
- Create Data Logs -> Performance Counter and then click Next.
- Choose the desired object(s) to log
- (Every 5 seconds may be a good option for short collection runs)
- Choose location to save in.
- "Start this data collector set now" if desired.
- To stop data logging, right-click User Defined -> Data Collector Set -> our set and click Stop.
Sunday, April 18, 2021
search for a string or a number in an entire database
show an image from binary data using php
This SO link gives two techniques - using data URIs and using a helper function to fetch the image from some storage location.
Edit: My initial implementation was using the simpler data URI method. Later, also implemented using the other method.
Intially,
// to prevent images from being dropped due to timeouts, we'll encode them inline
// https://ads-developers.googleblog.com/2013/11/how-to-send-pdf-reports-with-adwords.html
// to parse the img src, we'll use regex, since the html is of limited scope
// https://stackoverflow.com/questions/14939296/extract-image-src-from-a-string/15013465
// https://support.google.com/a/answer/1346938
var m;
imageurls = [];
regexstring = '(http\\S*' + currentTicket +')'; // the \ is escaped, so it becomes doubled.
//Logger.log(regexstring);
//myregex = new RegExp(/(http\S*0d0a226a47229313863)/,"gi"); // the ticket is the string after S*
myregex = new RegExp(regexstring, "gi");
var imageindex=1;
while ( m = myregex.exec( contentdata ) ) {
imageurls.push( m[1] );
//Logger.log(m[1])
var imagemimetypeandenc = 'data:image/png;base64,'; // default
if ( m[1].includes('.jpg?ticket') || m[1].includes('.jpeg?ticket') ) {
imagemimetypeandenc = 'data:image/jpeg;base64,';
}
else if ( m[1].includes('.gif?ticket') || m[1].includes('.GIF?ticket') ) {
imagemimetypeandenc = 'data:image/gif;base64,';
}
else if ( m[1].includes('.tif?ticket') || m[1].includes('.tiff?ticket') ) {
imagemimetypeandenc = 'data:image/tiff;base64,';
}
Logger.log('%s of assetid %s',imageindex.toString(),data_array[i][0].toString());
imageindex = imageindex + 1;
var imageBlob = UrlFetchApp.fetch(m[1]).getBlob();
var base64EncodedBytes = Utilities.base64Encode(imageBlob.getBytes());
var imageencoded = imagemimetypeandenc + base64EncodedBytes;
contentdata = contentdata.replace(m[1], imageencoded);
}
and later, when images were available on Google Drive,
var placeholder = 'data:image/png;base64,iVBORs_a_few_kb_of_chars_QAAAABJRU5ErkJggg=='; // made with https://www.w3docs.com/tools/image-base64
.....
var m;
imageurls = [];
regexstring = 'img\\s*src\\s*=\\s*"(http\\S*)"'; // the \ is escaped, so it becomes doubled.
// Only the http part is captured, within parenthesis
// currently it matches only if the img src is within double quotes. "https://whatever"
//Logger.log(regexstring);
myregex = new RegExp(regexstring, "gi");
var imageindex=1;
while ( m = myregex.exec( contentdata ) ) {
imageurls.push( m[1] );
Logger.log('%s of assetid %s',imageindex.toString(),data_array[i][0].toString());
imageindex = imageindex + 1;
// here we use a helper if the url contains the alfresco url
var response;
if (m[1].includes('ticket=') ) {
//use the helper function after extracting the filename
Logger.log('Downloading %s using Alfresco helper', m[1])
var fname = m[1].split('/')[9]; // from the url similar to
// https://www.ourdomain.tld/alfresco/d/direct/workspace/NameOfStore/f8b56b7c-long-id-a35c30be756a/filename-15092020100930PM?ticket=
fname = fname.split('?')[0];
// handle cases where fname does not have extension
var urlFromHelper = UrlFetchApp.fetch(returnUrl+encodeURIComponent(fname));
response = UrlFetchApp.fetch(urlFromHelper, { muteHttpExceptions: true });
}
if (response.getResponseCode()==200) {
var imageBlob = response.getBlob();
var base64EncodedBytes = Utilities.base64Encode(imageBlob.getBytes());
//var ctype = response.getHeaders().Content-Type
var headermap = new Map(Object.entries(response.getHeaders()));
var mimetypeofim = headermap.get('Content-Type');
var imagemimetypeandenc = 'data:'+mimetypeofim+';base64,';
var imageencoded = imagemimetypeandenc + base64EncodedBytes;
contentdata = contentdata.replace(m[1], placeholder);
}
And in cases where we did not want the images to be base64 encoded - for example in the case of large images, which would cause the function to run out of memory - the whole code-block above would be not needed, since the img src link in the original html would work OK.
Saturday, April 17, 2021
embedding a pdf in a web page
- Using the object or embed tag (deprecated)
- Using a tags with href links (not actually embedding, linking)
- Using iframe tags where the toolbar can be made hidden with src="/path/my.pdf#toolbar=0"
- Using Adobe's SDK - somewhat complicated initial setup
- If hosted on Google Drive, using an iframe with src="https://drive.google.com/file/d/FILE_ID/preview">
Friday, April 16, 2021
showing memory usage by process and user
Using ps on the linux terminal, we can check out memory usage -
https://www.networkworld.com/article/3516319/showing-memory-usage-in-linux-by-process-and-user.html
"sort is being used with the -r (reverse), the -n (numeric) and the -k (key) options which are telling the command to sort the output in reverse numeric order based on the fourth column (memory usage) in the output from ps. If we first display the heading for the ps output, this is a little easier to see."
ps aux | head -1; ps aux | sort -rnk 4 | head -5
resubscribing to letsencrypt emails
According to this thread,
https://community.letsencrypt.org/t/accidentally-unsubscribed/14682/14
the way to resubscribe after accidentally unsubscribing would be to change the registration to email+1@mydomain.com with
certbot update_account --email yourname+1@example.com
Wednesday, April 14, 2021
azcopy with sas tokens and more
updating an app on Google's Android Play App store
Monday, April 12, 2021
comparing Azure pricing in different locations
An interesting site - https://azureprice.net/ Makes it easy to find the region with lowest pricing for a particular type of VM.
As the site says, pricing is also different in different currencies.
Sunday, April 11, 2021
customizing and building the moodle app
After learning how to use an older node version, the moodle app could finally be customized and built - a follow-up to my failed trials here.
The customization steps and the relevant modified files are in this location, with the changes being mentioned in the readme as follows:
1. Changes as per the moodle doc on compiling with AOT
Edit Oct 2022 - the link content seems to have changed, so here is the archived version.
2. Change to the build.gradle to force minSdkversion 22
ext.cdvMinSdkVersion = 22
to build with android studio. This can also be done in config.xml
3. Changing all ~ and ^ package dependencies in package.json (except cordova-android itself) to the exact package. Done by replacing
"~ with "
and
"^ with "
in package.json
Or else, all sorts of dependency issues while building the 2019 release in 2021. (The nvm use 11 may also suffice for solving the dependency issues.)
The build directory takes up more than 1 GB, lots of dependencies are downloaded.
4. Customization - Changes as per the Configuration heading at this post,
config.xml
reduced SplashScreenDelay
and SplashShowOnlyFirstTime true
also, very important,
content src="https://sssvidyavahini.org" would make the app like a simple webview.
We don't want that, so leave the content src as it is,
but change the siteurl in src/config.json
and onlyallowlistedsites true.
We also set android-minSdkVersion" value="22" in config.xml
google-services.json - changed the package name
and changed the version in src/config.json , ensured it is different, but same number of digits.
5. Changing logo and splash screen as per above url and also resources/android/icon-background.png and icon-foreground.png
and in src dir assets/img
Build steps -
Set up environment variables as per
https://cordova.apache.org/docs/en/10.x/guide/platforms/android/
JDK tar.gz needed oracle login, created as my official email
Set JAVA_HOME
https://docs.oracle.com/cd/E19182-01/821-0917/inst_jdk_javahome_t/index.html
in .bashrc, added the following.
export JAVA_HOME=/home/mac/Downloads/jdk1.8.0_281
export PATH=$JAVA_HOME/bin:$PATH
export ANDROID_SDK_ROOT=/home/mac/Android/Sdk
export PATH=$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH
As mentioned in the cordova documentation, we can open a cordova project inside android studio for the final build - choose the import gradle project option, and choose the platforms/android directory.
But we need to edit www folder outside android studio, then copy over changes by doing cordova build - in our case, npx etc as below.
# https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2
nvm install node 11.15.0
# https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/
nvm use 11
# this is very important - if starting again in another terminal window, must do nvm use 11
# or else all sorts of hard to diagnose errors occur during the build.
sudo apt-get install libsecret-1-dev
npm install
# cordova.plugins.diagnostic: Diagnostic plugin - ERROR: ENOENT: no such file or directory, open '/home/mac/StudioProjects/LMSappBuildTrial/config.xml'
# added 1829 packages from 1022 contributors and audited 1958 packages in 98.592s
npx cordova prepare
# Current working directory is not a Cordova-based project.
# https://stackoverflow.com/questions/21276294/cordova-current-working-directory-is-not-a-cordova-based-project
#mkdir www
npm install cordova
# this is also important. Without this, the www directory is not populated for the final prod build.
npm i -g cordova-res
# This is also important - without this, the image resources won't get processed
# config.xml was missing, so copied over with git
# No platforms added to this project. Please use `cordova platform add <platform>`.
npx ionic cordova platform add android --verbose
#Source path does not exist: resources/android/icon/drawable-hdpi-smallicon.png
#Error: Source path does not exist: resources/android/icon/drawable-hdpi-smallicon.png
# editing gitignore file to add the resources
npx cordova prepare
# ignoring the warning about conflict
npx gulp
npm start
# This is an optional step to check in a browser and verify.
# waiting till transpile started etc. then Ctrl+C
# If we wait till the end - nearly an hour on a 4 GB system? it opens in the default browser.
# https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2#Compiling_using_AOT
cp -v "changes made to moodleapp files/inside node_modules dir/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js" "node_modules/@angular/platform-browser-dynamic/esm5"
cp -v "changes made to moodleapp files/inside node_modules dir/@ionic/app-scripts/dist/util/config.js" "node_modules/@ionic/app-scripts/dist/util/config.js"
# edited gitignore to not ignore this config.js, did git add -f.
npm run ionic:build -- --prod
# this takes a lot of RAM and a lot of time.
# if possible, avoid swapping by closing all apps and clearning memory before doing this.
# REMEMBER to use nvm use 11 if doing this in a fresh terminal
#PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
# 3682 mac 20 0 3142252 2.215g 28948 R 131.5 59.6 6:34.48 node
# build prod finished in 3128.04 s - this was on a 4GB machine
# on a 16 GB GCP instance, it took up around 1/3rd of memory - 5 GB+ -
# and finished in just 5 or 6 minutes instead of 50 minutes.
# npx cordova run android
# Could not find an installed version of Gradle either in Android Studio,
#or on your system to install the gradle wrapper. Please include gradle
#in your path, or install Android Studio
# So, I just imported the platforms/android directory using the Import Gradle project option in Android Studio 4.1.3, and built from there.
/dev/kvm permission denied fix for Android AVD unable to open in Android studio
I did not go through this, since my machine had only 4 GB RAM and was probably too RAM constrained to run the virtual device, but
- install qemu-kvm and then give appropriate permission to the current user.
$ sudo apt install qemu-kvm
% add your user to the kvm group.
$ sudo adduser <username> kvm
% And then
$ sudo chown <username> /dev/kvm
Saturday, April 10, 2021
uninstall apk before installing with different signature
While developing android apps, we find that sometimes the apks we build don't get installed - the package manager just says Not Installed. The reason is apparently that if the same app is currently installed with a different signature, it will not get overwritten.
Uninstalling via long press on the home screen on my LG Q6 was not sufficient.
To uninstall cleanly, the way was as listed at this page:
Settings - Apps - Select the app to uninstall - Choose Force Stop
Then choose Storage - Clear Cache - Clear Data
Return to the app screen - choose Uninstall
After doing this, the apk will install. If it doesn't there may be something wrong with the signing etc. which will be the subject of another post of mine.
Wednesday, April 07, 2021
signing release build apk files in android studio
Project Structure - Modules - Signing tab - add a configuration, and under Build types tab, release build, under signing config, choose the one which we have added.
loading software on a few hundred tablets
There was some discussion about loading software on some Android devices which were to be shipped to schools.
Initial thought was to create ids like
OurPrefix.TAB.2021.01@gmail.com
to log on to the play store for the tablet which has asset id OurPrefix-TAB-01 etc.
We could then print out the password and put it in the box for the teachers to change if necessary.
This is required, since this is not a factory install, and factory install process is very different from manual install :) For a manual install, we have to log on to the play store with a particular account, etc etc.
If we are to not create such ids, installing and then logging out of the account used to install can work for our free apps, but with the drawback that the apps will not update. For updates, the users would have to uninstall and reinstall.
The next idea was to install all these apps using pre-downloaded APK files, so that the internet connection would not be a bottleneck in the prep process which was planned to be done on a single day for several hundred devices - taking the help of a score or more of volunteers. This too had the drawback of the apps not updating automatically from the Play store.
Finally the idea of links to the Play store was mooted.
- Connect via USB cable to the computer, Choose the "File transfer' USB usage preference, copy the tabletslinks.txt file to the Download directory on the tablet.
- Navigate to the txt file using Google Files on the tablet, click on it and choose to open with Chrome.
- Copy each line (each link), open a new tab in Chrome, paste in Chrome, hit Enter (while offline)
- Click the three vertical dots on the right hand side of the Chrome address bar, choose "Add to Home Screen"
- Write an appropriate short link title like Pdf for the adobe pdf reader link, Office for the office link, Teams/Meet/Zoom for the respective links.
- Drag and drop the link to the home screen.
Monday, April 05, 2021
Sunday, April 04, 2021
change default app in Android
Saturday, April 03, 2021
Android studio Git checkout
For checking out at a specific commit -
https://stackoverflow.com/questions/36517118/how-do-i-checkout-an-old-git-commit-in-android-studio
right-click relevant commit on the Git tab's history, choose 'Checkout revision <hash>'
keeping Windows and Linux dual-boot times correct
This 2011 post has the Kubuntu 10 way, and for current machines running systemd, the way to do it is, if choosing to make Linux use the hardware clock as local time,
timedatectl set-local-rtc 1
Thursday, April 01, 2021
fixing Filezilla error about LC_CTYPE environment variable
As described on this page, the solution was
sudo nano /usr/share/applications/filezilla.desktop
Find the line
Exec=filezilla
and replace it with
Exec=env LC_ALL=en_US.UTF-8 filezilla
Tuesday, March 30, 2021
how to identify if a DLL is a debug or release build
Monday, March 29, 2021
repairing boot after installing windows
creating Windows installer USB drive from ISO - on Linux with woeusb
The usual route using unetbootin would need the USB drive to be partitioned as FAT32 (using gparted, the Disks utility on Linux Mint doesn't do it - and have to mount with Disks utility after gparted does the reformatting). But then the Windows 10 installation ISO contains a file installer.wim which is 5 GB, so it can't be written to the FAT32 volume. So we have to use ntfs -
https://askubuntu.com/questions/162174/how-do-i-use-unetbootin-to-make-a-bootable-windows-usb-installer
or use woeusb.
(Detailed steps:
woeusb ppa gives error on install,
The following packages have unmet dependencies:
woeusb : Depends: libwxgtk3.0-0v5 (>= 3.0.4+dfsg) but it is not installable
E: Unable to correct problems, you have held broken packages.
woeusb
needs https://wimlib.net/
sudo apt install build-essential
./configure
gave
No package 'libxml-2.0' found
sudo apt install libxml2-dev
Cannot find libntfs-3g
sudo apt install ntfs-3g-dev
error: Cannot find libfuse
sudo apt install libfuse-dev
sudo ./woeusb-5.1.0.bash --device /home/path/Win10_20H2_v2_EnglishInternational_x64.iso /dev/sdb
wimlib-imagex: error while loading shared libraries: libwim.so.15: cannot open shared object file: No such file or directory
Solution was to run ldconfig, as found in
https://wimlib.net/forums/viewtopic.php?t=240
sudo ldconfig -v
)
Visual Studio publish and deploy ASP .NET Core app to IIS
This link has the basics on how to do the setup, and also some do's and don'ts for ASP .NET apps on IIS - https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.0&tabs=visual-studio
Sunday, March 28, 2021
run explorer as Administrator
On Windows server, there is no "Run As Administrator" directly available for File Explorer. So, we can go to C:\Windows with File Explorer, and then right-click on explorer.exe and Run As Administrator.
sql query to replace a substring
We needed to replace some Windows paths in a MySQL database. Following
https://www.mysqltutorial.org/mysql-string-replace-function.aspx/
update tablename set tablename.MediaSource = REPLACE(tablename.MediaSource,
m4a,
mp3)
WHERE
tablename.MediaSource like '%Dashboard%1%1%2%1%2.m4a';
and if we wanted to be more specific, the '\' in the Windows paths need to be escaped as four backslashes - following https://stackoverflow.com/questions/14926386/how-to-search-for-slash-in-mysql-and-why-escaping-not-required-for-wher -
select * from tablename where tablename.MediaSource like '%Dashboard%1%1%2\\\\1\\\\2.m4a';
And the syntax for a count statement was like
select count(*) from (select * from tablename where tablename.MediaSource like '%Dashboard%m4a') myqueryname;
finding mysql data size
According to
https://support.microfocus.com/kb/doc.php?id=7019203#
we can find the data directory from my.ini which would be in server directory in program files - the datadir line in my.ini
But on our install, it was in c:\programdata\mysql
and data was also there.
Notes on locally mounting Windows NTFS drive on dual boot Linux
In order to make the partition visible as a separate entry on the side bar, move mount point to /media/windows1 or something like that -
https://forums.linuxmint.com/viewtopic.php?t=300597
https://www.google.com/search?q=umask+needed+to+make+vfat+drive+writable+by+all+users+on+linux
umask=0 for writable by all.
visual studio offline installer
Adding google search to Firefox on Linux Mint
Linux Mint has removed Google from the search engines available by default, and we have to follow a "Microsoft-esque" convoluted procedure to make Google search available from the address bar or the search box - following https://www.techbrown.com/add-google-default-search-engine-firefox-linux-mint/
- Go to https://linuxmint.com/searchengines.php
- Scroll down to the bottom of the page and click on the Google logo
- The page which loads up then has instructions to right-click on the address bar and add Google search from the context menu.
- Then we can choose to make Google the default search from the search box from the "Change search settings" gear icon under the search box also.
Restoring Linux after Windows install
Friday, March 26, 2021
customizing Moodle theme per course
Replying to a request of adding blocks to some courses on one of our Moodle servers -
https://moodle.org/mod/forum/discuss.php?d=256667
Site administration>Appearance>Themes>Theme settings - can set it to allow course themes.
Then I went to an example test course I created,
- Turned editing on,
- clicked on the gear icon,
- clicked on Edit settings,
- Scrolled down to Appearance, opened up the Appearance section,
- and in the appearance section, chose
- Force Theme : Boost.
- After doing that, I'm able to add blocks as per this video,
https://www.youtube.com/watch?v=uByp1qqcWt8
But please note, not all types of blocks are supported on mobile - please see the list of supported blocks below.
https://docs.moodle.org/310/en/Moodle_App_Block_support
In this way, you can set your own look and feel for only some courses as per the method above, without disturbing the look and feel of the rest of the site.
finding and listing files without extensions in Linux
This post -
https://askubuntu.com/questions/337964/list-all-files-that-do-not-have-extensions
uses ls to list all files without extensions.
Then there is the technique using find,
https://unix.stackexchange.com/questions/47151/how-do-i-list-every-file-in-a-directory-except-those-with-specified-extensions
to list those files other than those with specific extensions, which I used like
find nameofdirectory ! '(' -name '*.mp3' -o -name '*.docx' -o -name '*.zip' ')'
find nameofdirectory ! '(' -name '*.*' ')'
lists directories also.
find nameofdirectory -type f ! '(' -name '*.*' ')' | wc -l
for counting the total.
Thursday, March 25, 2021
file transfer using remote desktop - RDP
Transferring a single zip file is much much faster than transferring a large number of small files. Another issue with transferring a large number of files this way is that some extra files are created - "which indicate that the file originated from the network". Zone Identifier files as explained in this post - https://apple.stackexchange.com/questions/378438/what-are-these-extra-zone-identifier-files-created-during-windows-remote-deskto
To enable file transfer from the Remmina RDP client, check the shared folder and enable a folder to share, in the Basic tab, and Sound Local in Advanced tab
Macbook not charging
Resetting the SMC - System Management Controller - is supposed to cure many issues related to battery etc. In my case it did not help - maybe because the Applecare person has removed the bulged battery?
https://support.apple.com/en-gb/HT201295
"with non-removable battery" -
Hold down Shift + Ctrl + Opt , then hold down power button also, for 10 sec.
Release all, then press power button to turn on.
creating webview android apps, and angular to apk
- https://www.tutorialspoint.com/how-to-create-a-webview-in-android-app
- https://developer.chrome.com/docs/multidevice/webview/gettingstarted/ - the official doc
- https://developer.android.com/codelabs/basic-android-kotlin-training-change-app-icon#0
- https://developer.android.com/guide/webapps/webview.html#kotlin - Java and Kotlin code
- https://github.com/mgks/Kotlin-SmartWebView - used this to create a demo app (but doesn't have microphone support)
https://github.com/delight-im/Android-AdvancedWebView
Wednesday, March 24, 2021
changing the name of an Android app
1. From https://stackoverflow.com/questions/5443304/how-to-change-an-android-apps-name
By changing the android:label field in your application node in AndroidManifest.xml - Please make sure that you change label:
android:label="@string/title_activity_splash_screen"
in your Splash Screen activity in your strings.xml file. It can be found in Res -> Values -> strings.xml
2. change the package name - from
https://stackoverflow.com/questions/16804093/rename-package-in-android-studio
- In your Project pane, click on the little gear icon
- Uncheck the Compact Empty Middle Packages option
- Your package directory will now be broken up into individual directories
- Individually select each directory you want to rename, and:
- Right-click it, Select Refactor, Click on Rename
- In the pop-up dialog, click on Rename Package instead of Rename Directory
- Enter the new name and hit Refactor
- Click Do Refactor in the bottom
- Allow a minute to let Android Studio update all changes
- Note: When renaming com in Android Studio, it might give a warning. In such case, select Rename All
Tuesday, March 23, 2021
ASP .NET memory usage
Monday, March 22, 2021
send a post request with curl
https://github.com/thephpleague/oauth2-server/tree/master/examples
https://gist.github.com/subfuzion/08c5d85437d5d4f00e58
Since the default is application/x-www-form-urlencoded, the shortest would be
curl -d "param1=value1¶m2=value2" -X POST http://localhost:3000/data
or with a data file,
curl -d "@data.txt" -X POST http://localhost:3000/data
Saturday, March 20, 2021
some post install changes needed for moodle
I had made a test moodle server by copying over the database, moodledata and /var/www/html/moodleinstalldirectory to a different server. Additionally, the following changes needed to be made.
- Had to set up the cron job. The instructions given at MoodleDocs were to create it as the www-data user, crontab -u www-data -e
First ran it on the command-line to test that it works, running it as the www-data user with
sudo -u www-data /usr/bin/php /var/www/sssvv/admin/cli/cron.php
- that took 2 minutes to run the first time, but later runs finished in a second or so.
But on this Ubuntu 20.04 machine, a cron set for www-data did not work - probably as a security feature - though it did have a file in /var/spool/cron/crontabs as a comment on this page mentions. So, made a cron job as root, but running as www-data as per this post.
* * * * * su www-data -s /bin/bash -c "/usr/bin/php /var/www/sssvv/admin/cli/cron.php" - Had to increase the php file upload limit.
sudo nano /etc/php/7.4/apache2/php.ini
( Ctrl+w to find and change post_max_size
Ctrl+w to find and change upload_max_filesize
Ctrl+w to find and change max_execution_time - set to 600 for now.)
sudo apachectl restart - Make the disk mount permanent by editing /etc/fstab - had to find the UUID of the partition using
lsblk -f
sudo blkid
and then in /etc/fstab, added the line at the end,
UUID=<uuid found using blkid> /datadrive/mount/path ext4 defaults,nofail 1 2
Doing a umount and then a mount -a would mount it from fstab, so that we can correct errors if any.
Linux Mint Workspace size
In order to disable extra workspaces on Linux Mint,
https://forums.linuxmint.com/viewtopic.php?t=280563
Ctrl+Alt+Up Arrow to enter the workspaces mode, select each unwanted workspace and choose to close.
Then my recurrent issue on Linux Mint installs on a Macbook - the workspace size seems to be much bigger than the screen size. Menu - Preferences - Display - found that two screens were enabled - disabled one to solve the issue.
delete a service on Windows server
- Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services key with regedit
- Select the key of the service you want to delete and choose Edit menu - Delete
Thursday, March 18, 2021
Moodle layout - removing the footer
This page has a discussion about hiding the footer in Moodle where Boost theme is used -
https://moodle.org/mod/forum/discuss.php?d=349625
The idea of hiding a section with something like
footer#page-footer {display: none;}
in the custom scss box is useful.
In the Moove theme, there is the option to not display the footer, as noted elsewhere in the thread.
Wednesday, March 17, 2021
removing android app splash screen
Quite an involved process to remove the splash screen, and many places where things can go wrong -
https://stackoverflow.com/questions/48239602/how-to-remove-splash-activity-from-an-existing-project/482396
Probably just easier to customize the splash screen with our graphics, and reduce its time interval. For example,
val SPLASH_TIME_OUT = 5000
in PYF-SmartWebView-3.5
Tuesday, March 16, 2021
install parse failed no certificates error for Android apk
Installation error: INSTALL_PARSE_FAILED_NO_CERTIFICATES
for Android apk files are discussed at
https://stackoverflow.com/questions/2914105/what-is-install-parse-failed-no-certificates-error
Saturday, March 13, 2021
warning in firefox for mixed content
Copy-pasting from a long explanation I had sent to someone:
The reason why Firefox shows the warnings and Chrome doesn't is because Chrome automatically checks for https links for mixed content, and automatically serves the https link instead of the http link in case it works.
You can find out which particular links are serving the mixed content (http links on a https page) by choosing inspect element when you right-click on the page, and seeing the console output.
Looks like Firefox will display the warning even if the http link is redirected to an https link -
https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content
"To fix this type of error, all requests to HTTP content should be removed and replaced with content served over HTTPS. Some common examples of mixed content include JavaScript files, stylesheets, images, videos, and other media.
Note: The console will display a message indicating if mixed-display content is being successfully upgraded from HTTP to HTTPS (instead of a warning about "Loading mixed (insecure) display content")."
So even with cloudflare proxying set to strict https, Firefox would show this warning (as of March 2021).
Then, if you want this to be fixed, ask whoever has access to the web server to change all http requests to https -
https://themify.me/blog/mass-replace-urls-https-wordpress-database
Friday, March 12, 2021
SCORM creation from Microsoft Word documents and other tools
Some discussion about SCORM - sharable content object reference model - packages, importing from Word etc -
https://moodle.org/mod/forum/discuss.php?d=57059
Tuesday, March 09, 2021
sending emails as a particular Google Workspace user from Moodle
Monday, March 08, 2021
ssh keep alive
ssh kept timing out on one of our servers - when the terminal window inactive for 10 minutes or something like that. Came across this article to fix it - did it using the client side, adding the line: ServerAliveInterval 60
to the file /etc/ssh/ssh_config
Sunday, March 07, 2021
failed attempts to build the moodle app apk
Documenting my failed attempts to build the Moodle Android app.
Edit: The successful attempt is documented in this post.
For customizing We may need to follow http://blog.vinodsingh.com/2020/05/how-to-customize-moodle-mobile-app.html But even the basic moodleapp fails to build - as below. Android Studio version etc as of March 4th to 7th 2021. Steps for build --------------- Following https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2 except for some exceptions, and ignoring errors. wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash nvm install node # don't do nvm use 11 - current version is 15, that works. 11 has bugs. sudo apt-get install libsecret-1-dev git clone https://github.com/moodlehq/moodleapp.git moodleapp cd moodleapp git checkout integration # dont't run npm run setup - run each individually, since errors can be ignored. npm install #( #npm ERR! npm ERR! network aborted #npm ERR! npm ERR! network This is a problem related to network connectivity. #Re-ran ... #) #Took ~ 10 minutes on lenovoPC, 2 minutes on GCP. npx cordova prepare # ignore the errors. #Failed to restore plugin "phonegap-plugin-push". You might need to try adding it again. # Error: CordovaError: Failed #to fetch plugin # git+https://github.com/moodlemobile/phonegap-plugin-push.git#moodle-v3 via registry. #Probably this is either a connection problem, or plugin spec is incorrect. #Check your connection and plugin name/version/URL. # (Ran again, due to internet breakage) npx gulp npm start # Did not show any errors, showed waiting for connection npx ionic cordova platform remove android npx ionic cordova platform remove ios npx ionic cordova platform add android # did not do npx ionic cordova platform add ios # ignored the error, # Failed to fetch platform cordova-android@^9.0.0 #Probably this is either a connection problem, or platform spec is incorrect. # in verbose mode, #npm ERR! errno ENOTFOUND #npm ERR! network request to https://registry.npmjs.org/coffeescript failed, #reason: getaddrinfo ENOTFOUND #registry.npmjs.org #npm ERR! network This is a problem related to network connectivity. # Ran again, # npx ionic cordova platform add android --verbose # Platform android already exists. # did remove and add again, then looks like it is not a connection problem, but platform spec is incorrect # https://stackoverflow.com/questions/55965450/failed-to-fetch-platform-cordova-android8-0-0 # ignoring, npm run dev:android # gave error, but wrote #cordova-android-support-gradle-release: Android platform: V7+ #cordova-android-support-gradle-release: Wrote custom version '27.1.0' to #/home/user/moodleapp/platforms/android/app/#build.gradle #cordova-android-support-gradle-release: Wrote custom version '27.1.0' to #/home/user/moodleapp/platforms/android/ #cordova-android-support-gradle-release/moodlemobile-cordova-android-support-gradle-release.gradle #[ERROR] An error occurred while running subprocess cordova. # on GCP, error was No valid Android SDK root found. # did again on a fresh terminal so that .bashrc is processed again, # then it worked. sudo apt-get install gradle sudo apt-get install libgradle-android-plugin-java Edits as per https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2#Compiling_using_AOT npm run ionic:build -- --prod # LenovoPC bogged down since it uses too much memory and goes into swap, trying on cloud dev machine. # GCP finished in 6 minutes - used nearly all of 16 GB RAM. 200% cpu of 4 core machine. npx cordova run android # on GCP, gave response as below # npx cordova run android Conflict found, edit-config changes from config.xml will overwrite plugin.xml changes 9.0.0 cordova-android-support-gradle-release: Android platform: V7+ cordova-android-support-gradle-release: Wrote custom version '27.1.0' to /home/user/moodleapp/platforms/android/app/build.gradle #cordova-android-support-gradle-release: #Wrote custom version '27.1.0' to #/home/user/moodleapp/platforms/android/cordova-android-support-gradle-release/moodlemobile-cordova-android-support-gradle-release.gradle Cannot find module 'xcode' Require stack: - /home/user/moodleapp/plugins/cordova-plugin-add-swift-support/src/add-swift-support.js - /home/user/moodleapp/node_modules/cordova-lib/src/hooks/HooksRunner.js - /home/user/moodleapp/node_modules/cordova-lib/src/plugman/install.js - /home/user/moodleapp/node_modules/cordova-lib/src/plugman/plugman.js - /home/user/moodleapp/node_modules/cordova-lib/cordova-lib.js - /home/user/moodleapp/node_modules/cordova/src/help.js - /home/user/moodleapp/node_modules/cordova/src/cli.js - /home/user/moodleapp/node_modules/cordova/bin/cordova ########### # so tried importing into android studio # https://cordova.apache.org/docs/en/10.x/guide/platforms/android/index.html#debugging # #android studio gave error as follows: # ~/androidstudioerr.txt #Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 22 declared in library [:CordovaLib] #/home/user/moodleapp/platforms/android/CordovaLib/build/intermediates/library_manifest/debug/AndroidManifest.xml #as the library might be using APIs not available in 19 # Suggestion: use a compatible library with a minSdk of at most 19, # or increase this project's minSdk version to at least 22, # or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures # # https://github.com/apache/cordova-android/issues/1070 # so edited config.xml with the info as given in the above, but that gave unbound prefix error. # # Then, tried changing minSdkVersion=22 (from 19) on line 212 of config.xml # still # so, https://www.learningsomethingnew.com/how-and-why-to-change-your-android-cordova-apps-min-sdk-version # but cordova platform rm android # cordova: command not found. # so tried npx ionic cordova platform remove android npx ionic cordova platform add android # but the same error inside android studio.
Edit: The successful attempt is documented in this post.
Thursday, March 04, 2021
German letters without diacritics
Sometimes we have to post descriptions on our schedule page of German programs, which may contain diacritics. But our schedule software currently doesn't support unicode, so I've to convert those to characters without diacritics. This page has a handy conversion guide - mostly adding e for umlauts.
Tuesday, March 02, 2021
REISUB - for restarting linux machines which are unresponsive
From http://blog.kember.net/articles/reisub-the-gentle-linux-restart/ -
https://en.wikipedia.org/wiki/Magic_SysRq_key
says that on linux mint, it is Ctrl Alt PrtScr, and then - slowly -
Alt + REISUO to shut down, REISUB to reboot.
- Switch from RAW to XLATE
- Send Sigterm
- Send Sigkill
- Sync all mounted filesystems
- remount in read-only
- Shutdown.
deploy from github to server with php
https://medium.com/riow/deploy-to-production-server-with-git-using-php-ab69b13f78ad
But then didn't use because of this,
Friday, February 26, 2021
server admin activities for an Asst. Admin
Excerpts from my reply to a colleague in a sister institution who had joined recently and wanted to get up to speed with his duties -
These are the activities I have done to help the LMS team -
1. Setting DNS records in Cloudflare -
https://ns1.com/resources/dns-types-records-servers-and-queries
https://en.wikipedia.org/wiki/Cloudflare
https://support.cloudflare.com/hc/en-us/articles/360019093151-Managing-DNS-records-in-Cloudflare
The DNS records are currently handled by V----, I help him when needed.
2. Helping with load testing for servername.our.domain - R--- did most of the work -
https://hnsws.blogspot.com/2020/12/load-testing-moodle-server-log-in-with.html
https://docs.moodle.org/310/en/Performance_recommendations#Hardware_configuration
Please see the test reports made by Prof. S----- and R-----.
3. Setting up SSL (https) using bitnami's tool - bncert-tool
https://hnsws.blogspot.com/2020/12/location-of-apache-configuration-files.html
In case the machine in question is not a bitnami VM,
https://hnsws.blogspot.com/2020/11/setting-up-letsencrypt-certificates-for.html
4. For doing the above (point 3.), you will need to know how to use the command-line, and how to use ssh -
https://www.ucl.ac.uk/isd/what-ssh-and-how-do-i-use-it
https://en.wikipedia.org/wiki/PuTTY
https://www.chiark.greenend.org.uk/~sgtatham/putty/faq.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
5. If you are not familiar with the Linux terminal (command-line),
https://www.google.com/search?q=getting+started+with+the+linux+command+line
Thursday, February 25, 2021
creating a backup of a web server
- Copied the conf files using sftp.
- Created the user using adduser
- mkdir downloads as the new user,
- added to www-data group and changed permissions as on our server,
# chown nameofuser:www-data downloads
# chmod 755 downloads - Check if server2 has enough disk space before running rsync.
Currently seems to have ~600 GB available. - Ran a2ensite for all the missing sites, and
- service apache2 reload
sudo apt install certbot python3-certbot-apache
Monday, February 22, 2021
certbot missing apache plugin
I too faced the same issue described in the post below, with the same solution -
apt install python3-certbot-apache
https://community.letsencrypt.org/t/certbot-missing-apache-plugin/58579
Moodle directory permissions
"Invalid permissions detected when trying to create a directory. Turn debugging on for further details."
Simple fix would be:
sudo chown -R www-data:www-data /var/www/our_moodle_dir
sudo chown -R www-data:www-data /var/www/our_moodle_files_dir
mount a new data disk on an Azure Linux VM
https://blog.e-zest.com/how-to-create-attach-and-mount-a-disk-to-linux-vm-microsoft-azure
Basically create the disk from the Azure portal, then
- find the name of the device using dmesg - for eg. /dev/sdc
- sudo fdisk /dev/sdc
- sudo mkfs -t ext4 /dev/sdc1
- sudo mkdir DriveFolder; sudo mount /dev/sdc1 DriveFolder
- append to /etc/fstab using sudo blkid to find the UUID of the disk. Eg.
UUID=33333333-3b3b-3c3c-3d3d-3e3e3e3e3e3e /datadrive ext4 defaults,nofail 1 2
has a better set of instructions.
Sunday, February 21, 2021
mounting Azure blob storage
Fresh install of Moodle on Ubuntu 20.04 with apt
Using the command at https://www.tecmint.com/install-moodle-in-ubuntu/
sudo apt update
sudo apt install php-common php-iconv php-curl php-mbstring php-xmlrpc php-soap php-zip php-gd php-xml php-intl php-json libpcre3 libpcre3-dev graphviz aspell ghostscript clamav
Then git-based install after
sudo apt install git
Edit: For the error "PHP has not been properly configured with the MySQLi extension for it to communicate with MySQL. Please check your php.ini file or recompile PHP."
we can follow the installation instructions at
https://docs.moodle.org/310/en/Step-by-step_Installation_Guide_for_Ubuntu
Installing the lapp stack on Ubuntu 20
https://kb.amijani.net/web-server/how-to-install-lapp-apache-php-postgresql-on-ubuntu-20-04/
Basically,
sudo apt install apache2
sudo apt install php7.4 libapache2-mod-php7.4 openssl php-imagick php7.4-common php7.4-curl php7.4-gd php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-pgsql php-ssh2 php7.4-xml php7.4-zip unzip
Then install PostgreSQL with
https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-20-04-quickstart
Thursday, February 18, 2021
connecting to a pptp VPN
A VPN to some servers was configured on Windows 10 clients as
Type of sign-in info: User name and password
and under "Advanced",
VPN type: Automatic.
Other windows clients were able to log on to the VPN with no problems, but when I tried with Linux Mint and the default pptp VPN settings, the connection was failing. My first thought was that some setting was missing, but it turned out that the reason for the VPN to fail was that my internet connection was via a mobile hotspot - just connecting via a broadband connection did the trick, I did not have to do any port-forwarding or any settings on the router. And then I found that some mobile hotspots work too -
LG Q6 with Airtel 4G on primary SIM slot - no
LG Q6 with Airtel 3G on primary SIM slot - sometimes works.
Redmi 4 with Jio SIM - works
Realme U1 with Jio SIM in secondary SIM slot - no
JioFi router (2018 model) - works
BSNL ADSL broadband with wifi router - works
With the default routing, all connections are routed through the VPN, and normal internet browsing doesn't work. With the help of this post, changed the routing so that only connections to those machines which are on the VPN are routed through the VPN.
/var/log/syslog gave the internal gateway info, which is on the private subnet, different from the external gateway which is on a public subnet.
Wednesday, February 17, 2021
rsync, screen and ssh-agent
On some of our other Ubuntu servers, rsync in a cron job as root works fine with ssh and key-based authentication. But not on a CentOS server I recently logged on to, because ssh-agent was not automatically started on login.
So, I have to run the following -
eval `ssh-agent -s`
ssh-add /path/to/keyfile.pem
and then do the ssh -i keyfile user@remoteserver
Monday, February 15, 2021
php oauth server - link dump
PHP 5
https://www.sitepoint.com/creating-a-php-oauth-server/
https://bshaffer.github.io/oauth2-server-php-docs/
PHP 7
https://github.com/thephpleague/oauth2-server
Using firebase (PHP 7)
https://github.com/jeromegamez/firebase-php-examples
Edit: We finally did not use any of these, and instead authenticated using google sign-in against our own database as mentioned at https://hnsws.blogspot.com/2021/12/using-google-sign-in-for-our-php-portal.html


