Skip to content

Instantly share code, notes, and snippets.

View ayumi's full-sized avatar
🍅
ᕕ( ᐛ )ᕗ

ayumi  yu ayumi

🍅
ᕕ( ᐛ )ᕗ
View GitHub Profile
@ayumi
ayumi / xen-cpu-usage.sh
Created December 12, 2017 22:29
Shell script to calculate Xen aggregate VM CPU usage.
#!/bin/sh
# Calculate aggregate VM CPU usage as integer percentage (eg 42).
# Denominator for awk division is 4 for 4 vCPUs -- change if needed.
xentop -b -d 1 -i 2 | tac | sed '/MAXMEM/,$d' | tr -s ' ' | sed -e 's/^[ \t]*//' | cut -d ' ' -f 4 | awk '{s+=$1} END {printf "%.0f", int(s/4)}'
@ayumi
ayumi / toggle-yubikey.sh
Created December 6, 2017 06:02
Qubes script to make Yubikey OpenPGP smart cards easier to use.
#!/bin/bash
# Based on https://micahflee.com/2016/12/qubes-tip-making-yubikey-openpgp-smart-cards-slightly-more-usable/
# Detach only:
# ./toggle-yubikey.sh
# (Detach &&) Attach:
# ./toggle-yubikey.sh {vm-attachment-target}
YUBIKEY=`qvm-usb | grep Yubikey`
if [ -z "$YUBIKEY" ]; then
@ayumi
ayumi / compare-bookmarks.rb
Created July 12, 2017 20:28
Compare/Diff bookmark export HTML files in netscape formats
#!/usr/bin/env ruby
# Take 2 bookmark HTML files in netscape format, and look for differences.
# Doesn't compare hierarchy.
# Requirements: Ruby 2.x; oga ruby gem (gem install oga)
# License: MPL 2.0
HELP_MSG = "Usage: compare-bookmarks.rb [Bookmarks HTML 1] [Bookmarks HTML 2]".freeze
# HTML parser
@ayumi
ayumi / keybase.md
Created January 21, 2017 08:23
yay

Keybase proof

I hereby claim:

  • I am ayumi on github.
  • I am ayumi (https://keybase.io/ayumi) on keybase.
  • I have a public key whose fingerprint is A228 677C C0A8 FE93 E269 5657 7C92 009E A07E 2468

To claim this, I am signing this object:

@ayumi
ayumi / process_chromium_net_error_list.rb
Last active November 8, 2016 05:35
chromium net_error_list.h -> js
#!/usr/bin/env ruby
/* 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/. */
# net_error_list.h
# https://cs.chromium.org/chromium/src/net/base/net_error_list.h?sq=package:chromium
path = ARGV[0] or (puts "Usage: Pass path to net_error_list.h."; exit)
@ayumi
ayumi / portable-rainbow-digispark-light-ws2812
Last active December 22, 2015 06:51
portable rainbow (digispark + light_ws2812)
// Dependency:
// light_ws2812
// https://github.com/cpldcpu/light_ws2812
// ---
// if you have USB 3.0 ports, you might need a USB 2.0 hub to program this.
// use the cRGB struct hsv method
#define USE_HSV
@ayumi
ayumi / gist:97596b2efd32c5943126
Created December 2, 2015 16:52
LiPo battery long term storage
http://www.helifreak.com/showthread.php?t=170184
pgoelz
Rochester MI
I too have researched the subject of LiPo storage and now store my packs in a small refrigerator when not in use. I make sure they are no more than 90% charged and try to store them 50% charged when possible.
Here is what I have found:
1. Cells degrade continuously from the day they are manufactured until the day they are considered dead. Rule of thumb seems to be about 3 years to 80% capacity UNDER IDEAL CONDITIONS and probably under 0.5C to 1C discharge conditions. This is the BEST you can expect.
@ayumi
ayumi / styles.less
Last active August 29, 2015 14:04
atom styles
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed.
*
* If you are unfamiliar with LESS, you can read more about it here:
* http://www.lesscss.org
*/

Keybase proof

I hereby claim:

  • I am ayumi on github.
  • I am ayumi (https://keybase.io/ayumi) on keybase.
  • I have a public key whose fingerprint is 6B51 6AC7 42C8 72A6 6741 AE46 27F8 26A3 4F8F 7DED

To claim this, I am signing this object:

/*
* sprockets doesn't play well with SASS, dont use the default directives!
* (this one is cool)
*= require_self
*/
@import "lib/**/*";
@import "variables/**/*";
@import "styles/**/*";