Skip to content

Instantly share code, notes, and snippets.

@zhutony
zhutony / m1-max-numpy-setup.md
Created May 19, 2023 18:57 — forked from MarkDana/m1-max-numpy-setup.md
Install NumPy on M1 Max

How to install numpy on M1 Max, with the most accelerated performance (Apple's vecLib)? Here's the answer as of Dec 6 2021.


Steps

I. Install miniforge

So that your Python is run natively on arm64, not translated via Rosseta.

  1. Download Miniforge3-MacOSX-arm64.sh, then
  2. Run the script, then open another shell
$ bash Miniforge3-MacOSX-arm64.sh

CSC 2/458, 4-11 Feb. 2008

Moir & Shavit, Herlihy & Shavit


combining trees scale but poor latency under low load blocking counting networks get rid of the blocking problem diffracting trees are basically counting networks that use randomization

@zhutony
zhutony / spotihosts
Created April 20, 2022 03:22
The hosts file entries to block Spotify audio ad servers.
127.0.0.1 media-match.com
127.0.0.1 adclick.g.doublecklick.net
127.0.0.1 www.googleadservices.com
127.0.0.1 open.spotify.com
127.0.0.1 pagead2.googlesyndication.com
127.0.0.1 desktop.spotify.com
127.0.0.1 googleads.g.doubleclick.net
127.0.0.1 pubads.g.doubleclick.net
127.0.0.1 audio2.spotify.com
127.0.0.1 www.omaze.com
@zhutony
zhutony / jsonpath.md
Created April 5, 2022 20:34 — forked from navicore/jsonpath.md
for getting multiple fields from kubectl via jsonpath

get name and image and startTime

kubectl get pods -ao jsonpath='{range .items[*]}{@.metadata.name}{" "}{@.spec.containers[*].image}{" "}{@.status.phase}{" "}{@.status.startTime}{"\n"}{end}'| grep track
@zhutony
zhutony / client.rs
Created March 7, 2022 21:54 — forked from Geal/client.rs
Rust and Unix domain sockets usage example * stream sockets (client.rs and server.rs) * datagram sockets (datagram_client.rs and datagram_server.rs) * example of writing to syslog (incomplete for now)
extern mod native;
use std::io::net::unix::UnixStream;
use std::path::posix::Path;
use std::str;
use std::rt::rtio::IoFactory;
use native::io;
fn main() {
@zhutony
zhutony / unix_socket_datagram_stream_rust.md
Created March 7, 2022 21:21 — forked from gistub/unix_socket_datagram_stream_rust.md
Rust: Unix Domain Socket (bidirectional)

To create a bidirectional unix IPC:

  1. Server creates a sockets and binds it to an address (typically a file). Do NOT use connect as all send/recv operation will be done using connect's address!
  2. Client creates a socket and binds it to its own address. However the socket connects to the address of server.
  3. Server uses recv_from to get data from socket along side with the address of the client that sent the data. This way it can use the address to send a response back to client.

Example in Rust

server.rs

@zhutony
zhutony / 0 - setup
Created February 13, 2022 18:04 — forked from aserhat/0 - setup
QEMU and HVF
# Summary
A few notes I took to see if I could use MacOS as Hypevirsor in a similar fashion to Linux
I wanted to see how few addons were needed instead of using Parallels, Virtual Box, VM Fsion etc.
The idea is to use QEMU, Hypervisor Framework (https://developer.apple.com/documentation/hypervisor) and some custom host networking.
# Installations
brew install qemu (For controlling Hypervisor Framework)
brew install cdrtools (For making cloud init iso's)
http://tuntaposx.sourceforge.net/download.xhtml (For customer tap based networking)
@zhutony
zhutony / qemu-networking.md
Created September 26, 2021 04:51 — forked from extremecoders-re/qemu-networking.md
Setting up Qemu with a tap interface

Setting up Qemu with a tap interface

There are two parts to networking within QEMU:

  • The virtual network device that is provided to the guest (e.g. a PCI network card).
  • The network backend that interacts with the emulated NIC (e.g. puts packets onto the host's network).

Example: User mode network

@zhutony
zhutony / mandel.jl
Created September 6, 2021 05:09 — forked from jakesnell/mandel.jl
Mandelbrot Plot in Julia
using PyPlot
function mandel(z)
c = z
maxiter = 80
for n = 1:maxiter
if abs(z) > 2
return n-1
end
z = z^2 + c
@zhutony
zhutony / create_triggers
Created June 12, 2021 00:52 — forked from colophonemes/create_triggers
Postgres TRIGGER to call NOTIFY with a JSON payload
CREATE TRIGGER person_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
'email',
'username'
);
CREATE TRIGGER income_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',