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 _warn(cls, func, *args, **kwargs): | |
warn("blah_class is deprecated - use BlahClass instead", DeprecationWarning) | |
return func(*args, **kwargs) | |
class blah_class(BlahClass): | |
@classmethod | |
def add_warnings(cls): | |
for attr_name, attr_value in BlahClass.__dict__.items(): |
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
curl -Ss 'thing:5001/facts?max_results=10000' | tee facts_response.json | jq '[._items[] | del(._created) | del(._links) | del(._updated) | del(._id) | del(._etag) ]' > facts_to_post.json | |
curl -H 'Content-Type: application/json' -X POST -d@facts_to_post.json http://localhost:5001/facts > post_facts.results | |
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
# https://pytest.org/latest/tmpdir.html | |
# http://py.readthedocs.org/en/latest/path.html | |
# Using in conftest.py | |
@pytest.fixture(autouse=True) | |
def a_tmp_filename(tmpdir): | |
p = tmpdir.join("filename") | |
p.write("some stuff\n") | |
return str(p) # str(p) returns the full pathname you can use with normal modules |
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
curl -sS -G --data- { "_id": { "$in": [ "55106b4797b4502d68776cb2","55106b4797b4502d68776cc4","55106b4797b4502d68776cc7","55106b4897b4502d68776cca","55106b4797b4502d68776cc1","55106b4897b4502d68776ccd","55106b4797b4502d68776cb5","55106b4797b4502d68776cb8","55106b4797b4502d68776cbb","55106b4797b4502d68776cbe" ]}} , { "name": {"$in": [ ]} }]}' http://localhost:5001/node_hateoas_off | jq '._items[] | .name' |
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
$a = (Get-Host).PrivateData | |
$a.ErrorForegroundColor = "Yellow" | |
# (new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex | |
import-module PsGet | |
install-module PsUrl | |
install-module PsReadLine | |
Set-PSReadlineOption -EditMode Emacs | |
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 was true for ubuntu 12.04 | |
mkdir -p ~/.rdesktop/keymaps | |
cd /usr/share/rdesktop/keymaps/ | |
cp en-us common ~/.rdesktop/keymaps/ | |
edit ~/.rdesktop/keymaps/common | |
change |
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
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3A,00,1D,00,1D,00,3A,00,00,00,00,00 | |
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
sys.stderr.write(open("/tmp/filename").read()) | |
cmdline = open("/proc/cmdline").read() | |
with open("/dev/blah","r") as f: | |
for l in f: # l in f means read each line | |
print l | |
try: | |
with open(FILENAME, 'w') as f: |
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
# SSH Agent Functions | |
# Mark Embling (http://www.markembling.info/) | |
# | |
# How to use: | |
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice) | |
# - Import into your profile.ps1: | |
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes] | |
# - Enjoy | |
# | |
# Note: ensure you have ssh and ssh-agent available on your path, from Git's Unix tools or Cygwin. |
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
#!/usr/bin/env python3 | |
import http.client | |
http.client.HTTPConnection.debuglevel = 0 | |
#import urllib.request | |
from urllib.request import Request, urlopen, HTTPCookieProcessor | |
from urllib.parse import urlencode | |
import argparse | |
import sys,os |