As configured in my dotfiles.
start new:
tmux
start new with session name:
As configured in my dotfiles.
start new:
tmux
start new with session name:
from wsgiref.simple_server import make_server, WSGIServer | |
from SocketServer import ThreadingMixIn | |
from time import sleep | |
def simple_app(env, start_response): | |
status = '200 OK' | |
headers = [('Content-type', 'text/plain')] | |
start_response(status, headers) |
This is a little trick I use to spin up the packages instalation on Debian/Ubuntu boxes in Vagrant.
I add a simple function that checks if a directory named something similar to ~/.vagrant.d/cache/apt/opscode-ubuntu-12.04/partial
(it may have another path in Windows or MacOS) and create the directory if it doesn't already exist.
def local_cache(basebox_name)
cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)
partial_dir = cache_dir.join('partial')
partial_dir.mkdir unless partial_dir.exist?
cache_dir
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
import com.google.gson.Gson; | |
import model.GameState; | |
import model.GameStateProvider; | |
import org.eclipse.jetty.websocket.api.WebSocketAdapter; | |
import java.io.IOException; | |
/** | |
* Example EchoSocket using Adapter. | |
*/ |
package spark; | |
import org.eclipse.jetty.servlet.ServletContextHandler; | |
public class WebSocketExample | |
{ | |
public static void main(String[] args) | |
{ | |
setupSpark(); | |
Spark.get("/", (request, response) -> "Hello"); |
#include <system_error> | |
#include <windows.h> | |
/// Wrap the Win32 error code so we have a distinct type. | |
struct win32_error_code | |
{ | |
explicit win32_error_code(DWORD e) noexcept : error(e) {} | |
DWORD error; | |
}; |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
Status page | |
curl 'http://192.168.100.1/snmpGet?oids=1.3.6.1.4.1.4115.1.3.4.1.5.9.0;1.3.6.1.4.1.4115.1.3.3.1.1.1.3.1.0;1.3.6.1.4.1.4491.2.1.14.1.5.4.0;1.3.6.1.4.1.4115.1.20.1.1.1.7.1.3.1;1.3.6.1.2.1.10.127.1.1.5.0;1.3.6.1.2.1.126.1.1.1.1.1.2;1.3.6.1.2.1.69.1.4.5.0;&_n=21943&_=1515184469506' | |
Item Status Comments | |
Acquired Downstream Channel(Hz) 547000000 Locked | |
Ranged Upstream Channel(Hz) 39400000 Locked | |
Provisioning State Online | |
#!env sh | |
mac=C0:28:8D:00:2A:A8 | |
function ue_on() { | |
handle=0x0003 | |
value=b469218dd9e701 | |
gatttool -b $mac --char-write-req --handle=$handle --value $value | |
} |