Skip to content

Instantly share code, notes, and snippets.

@niczero
niczero / vscode.md
Created May 13, 2023 08:22
VS Code tips

Key bindings

eg To add keybinding for jump-to-matching-element

  • Go to File > Preferences > Keyboard Shortcuts
  • enter: editor.emmet.action.matchTag
  • click on the result record
  • enter: ctrl+shift+5
  • once that's accepted (warning you of duplicates) right-click and select Change When Expression
  • enter: editorTextFocus
  • now go to some source window and test that ctrl+% can jump between elements, eg 'div' elements
@niczero
niczero / git.md
Created October 12, 2022 15:00
Handy Git

Comparing patches, eg after a cherry-pick:

git show $commit_hash | git patch-id --stable
@niczero
niczero / sonoff.md
Last active October 12, 2022 14:58
Set up Sonoff Basic R1 (with stock firmware) for DIY control
@niczero
niczero / what_we_need_from_a_job_queue.txt
Last active October 12, 2022 14:56
Introduction to Resque
From https://github.com/blog/542-introducing-resque
We are constantly overloaded and rely very, very heavily on our queue. If it’s
backed up, we need to know why. We need to know if we can fix it. We need
workers to not get stuck and we need to know when they are stuck.
We need to see what the queue is doing. We need to see what jobs have failed.
We need stats: how long are workers living, how many jobs are they processing,
how many jobs have been processed total, how many errors have there been, are
errors being repeated, did a deploy introduce a new one?
@niczero
niczero / bookmarks.md
Created February 12, 2021 09:01
Learn Python
@niczero
niczero / create_session.md
Last active January 25, 2019 13:53
Giving root access to non-root screen session
  1. Create a virtual user.
  2. Provide that user access to a screen window file.
  3. Create their screen session.
  4. Grant access for root.

Bonus 5. Create a vim session file.

Screen window file

eg /etc/screen.dev.lst for a development list of windows.

@niczero
niczero / rt_create_cpanfile.sh
Created December 5, 2017 12:58
Create a cpanfile for BestPractical RT
# make testdeps mistakenly uses system perl
# so we munge it
perl sbin/rt-test-dependencies --with-standalone 2>&1 \
| grep MISSING \
| perl -plE's/^\s+//; my $v = s/\s>=\s(\S+)// ? $1 : undef; s/\s.*$//; $_ = qq{requires \x27$_\x27}; $_ .= qq{ => $v} if $v; $_ .= q{;}'
@niczero
niczero / custom-event.js
Created July 28, 2017 09:44
Fix CustomEvent for older IE
(function () { // bootstrap CustomEvent for IE
if (typeof window.CustomEvent === 'function') return false;
function CustomEvent (event, params) {
params = params || {bubbles: false, cancelable: false, detail: undefined};
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
}
@niczero
niczero / dl.html.ep
Created April 20, 2017 13:19
Aligned Lists Without Tables
<div class="panel" id="source">
<dl class="control-list">
<dt>Source</dt>
<dd>
<div class="cell"><%= $info->{uri} // '' %></div>
<div class="cell"><a href="<%= url_for->query([eject => 1]) %>"><i class="fa fa-eject"></i></a></div>
</dd>
<dt>A Label That Overspills Its Meagre Allowed Space</dt>
<dd>
<div class="cell"><%= sprintf '%.1f', $info->{position} // 0 %></div>