Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# -- coding: utf-8 -- | |
from win32api import * | |
from win32gui import * | |
import win32con | |
import sys, os | |
import struct | |
import time | |
class WindowsBalloonTip: |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/usr/bin/env python | |
""" | |
Very simple HTTP server in python (Updated for Python 3.7) | |
Usage: | |
./dummy-web-server.py -h | |
./dummy-web-server.py -l localhost -p 8000 | |
Send a GET request: |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
Installing CYGWIN with SSH | |
1) Download cygwin setup.exe from http://www.cygwin.com | |
- Execute setup.exe | |
- Install from internet | |
- Root directory: `c:\cygwin` + all users | |
- Local package directory: use default value | |
- Select a mirror to download files from | |
- Select these packages: | |
- editors > xemacs 21.4.22-1 | |
- net > openssh 6.1-p |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#!/usr/bin/env bash | |
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your API token is here: https://dash.cloudflare.com/profile/api-tokens | |
# Make sure the token is the Global token, or has these permissions: #zone:read, #dns_record:read, #dns_records:edit | |
# If you want to set the root domain instead of a subdomain, set SUBDOMAIN to "@" | |
# Step 2: Create an A record on Cloudflare with the subdomain you chose | |
# Step 3: Run "./ddns.sh -l" to get the zone_id and rec_id of the record you created. | |
# Fill in ZONE_ID and REC_ID below | |
# This step is optional, but will save you 2 requests every time you run this script | |
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating. |
People
:bowtie: |
😄 :smile: |
😆 :laughing: |
---|---|---|
😊 :blush: |
😃 :smiley: |
:relaxed: |
😏 :smirk: |
😍 :heart_eyes: |
😘 :kissing_heart: |
😚 :kissing_closed_eyes: |
😳 :flushed: |
😌 :relieved: |
😆 :satisfied: |
😁 :grin: |
😉 :wink: |
😜 :stuck_out_tongue_winking_eye: |
😝 :stuck_out_tongue_closed_eyes: |
😀 :grinning: |
😗 :kissing: |
😙 :kissing_smiling_eyes: |
😛 :stuck_out_tongue: |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.
Install Raspbian Jessie (2016-05-27-raspbian-jessie.img
) to your Pi's sdcard.
Use the Raspberry Pi Configuration tool or sudo raspi-config
to: