This file contains hidden or 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
#!/bin/bash | |
echo -ne "Changing stop charge threshold from " | |
cat /sys/devices/platform/smapi/BAT0/stop_charge_thresh | tr -d "\n" | |
sudo sh -c "echo $1 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh" | |
echo -ne " to " | |
cat /sys/devices/platform/smapi/BAT0/stop_charge_thresh |
This file contains hidden or 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
{ | |
"comment": [ | |
"#" | |
], | |
"extension": [ | |
"coffee" | |
], | |
"definition": [ | |
"class" | |
], |
This file contains hidden or 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
from riakkit import DictProperty, BaseProperty | |
import markdown | |
from lxml.html.clean import Cleaner | |
_cleaner = Cleaner(add_nofollow=True, style=True) | |
_markdown = markdown.Markdown(safe_mode="escape") | |
class MarkdownProperty(BaseProperty): | |
class MD(DictProperty.DotDict): | |
def get(self, markdown): |
This file contains hidden or 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
var relative_time = function(timestamp, relative_to) { | |
if (timestamp === null || timestamp === undefined) | |
return ""; | |
var delta, relative_is_future, t; | |
if (!relative_to) | |
relative_to = parseInt(new Date().getTime() / 1000); | |
if ($.type(timestamp) !== "number") |
This file contains hidden or 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
# This has been deprecated. Use https://github.com/shuhaowu/awesome-statusmsg instead | |
window["statusmsg"] = statusmsg = {} | |
# statusmsg = namespace "statusmsg" | |
# I use my own namespace function from coffeecrispt so not sure how well that first line works. | |
# To use, do statusmsg.setup() at document load | |
# Then you can do statusmsg.display("Your text") and close via statusmsg.close() | |
set_human_msg_css = (msgbox) -> |
This file contains hidden or 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
def merge_range_sorted(r): | |
"""Merges and sorts a range of numbers. Used for block merging. | |
Worse-case runtime: | |
O(n) | |
Args: | |
r: A **sorted**, from low to high, list of ranges in a tuple format. | |
Returns: |
This file contains hidden or 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
from __future__ import division | |
from math import sqrt, log, pi, cos, sin, expm1 | |
_a1 = -3.969683028665376e+01 | |
_a2 = 2.209460984245205e+02 | |
_a3 = -2.759285104469687e+02 | |
_a4 = 1.383577518672690e+02 | |
_a5 = -3.066479806614716e+01 | |
_a6 = 2.506628277459239e+00 | |
_b1 = -5.447609879822406e+01 |
This file contains hidden or 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 riak | |
import multiprocessing | |
keys = [] | |
c = riak.RiakClient() | |
for b in c.get_buckets(): | |
k = [(b.name, key) for key in b.get_keys()] | |
keys.extend(k) |
This file contains hidden or 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
from fabric.api import run | |
def check_apt(): | |
apt_sha = "cfd9d742f7c99d55214257fdad42ead547547c5a05af9d4569a256205af28fa7" | |
result = run("sha256sum /var/cache/apt/archives/apt_0.9.7.9+deb7u3_amd64.deb") | |
if apt_sha in result: | |
print "Everything is okay" | |
else: | |
print "Potential attack?" |
This file contains hidden or 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
#!/bin/bash | |
set -e | |
PROJECT=$1 | |
PPA_ID=$2 | |
if [ -z $PROJECT ] || [ -z $PPA_ID ]; then | |
>&2 echo "usage: ./release.sh directory ppa_id" | |
exit 1 |
OlderNewer