Skip to content

Instantly share code, notes, and snippets.

View honnix's full-sized avatar
🏠
Working from home

Honnix honnix

🏠
Working from home
View GitHub Profile
@honnix
honnix / Dockerfile
Created June 6, 2020 12:08
pip transitive dependency resolution issue reproduce
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y python3 python3-dev python3-pip
RUN pip3 install -U pip setuptools
RUN pip3 install grpcio==1.8.1
@honnix
honnix / Dockerfile
Last active September 15, 2018 12:43
FROM ubuntu:14.04
COPY install-python.sh /
RUN /install-python.sh
RUN pip install manhole
ENV PYTHONMANHOLE 'daemon_connection=True'
@honnix
honnix / clr.py
Created March 10, 2017 12:20
python module import hook
import sys
import imp
class Test:
pass
class MyLoader:
def load_module(self, fullname):
#!/usr/bin/env perl
# You can use this script in a pipe. It's input will become an emacs buffer
# via emacsclient (so you need server-start etc.)
# See http://mark.aufflick.com/o/886457 for more information
# Copyright (C) 2011 by Mark Aufflick <mark@aufflick.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@honnix
honnix / ec
Created February 10, 2014 20:14
emacsclient enhanced
#!/bin/sh
if [ $# -ne 1 ]
then
echo "use: ec <file>"
exit -1
fi
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n $1 > /dev/null 2>&1
@honnix
honnix / server.rb
Created November 25, 2013 21:33
upload file in sinatra
require 'sinatra'
require 'haml'
# Handle GET-request (Show the upload form)
get "/upload" do
haml :upload
end
# Handle POST-request (Receive and save the uploaded file)
post "/upload" do
@honnix
honnix / Recv.java
Created November 25, 2013 14:51
rabbitmq receiver
package com.ericsson.research.axon.messenger;
import java.io.IOException;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.DefaultConsumer;
import com.rabbitmq.client.Envelope;
us_state_abbrev = {
'Alabama': 'AL',
'Alaska': 'AK',
'Arizona': 'AZ',
'Arkansas': 'AR',
'California': 'CA',
'Colorado': 'CO',
'Connecticut': 'CT',
'Delaware': 'DE',
'Florida': 'FL',
@honnix
honnix / guess.scala
Created June 10, 2013 15:12
genetic algorithm experiment
import scala.language.postfixOps
import scala.util.Random
class Guess {
class GeneticSolver {
def getBest(toMatch: String) = {
def random: Stream[Char] = toMatch(Random.nextInt(toMatch.length)) #:: random
def iterate(parent: Seq[Char], score: Int, generation: Int): Seq[Char] = if (score != toMatch.length) {
def mutate = parent.updated(Random.nextInt(toMatch.length), toMatch(Random.nextInt(toMatch.length)))
@honnix
honnix / dns.rb
Created January 23, 2013 12:52
play dns with ruby
#!/usr/bin/env ruby
# Copyright (c) 2009 Samuel Williams. Released under the GNU GPLv3.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,