Skip to content

Instantly share code, notes, and snippets.

View kim0's full-sized avatar

Ahmed Kamal kim0

  • http://cloud9ers.com/
  • Cairo, Egypt
View GitHub Profile
@kim0
kim0 / sam.py
Last active November 16, 2018 22:05
from flexx import flx, event
import json
class Server_entry(flx.Widget):
address = flx.StringProp(settable=True)
username = flx.StringProp(settable=True)
password = flx.StringProp(settable=True)
def init(self):
@kim0
kim0 / remote_python.py
Created November 13, 2018 12:06
First day with flexx, trying to invoke py method from JS
from flexx import flx
class RootUI(flx.Widget): # Using Widget as this should hold the UI!
def init(self, rpy):
super().init()
self.rpy = rpy # Capture the remote-python side
with flx.VBox():
with flx.HBox():
self.filename = flx.LineEdit(placeholder_text='foo.txt')
04f62780fb2424ba14d1f79af20ade480f484bd98ef94a454d0acdea49bf95e80bd0a134c5e2444740a05a02df994cbd9cc5be9b4e73e11cd05c6d097933df04a8

Keybase proof

I hereby claim:

  • I am kim0 on github.
  • I am kim0 (https://keybase.io/kim0) on keybase.
  • I have a public key whose fingerprint is B212 40DF A92A 0A1B E886 16B4 28D6 72D4 B91D 29FB

To claim this, I am signing this object:

@kim0
kim0 / linux-tc-notes-sch-hfsc-fq_codel.txt
Created July 31, 2015 19:47
linux-tc-notes-sch-hfsc-fq_codel.txt
Tutorial [Copied from: http://linux-tc-notes.sourceforge.net/tc/doc/sch_hfsc.txt]
========
HFSC stands for Hierarchical Fair Service Curve. Unlike its
cousins CBQ and HTB it has a rigorous mathematical foundation that
delivers a guaranteed outcome. In practice that means it does a
better job than either CBQ or HTB, both of which are essentially
best effort guesses at solving what is a surprisingly complex
problem. Both of them get it wrong in subtle ways which show up
as them not meeting their bandwidth and latency guarantees.
# coding: utf-8
def drawDash(n=3):
print("--- " * n)
def drawBar(n=3):
print("| " * (n+1))
def drawBoard(n=3):
for i in range(n):
@kim0
kim0 / kitchen.scala
Created April 27, 2015 21:04
Scala futures example, coffee brewing
import scala.concurrent._
import scala.concurrent.duration._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.util.Random
import scala.util.Try
object kitchen extends App {
@kim0
kim0 / gist:116d6397b534cb6baca9
Created April 9, 2015 19:31
zfs 0.6.4 el6 upgrade errors
Dependencies Resolved
=====================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================
Updating:
facter x86_64 1:2.4.3-1.el6 puppetlabs-products 99 k
flac x86_64 1.2.1-7.el6_6 updates 242 k
gnome-terminal x86_64 2.31.3
% Simple Travelling Salesman problem
include "globals.mzn";
int: n; % number of cities
array[1..n,1..2] of float: l; % location (coords of citis)
n = 5;
l = [| 0.0, 0.0,
| 0.0, 0.5,
| 0.0, 1.0,
| 1.0, 1.0,
| 1.0, 0.0,
% include "globals.mzn";
int: n = 3;
int: num_moves = 3; % first row is the init move
array[0..num_moves,1..n] of var bool: x;
array[1..n] of bool: init = [true,false,true]; % Initial state
array[1..num_moves] of var 1..num_moves: ops_seq; % The sequence of flips to solution
array[1..n,1..n] of bool: operations = [|false, false, true | false, true, false| true, false, false|]; % true means flip bit
% Constraints