Skip to content

Instantly share code, notes, and snippets.

@jtzero
jtzero / world-clocks.1s.sh
Created April 18, 2024 16:57
Swiftbar WorldClock
#!/usr/bin/env bash
# Display UTC in the menubar, and one or more additional zones in the drop down.
# The current format (HH:MM:SS) works best with a one second refresh, or alter
# the format and refresh rate to taste.
#
# <swiftbar.title>World Clocks</swiftbar.title>
# <swiftbar.version>v1.0</swiftbar.version>
# <swiftbar.author>Adam Snodgrass, jtzero</swiftbar.author>
# <swiftbar.author.github>jtzero</swiftbar.author.github>
@jtzero
jtzero / x86-brew-on-mac-m1
Last active July 26, 2023 15:24
x86 brew on mac m1
1. Set terminal to rosetta
If Rosetta 2 is not installed by default in your M1 Mac, then open the pre-installed Terminal app and run the following command: `/usr/sbin/softwareupdate --install-rosetta --agree-to-license`
Rosetta allows us to use apps built for Mac with intel chip.
Several CLI tools do not have native versions built for the new M1 architecture.
Enabling them on your native M1 Mac terminal can be frustrating.
Follow these steps to enable Rosetta:
- Select the app(Terminal) in the Finder.
- Right click on the app(Terminal) and select Get Info.
- In General, check the Open using Rosetta check-box.
### Keybase proof
I hereby claim:
* I am jtzero on github.
* I am jtzero (https://keybase.io/jtzero) on keybase.
* I have a public key ASCj7tmuy-kpBaObL7J8_-EjqUGyVL4wZVdU9OVOyayaIAo
To claim this, I am signing this object:
### Keybase proof
I hereby claim:
* I am jtzero on github.
* I am behrensrkyle (https://keybase.io/behrensrkyle) on keybase.
* I have a public key ASDqn5MwgQE_HtMfs9-SOkFMq5PEdr621S30b73pVBQJ_Ao
To claim this, I am signing this object:
@jtzero
jtzero / Jupyter command find_spark_home.py not found
Last active May 28, 2020 04:35
Jupyter command `jupyter-/home/jtzero/.local/share/virtualenvs/ml-.../bin/find_spark_home.py` not found.
```
(email_ml) jtzero:~/Documents/ml$ PYSPARK_DRIVER_PYTHON=jupyter PYSPARK_DRIVER_PYTHON_OPTS='notebook' pyspark
Traceback (most recent call last):
File "/home/jtzero/.local/share/virtualenvs/ml-PBkX3P8r/bin/jupyter", line 8, in <module>
sys.exit(main())
File "/home/jtzero/.local/share/virtualenvs/ml-PBkX3P8r/lib/python3.7/site-packages/jupyter_core/command.py", line 247, in main
command = _jupyter_abspath(subcommand)
File "/home/jtzero/.local/share/virtualenvs/ml-PBkX3P8r/lib/python3.7/site-packages/jupyter_core/command.py", line 134, in _jupyter_abspath
'Jupyter command `{}` not found.'.format(jupyter_subcommand)
Exception: Jupyter command `jupyter-/home/jtzero/.local/share/virtualenvs/ml-PBkX3P8r/bin/find_spark_home.py` not found.
@jtzero
jtzero / object.rb
Last active March 1, 2019 05:20
elixir like pipes in ruby
# asdf
#=> nil
# [3] pry(main)> 'asdf' >> pipeto(:puts, 'asdff')
# asdf
# asdff
#=> nil
# [4] pry(main)> 'asdf' >>
# -> x { x + 'q' } >>
# -> x { x + 'w' }
# asdfqw
def const_source_location(const)
if method_name = const.instance_methods.sort.find {|m| const.instance_method(m).owner == const }
const.instance_method(method_name).source_location
else
raise "`#{const}' has no uninherited/mixed in instance methods"
end
end

pre 0.9.0

shell# echo '
[sshd]
enabled = true
filter = sshd
action = iptables-multiport
logpath = /var/log/auth.log
maxretry = 3

cd ~/Downloads

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

dpkg -i zabbix-release_3.2-1+xenial_all.deb

apt-get update

should add /etc/apt/sources.list.d/zabbix.list

@jtzero
jtzero / gist:7456626
Created November 13, 2013 21:22
@metajack's post saved from codexon Category: Internet, Programming, Python The recent server benchmark posted here comparing Erlang, Haskell, and Python understandably upset many people. Today we will move away from polarizing benchmarks and more about features. Even though Erlang may not be the fastest language, it still has at least one grea…
import os
import time
import socket
import sys
import fcntl
import _multiprocessing
from multiprocessing import Pipe
# global pipe variable
pipe = None