Skip to content

Instantly share code, notes, and snippets.

======================
Proton: 1591366924 proton-5.0-8
SteamGameId: 1213210
Command: ['/home/steam/.steam/steam/steamapps/common/CnCRemastered/ClientLauncherG.exe']
Options: {'forcelgadd'}
======================
ERROR: ld.so: object '/home/steam/.steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/steam/.steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/home/steam/.steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/home/steam/.steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
@marxjohnson
marxjohnson / validation.php
Created June 10, 2019 08:04
Extract and validate zip file
$packer = new zip_packer();
if ($file) {
$itemid = $file->get_itemid();
$filepath = $file->get_filepath();
$filelist = $file->list_files($packer);
$numberoffiles = 0;
foreach ($filelist as $f) {
if (!$f->is_directory) {
$numberoffiles++;
}
@marxjohnson
marxjohnson / scroll.js
Created November 29, 2018 11:38
Fix inifinte scroll in Moodle app plugin
var views = this.NavController._views;
views.forEach(function(view) {
if (view.id === "CoreCourseSectionPage") {
view._cntDir.resize();
}
});
@marxjohnson
marxjohnson / classes_output_mobile.php
Created November 20, 2018 09:06
Course format core-context-menu-item example
<?php
namespace format_oustudyplan\output;
defined('MOODLE_INTERNAL') || die();
class mobile {
public static function mobile_course_view($args) {
global $OUTPUT;
@marxjohnson
marxjohnson / canary.sh
Last active August 16, 2018 20:14
UPS canary script
# Ping the specified host (argument $1). If it's not there, wait 30 seconds and try again.
# If its not there for 2 minutes, do a clean shutdown.
# The host should be connected to the nextwork and plugged into a socket that's not backed up by the UPS.
# This should be run on a host that is backed up by the UPS, on a cron job.
tail -c 10000 /var/log/canary.log > /var/log/canary.log
REBOOT=true
for e in a b c d
do
sleep 30
if ping -c1 $1
@marxjohnson
marxjohnson / upyours.rb
Last active July 11, 2017 17:16
Ubuntu Podcast of Yesteryear Original Unit Reproduction Script
# Usage: upyours.rb episode1.mp3 episode2.mp3 jingle.mp3 outputfile.mp3
# License: https://opensource.org/licenses/MIT
duration = `ffprobe -v 0 -show_entries format=duration -of compact=p=0:nk=1 #{ARGV[0]}`.to_f # Get the duration of the first file
fingerprint = `fpcalc #{ARGV[2]} -length 10 -raw`.lines[2].split('=')[1].split(',') # Get the fingetprint of the third file
$lt1000 = false # Set a flag
$discrepencies = Hash.new() # Store discrepencies for each clip
((duration.to_i*10-(90*10))..(duration.to_i*10)).each do | offset | # Scan through the last 90 seconds of the episode, in 1/10s intervals
pos = (offset.to_f / 10) # Caluclate the starting position of the clip
`ffmpeg -y -t 10 -ss #{pos} -i #{ARGV[0]} /tmp/testclip.mp3 > /dev/null 2>&1` # Get a 10 second clip from the starting position
testprint = `fpcalc /tmp/testclip.mp3 -length 10 -raw`.lines[2].split('=')[1].split(',') # Get the fingerprint of the clip
@marxjohnson
marxjohnson / disc_script.sh
Last active November 27, 2016 21:22
Kodi Blu-Ray playback
#!/bin/bash
# Kill any existing streams
killall makemkvcon
# Display a notification while MakeMKV scans the disc
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Loading","message":"Scanning disc, please wait...", "displaytime": 30000},"id":1}' http://localhost:8080/jsonrpc
makemkvcon stream dev:/dev/sr0 &
# Wait until port 51000 has a service running on it (this is the port MakeMKV uses for the UPnP share).
while [ -z "$(netstat -a | grep 51000)" ]
do
sleep 1
@marxjohnson
marxjohnson / latitude.js
Last active April 14, 2016 17:36
Ubuntu podcast latitude script
(function(){
var map = document.getElementById('map');
var error = document.getElementById('error');
var urlstub = "http://www.openstreetmap.org/export/embed.html?";
function updateMap() {
var request = new XMLHttpRequest();
request.open('GET', 'latitudefile.txt', true);
request.onload = function() {
@marxjohnson
marxjohnson / psd.conf
Created June 11, 2015 10:42
Profile sync daemon Upstart Session Job
description "Profile Sync Daemon"
start on desktop-start
stop on desktop-end
post-start exec sudo /usr/bin/psd sync
post-stop exec sudo /usr/bin/psd unsync
@marxjohnson
marxjohnson / remove-old-kernels.sh
Last active May 27, 2021 11:54
Delete old kernel on debian/ubuntu
#!/bin/bash
# 1. Find all the packages that have installed something in /boot
# 2. Trim it down to just the kernel packages (e.g. remove memtest)
# 3. Sort them oldest->newest
# 4. Remove the newest (so we've got the updated kernel to boot into)
# 5. Remove the current kernel (so we can go back to that if the new one fails)
# 6. Pass the package list to apt-get remove for uninstallation
# Note: This code will only simulate removal. Remove -s flag from apt-get to do it for real.