This file contains 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
function Get-ScriptPath { | |
$scritDir = Get-Variable PSScriptRoot -ErrorAction SilentlyContinue | ForEach-Object { $_.Value } | |
if (!$scriptDir) { | |
if ($MyInvocation.MyCommand.Path) { | |
$scriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent | |
} | |
} | |
if (!$scriptDir) { | |
if ($ExecutionContext.SessionState.Module.Path) { | |
$scriptDir = Split-Path (Split-Path $ExecutionContext.SessionState.Module.Path) |
This file contains 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
// from: http://stackoverflow.com/questions/2226920/how-to-monitor-clipboard-content-changes-in-c | |
/// <summary> | |
/// Provides notifications when the contents of the clipboard is updated. | |
/// </summary> | |
public sealed class ClipboardNotification | |
{ | |
/// <summary> | |
/// Occurs when the contents of the clipboard is updated. | |
/// </summary> |
This file contains 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
# to add a new Git credential to the Credential Manager: | |
cmdkey /generic:LegacyGeneric:target=git:https://github.com /user:username /pass:"mypassword" | |
# to list all credentials: | |
cmdkey /list |
This file contains 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
from pprint import pprint | |
import jinja2 | |
import markdown | |
HTML_TEMPLATE = """{% macro get_html() %} | |
{{ content | markdown }} | |
{% endmacro %} | |
{% set html_content = get_html() %} | |
Title from Markdown meta-data: {{ get_title() }} |
This file contains 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
# Determine wireless device model (manufacturer 14e4 for Broadcom): | |
lspci -vvnn | grep 14e4 | |
# Install Broadcom STA driver for BCM43227: | |
sudo apt-get update | |
sudo apt-get install --reinstall linux-headers-generic build-essential dkms bcmwl-kernel-source | |
sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma | |
sudo modprobe wl | |
# Connect (press Fn+F3 to enable wifi if necessary first): |
This file contains 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
# Enable RDP on host: | |
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name fDenyTSConnections -Type DWord -Value 0 | |
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes | |
# Get sublime text editor: | |
$c=new-object Net.WebClient | |
$c.DownloadFile('http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20Build%203047%20x64%20Setup.exe',"$env:TEMP\sublime.exe") | |
cd $env:TEMP | |
.\sublime.exe /SILENT |
This file contains 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
# Combine multiple images into one. | |
# | |
# To install the Pillow module on Mac OS X: | |
# | |
# $ xcode-select --install | |
# $ brew install libtiff libjpeg webp little-cms2 | |
# $ pip install Pillow | |
# | |
from __future__ import print_function |
This file contains 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
# Sometimes it's handy to create small anonymous objects instead of explicitly defining a class for it, especially while prototyping. | |
def new(name, data): | |
return type(name, (object,), data) | |
person = new('Person', { 'name': 'Joe', 'age': 30 }) | |
print(person.name) |
This file contains 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
import logging | |
import datetime | |
import time | |
from dateutil import tz | |
import matplotlib.pyplot as plt | |
import pytz | |
import requests | |
logging.captureWarnings(True) |
This file contains 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
[ | |
{ | |
"description": "All fine", | |
"code": 0, | |
"name": "CURLE_OK", | |
"long_description": "All fine. Proceed as usual.\n" | |
}, | |
{ | |
"description": "The URL you passed to libcurl used a protocol that this libcurl does not support", | |
"code": 1, |
NewerOlder