export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS
Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.
The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.
Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.
Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a
- Scaling k8s daemonset down to zero
kubectl -n kube-system patch daemonset myDaemonset -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
- Scaling up k8s daemonset
kubectl -n kube-system patch daemonset myDaemonset --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
Attach to a running process with
gdb -x trace-dyn-mem -p $PID
After every malloc
the returned value (the allocated address) will be read from the RAX (64 bits) register.
After every free
the last item in the backtrace (the free
itself) will be shown. With the libc6-dbg
package installed you can see the address passed as the first argument of free
.
# Install the toolchain | |
```bash | |
brew tap SergioBenitez/osxct | |
brew install x86_64-unknown-linux-gnu | |
``` | |
# this should get installed in: | |
# /opt/homebrew/Cellar/x86_64-unknown-linux-gnu/ | |
# Installing the macOS OpenSSL - if not already installed |
mkdir -p ~/.config && touch ~/.config/ssh-agent.pid
- Paste the contents of
ssh-agent-manage.sh
into your.bashrc
or.bash_profile
or similar killall -9 ssh-agent
- Start a new terminal session (note: old sessions will not see ssh-agent, only new ones)
This snippet, when included in .bashrc
, will ensure that your session has a working ssh-agent
with all your ssh keys loaded into it. It does this without creating separate ssh-agent
processes by:
CREATE TABLE | |
`testing.insert` (date DATE OPTIONS( description='date' ), | |
unique_visits INT64 OPTIONS( description='counts' )) | |
PARTITION BY | |
date | |
CLUSTER BY | |
unique_visits OPTIONS ( description="A table with a date partition", | |
labels=[("testing", | |
"data_is_great")], | |
expiration_timestamp=TIMESTAMP "2023-01-01 00:00:00 UTC" |
SELECT | |
date, | |
COUNT(DISTINCT(visitid)) as unique_visits | |
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*` | |
WHERE _table_suffix = '20170801' # use date_sub to programmatically select your table | |
GROUP BY date | |
ORDER BY date |
CREATE TEMP FUNCTION | |
PROPER(str STRING) AS (( | |
SELECT | |
STRING_AGG(CONCAT(UPPER(SUBSTR(w,1,1)), LOWER(SUBSTR(w,2))), ' ' | |
ORDER BY | |
pos) | |
FROM | |
UNNEST(SPLIT(str, ' ')) w | |
WITH |
DECLARE | |
SQLRUN STRING DEFAULT ''; | |
CREATE TEMP FUNCTION | |
ga4_firebase( key1 STRING, | |
params ARRAY <STRUCT <key STRING, | |
value STRUCT <string_value STRING, | |
int_value INT64, | |
float_value FLOAT64, | |
double_value FLOAT64 >>>) AS ( ( | |
SELECT |