start new:
tmux
start new with session name:
tmux new -s myname
#include "fixedp.h" | |
#include <iostream> | |
int main(int, char **) | |
{ | |
fixedp<true, 16, 16> x(0); //32-bit signed 16.16 fixed-point number | |
fixedp<false, 8, 8> y(10); //16-bit unsigned 8.8 fixed-point number | |
std::cout << (fixedp<false, 4, 4>(3.5) + fixedp<false, 4, 4>(4.5)).toFloat() << std::endl; | |
//prints "8" |
import os | |
descriptors = list() | |
def getString(): | |
test_file = "nvidia-smi -q --gpu=0 | tail -23" | |
try: | |
p = os.popen(test_file, 'r') | |
return p.read() |
# 0 is too far from ` ;) | |
set -g base-index 1 | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
#set -g default-terminal screen-256color | |
set -g status-keys vi | |
set -g history-limit 10000 |
import logging, time | |
from timer import timed | |
logger = logging.getLogger() | |
logger.setLevel(logging.DEBUG) | |
handler = logging.StreamHandler() | |
handler.setLevel(logging.DEBUG) | |
logger.addHandler(handler) |
chrome.windows.getAll({populate: true}, function(allWindows) | |
{ | |
console.log(allWindows); | |
}); |
#!/usr/bin/env bash | |
# | |
# This is sp, the command-line Spotify controller. It talks to a running | |
# instance of the Spotify Linux client over dbus, providing an interface not | |
# unlike mpc. | |
# | |
# Put differently, it allows you to control Spotify without leaving the comfort | |
# of your command line, and without a custom client or Premium subscription. | |
# |
This uses sh
package. Install it using pip
.
$ (sudo )pip install sh
Then place this script with the name imgur
in some location that's in your PATH
, chmod +x
the file and upload like this
$ imgur ~/Pictures/Screenshot\ from\ 2013-10-06\ 20:01:32.png
import json, datetime | |
class RoundTripEncoder(json.JSONEncoder): | |
DATE_FORMAT = "%Y-%m-%d" | |
TIME_FORMAT = "%H:%M:%S" | |
def default(self, obj): | |
if isinstance(obj, datetime.datetime): | |
return { | |
"_type": "datetime", | |
"value": obj.strftime("%s %s" % ( |