Skip to content

Instantly share code, notes, and snippets.

View kanru's full-sized avatar

Kan-Ru Chen kanru

View GitHub Profile
@kanru
kanru / ipdlgraph.py
Last active August 29, 2015 13:57
Output IPDL graph using graphviz dot format
#!/usr/bin/python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import ipdl
import sys
import os
def files_match(suffixes, topdir, excludes):
@kanru
kanru / csv2prop.py
Last active August 29, 2015 13:57
Convert Gaia l10n repository to a CSV file and convert back
#!/usr/bin/python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
import csv
def info(log):
#!/bin/sh
set -x
DBUS_NAME="org.freedesktop.login1"
DBUS_PATH="/org/freedesktop/login1"
DBUS_INTERFACE="org.freedesktop.login1.Manager"
DBUS_SIGNAL="PrepareForSleep"
INHIBITOR_PID=
install_background_inhibitor() {
@kanru
kanru / logserver.c
Created September 4, 2014 09:58
task tracer logserver
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
@kanru
kanru / diary-sync-ical.el
Created January 22, 2015 11:54
Sync icalendar to diary file
;;; diary-sync-ical.el --- Sync iCalendar to diary -*- lexical-binding: t; -*-
;; Copyright (C) 2015 Kan-Ru Chen (陳侃如)
;; Author: Kan-Ru Chen (陳侃如) <[email protected]>
;; Keywords:
;; This program 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
@kanru
kanru / yank-date-from-calendar.el
Last active August 29, 2015 14:14
yank-date-from-calendar.el
;; -*- lexical-binding: t -*-
(defun yank-date-from-calendar ()
(interactive)
(let ((date-string nil))
(set-transient-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map calendar-mode-map)
(define-key map (kbd "RET")
(lambda ()
@kanru
kanru / bugzilla.gs
Created February 7, 2017 11:04 — forked from wolph/bugzilla.gs
Bugzilla fetcher for google sheets
/**
* @fileoverview Provides the custom function BUGZILLA_TITLE and
* the helper functions that it uses.
*/
/**
* Runs when the add-on is installed.
*/
function onInstall() {
onOpen();
#!/bin/env python
import json
import sys
skipList = [
"BaseThreadInitThunk",
"CharPrevA",
"CsrAllocateMessagePointer",
"DispatchMessageW",
"DispatchMessageWorker",
#!/bin/env python
import json
import sys
import cmd
from colorama import Fore, Style
skipList = [
"BaseThreadInitThunk",
"CharPrevA",
"CsrAllocateMessagePointer",
@kanru
kanru / rss.xml
Created July 28, 2019 13:00
Example Zola RSS feed
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title></title>
<link>https%3A//example.com</link>
<description></description>
<generator>Zola</generator>
<language>en</language>
<atom:link href="https%3A//example.com/rss.xml" rel="self" type="application/rss+xml"/>
<lastBuildDate>Sun, 28 Jul 2019 00:00:00 +0000</lastBuildDate>