https://stackoverflow.com/questions/35252285/insert-text-with-sed-on-the-same-line-that-pattern-search sed 's/\blocalhost\b/& 192.168.25.50/' file
sed -i "/export TOP=/c export TOP="${TOP}"" *.sh
| #!/bin/bash | |
| set -euo pipefail | |
| # readonly SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" | |
| SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" | |
| function process() { | |
| python - << END_OF_PY_CODE | |
| import os |
https://stackoverflow.com/questions/35252285/insert-text-with-sed-on-the-same-line-that-pattern-search sed 's/\blocalhost\b/& 192.168.25.50/' file
sed -i "/export TOP=/c export TOP="${TOP}"" *.sh
| # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=816533 | |
| # start at server side(ssh) | |
| xpra start --no-daemon --xvfb="/usr/bin/Xvfb +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset" --start=/usr/bin/code |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import os | |
| import sys | |
| class FSO(object): | |
| import win32com.client as com | |
| import pywintypes |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import os | |
| def happy_number(val): | |
| nums = [] | |
| nums.append(val) | |
| while True: |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import BaseHTTPServer | |
| import SimpleHTTPServer | |
| import argparse | |
| import socket | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-b', action='store', dest='host', |
| def check_string(s): | |
| mstack = [] | |
| bFind = False | |
| matches = {')': '(', '}': '{', ']': '['} | |
| for c in s: | |
| if c in matches.values(): | |
| bFind = True | |
| mstack.append(c) | |
| elif c in matches.keys(): | |
| if len(mstack) == 0 or mstack[-1] != matches[c]: |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import os | |
| def maxsum(arr): | |
| # maxsum, start, end: | |
| result = [arr[0], 0, 0] | |
| curr = [0, 0, 0] | |
| for i in range(0, len(arr)): |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #define BITS_PER_LONG (sizeof(long) * 8) | |
| #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) | |
| #define OFF(x) ((x)%BITS_PER_LONG) | |
| #define BIT(x) (1UL<<OFF(x)) | |
| #define LONG(x) ((x)/BITS_PER_LONG) | |
| #define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) | |
| #define FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) |
| #!/bin/bash | |
| #usage: | |
| # $source setclocks.sh | |
| # $setxxfreq .. | |
| #set -x | |
| function setcpufreq() | |
| { | |
| if [ -z $1 ]; then | |
| echo "usage:setcpufreq <CPUFREQ in kHz>|max [ONLINECPUS](default 4)" | |
| echo "e.g: setcpufreq max or setcpufreq max 2" |