Skip to content

Instantly share code, notes, and snippets.

View kartikm's full-sized avatar
🏠
Working from home

Kartik Mistry kartikm

🏠
Working from home
View GitHub Profile
function swat {
# open browser window (--new-tab will only target the new window in a separate command)
firefox \
--new-window https://wikitech.wikimedia.org/wiki/Deployments
firefox \
--new-tab https://logstash.wikimedia.org/app/kibana#/dashboard/Fatal-Monitor \
--new-tab https://logstash.wikimedia.org/app/kibana#/dashboard/mediawiki-errors \
--new-tab https://logstash.wikimedia.org/app/kibana#/dashboard/mwdebug1002 \
--new-tab https://integration.wikimedia.org/zuul/ \
--new-tab https://tools.wmflabs.org/versions/
@JPvRiel
JPvRiel / journalctl_enable_persistent_storage.md
Last active September 11, 2024 01:18
Enable persistent storage for the systemd journal log

Enable persistent storage for the systemd journal log

Overview

The assumed default setting in /etc/systemd/journald.conf is Storage=auto which implies that systemd journaling will only persist the journal if the expected storage location is available. Otherwise, the journal data is stored in memory and lost between reboots. On Ubuntu 16.04, /var/log/journal does not exist by default. Create it to keep and query events from previous boots.

Considerations:

  • Syslog still provides the persistant log records for Ubuntu 16.04, so enabling persistant systemd journal logging does cause a level of duplicaiton.
  • There are sane defaults:
@santhoshtr
santhoshtr / uls-woff2.sh
Created May 3, 2016 05:42
ULS webfonts to woff2
fontInfos=$(find ../data -name 'font.ini')
#for f in $fontInfos; do sed -i -n 'p; s/woff/woff2/gp' $f; done
# Change to point to your fonts directory as needed
ttfs=$(find ../data -name '*.ttf')
# Create .woff2 versions of your ttf files
#for f in $ttfs; do woff2_compress $f || { echo "Fail on $f"; exit 1; }; done
woff2s=$(find ../data -name '*.woff2')
for f in $woff2s; do git add $f || { echo "Fail on $f"; exit 1; }; done
@svs
svs / gist:7fc59be7b4b0cc68b699
Last active August 1, 2019 10:39
Too Many `a`s (with apologies to Dr Seuss)
(Original here http://www.poetryfoundation.org/poem/171612)
Did I ever tell you that Programmer McCave
Had twenty-three variables and he named them all `a`
Well, he did. And that wasn't a smart thing to do.
You see, when he wants wants to add `a` to 2
He doesn't get a number oh no no no
All twenty-three `a`s cause a buffer overflow
@santhoshtr
santhoshtr / record-window-gif.sh
Created September 19, 2014 04:59
Record a window as GIF using byzanz
#!/bin/bash
# Delay before starting
DELAY=10
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg &
}
console.highlight = function(text, sample) {
var escapedSample = sample.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
var reSample = new RegExp(escapedSample, 'g');
var args = [''];
var highlightedText = text.replace(reSample, function(match) {
args.push('background-color: #ffc', 'background-color: none');
return '%c' + match + '%c';
});
args[0] = highlightedText;
console.log.apply(console, args);
@santhoshtr
santhoshtr / .jsbeautifyrc
Created March 30, 2014 05:06
jsbeautifyrc for Mediawiki javascript coding convention
{
"preserve_newlines": true,
"jslint_happy": true,
"keep_array_indentation": true,
"space_before_conditional": true,
"max_preserve_newlines": 10,
"brace_style": "collapse",
"keep_function_indentation": false,
"break_chained_methods": false,
"eval_code": false,
@santhoshtr
santhoshtr / Webfonts.md
Last active August 10, 2016 08:01
Webfonts

Webfonts

Wikimedia wikis are available in around 300 languages. And the content in these wikis is a lot more than that. English wiki receives most of the traffic. But in English wiki also there are wiki pages with content fragments written in non-latin languages. Apart from wikipedia, sister projects like Wiktionary, Wikisource are also largely multilingual.

Latin script based languages does not face any serious issues with the availability of fonts in users computers to read content. But non-latin languages often face issues with reading content when the operating system does not have fonts or the fonts in the operating system is not upto date, bug free or aesthetically good.

Non-latin wiki pages often have a banner at the top of the page(Eg: See Malayalam wikipedia) asking people to visit a help page if they face reading issues. The help page contains download links to fonts and installation instruction for different operating systems.

For many languages, if the opera

@samyakbhuta
samyakbhuta / merge-subsets.pe
Created November 14, 2013 12:20
Merge Subset of the font using Fontforge Native Script.
#!/usr/local/bin/fontforge
# Usage :
# ./merge-subsets.pe MyFont.ttf SubsettedGlyphs.ttf.subset
# This will create NewMyFont.ttf.
Open($1)
MergeFonts($2)
Generate("New" + $1:r + ".ttf")
@samyakbhuta
samyakbhuta / JavascriptReferences.md
Last active June 1, 2018 00:42
#javascript #reference