Skip to content

Instantly share code, notes, and snippets.

Runar Ingebrigtsen ringe

Block or report user

Report or block ringe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ringe
ringe / logcat
Created Aug 30, 2018
AudioBroadCast thread issue
View logcat
01-02 23:03:04.941 13664-13664/com.royalone.audiobroadcast E/MultiWindowProxy: getServiceInstance failed!
01-02 23:03:05.134 13664-13664/com.royalone.audiobroadcast A/MainActivity: initAudioManager
01-02 23:03:05.163 13664-13664/com.royalone.audiobroadcast A/WiredHeadsetOn =: aatrue
01-02 23:03:05.164 13664-13664/com.royalone.audiobroadcast A/AudioBroadCast: MainActivity onCreate
01-02 23:03:05.164 13664-13664/com.royalone.audiobroadcast A/MainActivity: turnOnAudioService
01-02 23:03:05.363 13664-13664/com.royalone.audiobroadcast E/WifiManager: mWifiServiceMessenger == null
01-02 23:03:05.442 13664-13664/com.royalone.audiobroadcast A/UPnPAudioService: onCreate
01-02 23:03:05.446 13664-13664/com.royalone.audiobroadcast A/UPnPAudioService: onStartCommand
01-02 23:03:05.805 13664-13664/com.royalone.audiobroadcast A/AudioBroadCast: UpnpService Connected
01-02 23:03:05.811 13664-13664/com.royalone.audiobroadcast E/WifiManager: mWifiServiceMessenger == null
@ringe
ringe / limited_visma_global.ps1
Last active Jun 16, 2017
Limit the number of processes
View limited_visma_global.ps1
# We only have a limited number of user licenses available for a given application
# So we execute the application through a script informing the user of the limit
# To reduce support requests, we tell the user who to talk to to release a license
# See also https://stackoverflow.com/q/1802127/1062276
# The executable we want to limit
$limited_app = "rg_cli.exe"
# Information about the limit
$app_name = "Visma Global"
@ringe
ringe / rdoc-field.vim
Last active Nov 20, 2016
Transform ActiveRecord db/schema.rb field lines to Rdoc list item with Vim
View rdoc-field.vim
" use :RDF after copying lines from db/schema.rb to the class documentation
" the command transforms db/schema.rb lines to RDoc formatted list item
command -range=% RDF <line1>,<line2>s/\s\+t\.\(\w\+\)\s\+"\(.*\)"\($\|,.*\)/# +:\2+ _\1_::/
@ringe
ringe / maximum_users.ps1
Created Jul 28, 2016
Maximum users of an application, limit license usage on Windows Terminal Server
View maximum_users.ps1
# name of procsess we are tracking
$limited_process = "notepad.exe"
# limit of instances we allow
$user_limit = 3
# Limit reached message and title
$message = "Too many users! They are:"
$title = "No more notepad"
@ringe
ringe / bid_worker.rb
Created Jul 15, 2015
A Mechanize based Sidekiq Worker that reports on new public sector bid announcements in Norway
View bid_worker.rb
# A Mechanize based Sidekiq Worker that reports on new bid announcements in Norway
#
# This is used in a Rails app with a Bid model for storing known bids,
# and a BidMailer to send bid announcements to an email.
#
class BidWorker
include Sidekiq::Worker
sidekiq_options unique: true
def perform
@ringe
ringe / README.md
Last active Aug 29, 2015
Prepare a Ubuntu 14.04 server for a rails app (with Norwegian support)
View README.md
@ringe
ringe / README.md
Last active Dec 10, 2019
KVM QCOW2 Live backup
View README.md

Live backup of KVM virtual machines

This script will let you make backups of live VMs running on KVM, using libvirt.

The backup job will suspend the VM for the time it takes to copy the RAM to disk.

Credits: Luca Lazzeroni

I've made some minor adjustments.

@ringe
ringe / editablepage.html
Created Jan 9, 2014
Combine Trumbowyg with RestInPlace. I had some difficulties extending RestInPlaceEditor.forms with the "trumbowyg" type. Mainly because the callbacks are not documented in Trumbowyg, I believe. I was not able to use the RestInPlace method _this.update(); but had to copy the code from restinplace.js and implement a custom ajax handling. This leav…
View editablepage.html
<div id=page_1 data-url=/pages/1><>
<h1 class="rest-in-place" data-attribute="title">Nord-Norges stØrste næringsmagasin</h1>
<div id=pagebody_1 class="pagebody" data-attribute="body" data-formtype="trumbowyg" tabindex=1>
<h1>mama</h1>
<p>written text</p>
</div>
<script>
$("#pagebody_1").restInPlace();
</script>
@ringe
ringe / logoff_sessions.ps1
Created Nov 21, 2013
Logg off all Citrix user session in PowerShell
View logoff_sessions.ps1
$timeout = 300
$message = "Please save your work. You will be logged off in "+ $timeout/60 +" minutes"
$sessions = @()
# Collect session IDs and warn users
query session | select-string "wdica" |
%{$_ -replace " {2,27}"," "} |
foreach {$_.ToString().split(" ")[3]} |
foreach {
$sessions += $_
@ringe
ringe / Export all Exchange mailboxes
Last active Dec 15, 2015
Say you want to export all your Exchange mailboxes to PST files, but would like to know which Active Directory "Windows" user names the mailboxes belongs to. Turns out it's not straightforward, unless there's something I don't get. First: Export a list of all AD users by their name, including their username - the one used in "DOMAIN\username", y…
View Export all Exchange mailboxes
# Then this in Exchange Management Shell
$Location = "\\server\pstexport"
New-Item -path $Location -name "migrate.txt" -type File -force
Add-Content "$Location\migrate.txt" "datasourceuser,destinationuser"
# Create a hash table of Exchange mailboxes
$mailboxes = @{}
Get-Mailbox | Select-Object name, alias |
ForEach-Object { $mailboxes.Add($_.name, $_.alias) }
You can’t perform that action at this time.