This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: In order to change state, you need to run all three commands for the wanted state | |
# in given order to get the desired effect | |
# Charge battery, and use usb power to power phone (default state after powering up the phone) | |
chmod u+w /sys/class/power_supply/usb/charger_disable | |
echo 0 > /sys/module/pm8921_charger/parameters/disabled | |
echo 0 > /sys/class/power_supply/usb/charger_disable | |
# don't charge battery, but use usb power to power phone | |
chmod u+w /sys/class/power_supply/usb/charger_disable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
#include "myclass.h" | |
... | |
int main(int argc, char *argv[]) | |
{ | |
qmlRegisterType<myclass>("harbour.myapp.myclass", 1, 0, "myclass"); | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get purge virtualbox-5.0 | |
dpkg -i virtualbox-5.0_5.0.0-101573~Ubuntu~trusty_amd64.deb | |
VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.0.0.vbox-extpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! perl | |
# Store this file as /usr/lib/urxvt/perl/xkr-clipboard | |
# | |
# To enable, add to ~/.Xresources: | |
# | |
# URxvt.perl-ext-common: default,xkr-clipboard | |
# URxvt.iso14755: false | |
# URxvt.keysym.Shift-Control-C: perl:clipboard:copy | |
# URxvt.keysym.Control-Insert: perl:clipboard:copy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@namespace url(http://www.w3.org/1999/xhtml); | |
@-moz-document domain("twitter.com") { | |
.stream-item .promoted-tweet { | |
background: #ff9080; | |
} | |
/* you might like / in case you missed */ | |
.stream-item.has-recap, .stream-item.has-recap .stream-item { | |
background: #ccffdd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use utf8; | |
sub nonEmptyString($) { | |
my ($str) = @_; | |
return defined($str) && length($str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with | |
# the "auth" aka "certonly" subcommand | |
# convert certificate chain + private key to the PKCS#12 file format | |
openssl pkcs12 -export -out keystore.pkcs12 -in fullchain.pem -inkey privkey.pem | |
# convert PKCS#12 file into Java keystore format | |
keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks | |
# don't need the PKCS#12 file anymore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//$webrun_wrapped | |
shared void run() { | |
value cn = "foo.bar"; | |
print(cn[(cn.lastIndexWhere((Character ch) => ch == '.') else 0) ...]); | |
// vs | |
print(cn[(cn.lastIndexWhere((Character ch) => ch == '.') else 0)+1 ...]); | |
// vs | |
print(cn[ cn.lastIndexWhere((Character ch) => ch == '.') else 0 ...]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void hexdump(String s) { | |
value hexes = { for (ch in s) let (x = "_____" + formatInteger(ch.integer, 16)) x[x.size - 5 ...] }; | |
log.debug(hexes.fold("")((x,y) => x + y + " ")+ s); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ceylon.file { | |
Path, | |
Nil, | |
File, | |
createFileIfNil, | |
parsePath | |
} | |
import ceylon.logging { | |
Logger | |
} |