##AWK notes##
-
selective printing
awk '$2 ~ regex, { $1="", pring $0}'
If $2 = regex, then print the whole line but not $1
- convert a single line to multiple lines
##AWK notes##
selective printing
awk '$2 ~ regex, { $1="", pring $0}'
If $2 = regex, then print the whole line but not $1
import sys | |
import urllib | |
import urllib2 | |
import json | |
import logging | |
class GeonamesError(Exception): | |
def __init__(self, status): |
import argparse | |
import subprocess | |
from pathlib import Path | |
def find_files(src_root: Path, python3: Path): | |
not_py3_compatible = [] | |
for file in src_root.rglob('*.py'): | |
print(file.resolve()) |
from pyparsing import * | |
# By default, PyParsing treats \n as whitespace and ignores it | |
# In our grammer, \n is significant, so tell PyParsing not to ignore it | |
ParserElement.setDefaultWhitespaceChars(" \t") | |
def parse(input_string): | |
def convert_prop_to_dict(tokens): | |
"""Convert a list of field property tokens to a dict""" | |
prop_dict = {} |
#!/bin/bash | |
# WARNING ! THIS WAS WRITTEN A LONG TIME AGO (2018), IT MAY NOT BE RELEVANT ANYMORE | |
sudo apt-get install vnc4server ubuntu-desktop | |
sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal |
@ECHO OFF | |
REM Activate required Python v-environment for test execution | |
REM Uncomment next line and adjust NAME if you use "virtualenv" | |
REM and "virtualenvwrapper-win" | |
REM call workon NAME_OF_YOUR_VIRTUALENV | |
REM Clean up Results folder before you start! | |
REM /Q options ensures that no confirmation by user is required | |
REM Uncomment next line if you use a "Results" folder |
# A Tkinter calculator in a single Python *expression* | |
# See https://www.reddit.com/r/Python/comments/ojab0n/i_see_your_17_loc_calculator_and_i_raise_you_a/ | |
(tk := __import__("tkinter")) and (bt_draw := lambda k, c, l: (bt := tk.Button(w, text=k, command=lambda: bt_press(k), width=6)) and bt.grid(column=c, row=l)) and (update := lambda t: d.config(text=t)) and (bt_press := lambda k: update("") if k == "C" else update(d["text"][:-1]) if k == "<" else update(str(round(eval(d["text"]), 6))) if k == "=" else update(d["text"] + k)) and (w := tk.Tk()) and w.title("TKalc") or (d := tk.Label(w, text="")) and d.grid(column=0, row=0, columnspan=5) or [bt_draw(k, n%4 + 1, n//4 + 1) for n, k in enumerate("()C<789/456*123-.0=+")] and w.mainloop() |
import sys | |
from robotide.controller.chiefcontroller import ChiefController | |
from robotide.controller.commands import NullObserver | |
from robotide.controller.filecontrollers import DirectoryController | |
from robotide.namespace import Namespace | |
from robotide.spec.iteminfo import LibraryKeywordInfo | |
from robotide.usages.commands import FindUsages | |
def construct_chief_controller(datapath): |
from math import comb | |
from string import Template | |
guard = "[worker] (left >= {n} & ((queue >= {n} & K = {n}) | (queue = {n} & K > {n}))) ->" | |
# For n = 3, this should be | |
# p^3 + 3p^2(1-p) + 3p(1-p)^2 + (1-p)^3 | |
def actions_for(n): | |
base = "{prob}: (left' = left - {x}) & (queue' = queue - {x})" |
Moved, see VIM Cheatsheet