Skip to content

Instantly share code, notes, and snippets.

View omry's full-sized avatar

Omry Yadan omry

View GitHub Profile
@omry
omry / Banana simple ObjectsPool
Created July 23, 2013 05:42
A quick and simple objects pool using Banana BlockAllocator as the underlying free-list
package net.yadan.banana;
import net.yadan.banana.memory.OutOfMemoryException;
import net.yadan.banana.memory.block.BlockAllocator;
public class ObjectsPool {
private PooledObject m_objects[];
private BlockAllocator m_blocks;
private Factory m_factory;
### Keybase proof
I hereby claim:
* I am omry on github.
* I am omry (https://keybase.io/omry) on keybase.
* I have a public key ASB0kXu6fdubwhPrieXn1rcHuY1l-Q4a5U9TpO2vq9QYNQo
To claim this, I am signing this object:
@omry
omry / goodconf_README.md
Created September 2, 2018 22:49
goodconf

goodconf

Goodconf is a yaml based configuration library, supporting dot access, deep updates and more.

Loading from a string:

    s = 'hello: world'
    c = Config.from_string(s)
    assert c.hello == 'world'
    assert c == {'hello': 'world'}
@omry
omry / goodconf_README.md
Created September 2, 2018 22:49
goodconf

goodconf

Goodconf is a yaml based configuration library, supporting dot access, deep updates and more.

Loading from a string:

    s = 'hello: world'
    c = Config.from_string(s)
    assert c.hello == 'world'
    assert c == {'hello': 'world'}
vagrant@workstation:~/learn-chef/.chef$ sudo knife ssh 'name:node1' 'sudo chef-client' --ssh-user vagrant --ssh-password vagrant --attribute ipaddress
10.0.2.15 [2018-10-18T01:00:05+00:00] WARN: *****************************************
10.0.2.15 [2018-10-18T01:00:05+00:00] WARN: Did not find config file: /etc/chef/client.rb, using command line options.
10.0.2.15 [2018-10-18T01:00:05+00:00] WARN: *****************************************
10.0.2.15 Starting Chef Client, version 13.8.5
10.0.2.15 Creating a new client identity for workstation using the validator key.
10.0.2.15 [2018-10-18T01:00:07+00:00] WARN: Failed to read the private key /etc/chef/validation.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/validation.pem>
10.0.2.15
10.0.2.15 ================================================================================
10.0.2.15 Chef encountered an error attempting to create the client "workstation"
vagrant@workstation:~/learn-chef/.chef$ sudo knife ssh 'name:node1' 'sudo chef-client' --ssh-user vagrant --ssh-password vagrant --attribute ipaddress
10.0.2.15 [2018-10-18T01:00:05+00:00] WARN: *****************************************
10.0.2.15 [2018-10-18T01:00:05+00:00] WARN: Did not find config file: /etc/chef/client.rb, using command line options.
10.0.2.15 [2018-10-18T01:00:05+00:00] WARN: *****************************************
10.0.2.15 Starting Chef Client, version 13.8.5
10.0.2.15 Creating a new client identity for workstation using the validator key.
10.0.2.15 [2018-10-18T01:00:07+00:00] WARN: Failed to read the private key /etc/chef/validation.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/validation.pem>
10.0.2.15
10.0.2.15 ================================================================================
10.0.2.15 Chef encountered an error attempting to create the client "workstation"
@omry
omry / allowed_backup_commands.py
Last active December 8, 2018 23:23
Login script to restrict zfs operations to a specific controlled set, can be used as a command in authorized_keys.
#!/usr/local/bin/python
import os
import re
import sys
import subprocess
datasets = [
'storage/home',
'storage/datasets01',
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8 (test)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
@omry
omry / config.yaml
Created June 11, 2020 09:34
Hydra flask example
server:
host: 127.0.0.1
port: 8081
app:
username: ${env:USER}
flask:
ENV: production
DEBUG: false
@omry
omry / 1.py
Created June 23, 2020 23:09
dual_use_context
from contextlib import contextmanager
from typing import Any
@contextmanager
def foo() -> Any:
print("1 before")
yield
print("1 after")