import requests | |
from json import dumps, loads | |
from msgpack import packb, unpackb | |
data = {'say': 'hello, world!'} | |
headers_msgpack = {'Content-Type': 'application/msgpack'} | |
headers_json = {'Content-Type': 'application/json'} | |
r = requests.post('http://localhost:8000/', data=packb(data), headers=headers_msgpack) | |
print(unpackb(r.content)) |
# Precondition: Git for Windows 2.9.0 + Windows 7, other version of Git for Windows & Windows XP and Windows 10 should also be supported | |
# In /etc/ssh/sshd_config, set UsePrivilegeSeparation to no | |
# You can also change other settings of SSHD like port in this file | |
# Generate key pairs | |
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -q -N "" | |
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -q -N "" | |
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -q -N "" | |
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -q -N "" |
/*The MIT License (MIT) | |
Copyright (c) 2016 Edward Rowe (@edwardlrowe) | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all | |
copies or substantial portions of the Software. |
extends Object | |
class_name ResourceUtils | |
# ResourceLoader is unreliable when it comes to cache. | |
# Sub-resources get cached regardless of the argument passed to load function. | |
# This is a workaround that generates a new file on a fly, | |
# while making sure that there is no cache record for it. | |
# This file is then used to load the resource, after which | |
# the resource takes over the original path. | |
static func load_fresh(resource_path : String) -> Resource: |
Git for Windows is bundled with "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\
is your /
directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git
, the mingw64
in this directory is your root).
If you go to that directory, you will find the typical linux root folder structure (bin
, etc
, lib
and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corrisponding directories.
Sometimes the windows binary have funny prefixes, so you should rename the exe file to the
#!/usr/bin/env python | |
# -*- coding: utf-8; mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- | |
# vim: fileencoding=utf-8 tabstop=4 expandtab shiftwidth=4 | |
"""User Access Control for Microsoft Windows Vista and higher. This is | |
only for the Windows platform. | |
This will relaunch either the current script - with all the same command | |
line parameters - or else you can provide a different script/program to | |
run. If the current user doesn't normally have admin rights, he'll be |