Skip to content

Instantly share code, notes, and snippets.

View adam-stokes's full-sized avatar
🦧

Adam Stokes adam-stokes

🦧
  • North Carolina
  • 09:36 (UTC -04:00)
View GitHub Profile
@adam-stokes
adam-stokes / linode.css
Created November 29, 2013 00:15
stylish css for linode admin
* { font-family: 'Ubuntu', 'Droid Sans'; }
.header { background-color: #000; color: #fff; }
.header_logo { font-family: 'Ubuntu'; }
.header_tabs a, #subtabs a { font-family: 'Ubuntu'; }
#page { width: 90%; }
@adam-stokes
adam-stokes / websocket.pl
Created February 12, 2014 00:41
connect to websocket
#!/usr/bin/env perl
use Mojo::UserAgent;
my $endpoint = 'wss://10.0.3.1:17070/';
my $ua = Mojo::UserAgent->new;
$ua->websocket(
$endpoint => sub {
my $tx = pop;
@adam-stokes
adam-stokes / websocket2.pl
Created February 12, 2014 01:13
websocket2
#!/usr/bin/env perl
use Mojo::Transaction::WebSocket;
use DDP;
my $endpoint = 'wss://10.0.3.1:17070/';
my $ws = Mojo::Transaction::WebSocket->new(
remote_address => '10.0.3.1',
remote_port => '17070',
@adam-stokes
adam-stokes / websocket-wss.py
Created February 12, 2014 01:25
python websocket over wss
#!/usr/bin/python3
from ws4py.client.threadedclient import WebSocketClient
from pprint import pprint
import json
params = {}
params['Type'] = "Admin"
params['Request'] = 'Login'
params['RequestId'] = 1
@adam-stokes
adam-stokes / websocket3.pl
Created February 12, 2014 02:12
mojo::useragent websocket
#!/usr/bin/env perl
use strict;
use warnings;
use Mojo::Base -base;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
$ua->websocket(
'wss://10.0.3.1:17070' => sub {
my ($ua, $tx) = @_;
@adam-stokes
adam-stokes / websocket4.pl
Created February 12, 2014 02:29
websocket4
-- Non-blocking request (https://10.0.3.1:17070)
-- Switching to non-blocking mode
-- Connect (https:10.0.3.1:17070)
-- Client >>> Server (https://10.0.3.1:17070)
GET / HTTP/1.1
Connection: Upgrade
Content-Length: 0
Host: 10.0.3.1:17070
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: IDg2NzkxMDkxNDU2MjA2MA==
(use-package py-autopep8
:config
(add-hook 'before-save-hook 'py-autopep8-before-save))
@adam-stokes
adam-stokes / install-some-shit.sh
Last active August 29, 2015 14:06
install some shit
#!/bin/bash
sudo apt-update
sudo apt-get install -qyf git ubuntu-dev-tools emacs24
# pyenv
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
# install pyenv virtualenv
git clone git://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
@adam-stokes
adam-stokes / cpanfile
Created September 16, 2014 02:18
perl deps
# download this file and run
# cpanm --installdeps .
requires "App::cpanminus" => "0";
requires "Mojo::UserAgent" => "0";
requires "strict" => "0";
requires "warnings" => "0";
requires "App::Ack" => "0";
requires "App::Cmd" => "0";
requires "App::Cronjob" => "0";
def run(self):
if os.path.exists(self.container_abspath):
log.error("Container exists, exiting.")
# Container exists, handle return code in installer
sys.exit(1)
self.ui.info_message(
"* Please wait while we generate your isolated environment ...")
utils.ssh_genkey()
self.prep_userdata()