Skip to content

Instantly share code, notes, and snippets.

View bernhardkaindl's full-sized avatar

Bernhard Kaindl bernhardkaindl

View GitHub Profile
@bernhardkaindl
bernhardkaindl / wsl-2-static-ip-address.md
Created October 23, 2023 14:09 — forked from angus-mcritchie/wsl-2-static-ip-address.md
WSL2 Static IP Address (Windows Host Override)

WSL 2 Static IP Address (Windows Host Override)

A crude, but effective solution for hosting local development projects inside WSL 2.

before you start

  • node js is required
  • ⚠️ this script changes your host file - save a copy of your host file before use

Steps

@bernhardkaindl
bernhardkaindl / reinstall-with-fresh-debian.sh
Last active October 23, 2023 18:14
Reinstall Oracle Cloud Instance with Debian 12
Reinstaller for Debian: https://github.com/bohanyang/debi
wget -O debi.sh https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh
chmod a+rx debi.sh
./debi.sh --ssh-port 543 --hostname HostName --user bkaindl --password PASS --ethx --bbr --cloud-kernel --timezone Europe/Vienna
reboot -f
# Source:
# https://lowendtalk.com/discussion/171061/oracle-cloud-free-tier-reinstalling-of-os
# until ssh -v $host.kaindl.dev;do sleep 10;done
# Afterwards:
sudo apt install unattended-upgrades
@bernhardkaindl
bernhardkaindl / tutor-lms-change-default-course-base-slug
Created July 16, 2023 20:20 — forked from nayeemch/tutor-lms-change-default-course-base-slug
This code will help you to change base slug `courses` to your preferred slug, replace `example-course-slug` with your own slug.
add_filter('tutor_courses_base_slug', 'change_tutor_course_slug');
/**
* @param $slug
* @return string
*/
if ( ! function_exists('change_tutor_course_slug')){
function change_tutor_course_slug($slug){
$slug = 'example-course-slug';
return $slug;
@bernhardkaindl
bernhardkaindl / course-archive.php
Created July 13, 2023 16:13 — forked from creativeartbd/course-archive.php
Enable filter option on Docent Pro Theme - Currently, On the Docent Pro theme, the filter is not showing after enable the filter option from the tutor settings. Because there is no code available for the filter. So you may replace this file from this location: wp-contents/themes/docent-pro/tutor folder.
<?php
get_header();
get_template_part('lib/sub-header'); ?>
<div class="<?php tutor_container_classes() ?>">
<div class="tutor-archive">
<?php
$course_filter = (bool) tutor_utils()->get_option('course_archive_filter', false);
$supported_filters = tutor_utils()->get_option('supported_course_filters', array());
if ($course_filter && count($supported_filters)) {
@bernhardkaindl
bernhardkaindl / functions.php
Created July 13, 2023 16:12 — forked from creativeartbd/functions.php
Tutor LMS - Redirect user to lesson page directly
/*
On the Enrolled Course page, You can see all the enrolled courses, right? Now, if you click on the title of the course you will be redirected to the course page.
Okay, but if you want to redirect the user to the first lesson of any course then what? Well, use this code:
Go to wp-content/plugins/tutor/templates/dashboard/enrolled-courses.php at line number 39. Here you can see this code:
*/
$custom_url = home_url($post->post_type.'/'.$post->post_name);
@bernhardkaindl
bernhardkaindl / single-course.php
Created July 13, 2023 16:12 — forked from creativeartbd/single-course.php
Tutor LMS - Hide the content as well as the topic list for password protected course. So, go to wp-content/plugins/tutor/templates/single-course.php file and then replace all the code by this gist code.
<?php
/**
* Template for displaying single course
*
* @since v.1.0.0
*
* @author Themeum
* @url https://themeum.com
*
* @package TutorLMS/Templates
<?php /* Template Name: Tutor Advanced Course Filter */?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css">
<style>
:root{--tutor-major-color:#008CC9;--tutor-hover-color:#006fa0;--tutor-heading-color:#2A3235;--tutor-text-color:#6F7F86;--tutor-success-button-color:var(--tutor-major-color)}.tutor-sidebar-filter .single-filter{margin-bottom:25px;color:var(--tutor-heading-color)}.tutor-sidebar-filter .single-filter:last-child{margin-bottom:0}.tutor-course-col .tutor-course .tutor-loop-rating-wrap.no-rating .tutor-star-rating-group{color:#ddd}.tutor-sidebar-filter .single-filter label{display:block;cursor:pointer;transition:.3s}.tutor-sidebar-filter .single-filter label:hover{color:var(--tutor-major-color)}.tutor-sidebar-filter .single-filter label input{display:none}.tutor-sidebar-filter .single-filter label .filter-checkbox{height:17px;width:

Prepare CentOS 7.0 Server for LearningLocker (v1) LRS

Assumptions:

  • CentOS 7.0 x64 is installed (default install from DigitalOcean Droplet Manager)
  • Logged in via ssh key with root privileges
  • Using MongoDB as database

Install Remi Collet Repository:

yum install epel-release
@bernhardkaindl
bernhardkaindl / record-custom-post-type-in-buddyPress-activity.php
Created June 20, 2023 22:47 — forked from charleslouis/record-custom-post-type-in-buddyPress-activity.php
php - wordpress - buddy press - record custom post type in activity
/*============================================================
= record custom post types in activity =
============================================================*/
add_action( 'save_post', 'record_activity', 10, 2 );
function record_activity( $post_id, $post, $user_id = false ) {
global $bp, $wpdb;
$post_id = (int)$post_id;
@bernhardkaindl
bernhardkaindl / dwflmodtest.c
Created April 8, 2023 11:18
dwflmodtest.c Modifiled to use dwfl_report_elf() to get debug info for other elf files
/* Test program for libdwfl basic module tracking, relocation.
Copyright (C) 2005, 2007 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
elfutils is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the