Skip to content

Instantly share code, notes, and snippets.

View vishvananda's full-sized avatar

Vish (Ishaya) Abrams vishvananda

  • Heroku
  • United States
View GitHub Profile
import time
import math
import sys
import struct
data = """* 8 1 7 8 8 5 2 9 5 9 5
8 5 1 1 5 6 9 4 4 5 2 1
7 2 3 5 2 9 2 6 9 3 9 4
9 2 5 9 8 9 5 7 7 5 9 6
2 4 6 7 1 4 2 6 6 2 5 8
package main
import (
"fmt"
"math"
"math/bits"
"os"
"sync"
"time"
"unsafe"
package main
import (
"fmt"
"math"
"os"
"time"
)
const (
diff --git a/nl/nl_linux.go b/nl/nl_linux.go
index ab76091..a49f675 100644
--- a/nl/nl_linux.go
+++ b/nl/nl_linux.go
@@ -27,7 +27,8 @@ const (
// tc rules or filters, or other more memory requiring data.
RECEIVE_BUFFER_SIZE = 65536
// Kernel netlink pid
- PidKernel uint32 = 0
+ PidKernel uint32 = 0
@vishvananda
vishvananda / keybase.md
Created January 4, 2019 19:20
keybase.md

Keybase proof

I hereby claim:

  • I am vishvananda on github.
  • I am vish (https://keybase.io/vish) on keybase.
  • I have a public key ASDJQdb6cmnHPgDREMp0elvm7IeX-yGsiggaGpyb-v9wUgo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am vishvananda on github.
  • I am vish (https://keybase.io/vish) on keybase.
  • I have a public key whose fingerprint is F79D 5621 D6B6 EAC6 F633 081E 6B4E B3E1 BCCC 3C0A

To claim this, I am signing this object:

@vishvananda
vishvananda / running-openstack-nova-with-pypy.md
Last active April 14, 2021 14:45
Running OpenStack Nova with PyPy

Overview

For those that are unfamiliar with the project, PyPy is an implementation of the Python language that features a JIT Compiler. I have noticed a huge performance benefit in some personal projects by switching to PyPy. I have always been curious how it would perform on a large and complex project like OpenStack, but my early experiments ran into massive roadblocks around broken dependencies.

It has been six months since I last looked, so I figured it was time to try it again. Support has come a long way and, now that lxml is working, we are close enough to get a Proof-of-Concept running. Read on for instructions on running nova with PyPy.

Preparation

Start out with a base ubuntu 12.04 (precise) install and run devstack. I won't go through the details of getting devstack running here, because there are already instructions on the devstack site.

@vishvananda
vishvananda / python-is-slow.md
Last active March 21, 2023 07:33
Python is Slow

Introduction

A few weeks ago I was browsing Hacker News, and I noticed a post about a little online programming game called Colossal Cue Adventure. I was instantly hooked and three problems quickly fell to some hacked-together Python.

I was feeling pretty satisfied with myself until I noticed the little phrase at the bottom:

you can try your hand at the bonus level by typing bonus...
@vishvananda
vishvananda / using-openssl-from-python-with-python-cffi.md
Last active September 9, 2020 16:11
Using OpenSSL from Python with python-cffi

Introduction

A few weeks ago I stumbled across a thread on hacker news that referenced the Matasano Cyrpto Challenge. I find myself unable to resist this type of problem so I decided to make an attempt. It teaches you to find vulnerabilities in crypto systems by starting with simple attacks and building up to more complex ones. Early on in the project it has you start breaking ecryption that uses the AES cypher in ECB mode. It specifically asks you not to implement the cypher yourself but to use a known-correct implementation like OpenSSL.

I tend to try to solve programming challenges in python, because the coding goes much more quickly. I checked the pyOpenSSL docs (which I have used before) to determine the call for encryption in ECB mode.

@vishvananda
vishvananda / sumproduct.py
Created October 25, 2013 18:15
Solution for the sum product puzzle
answers = set()
MAX = 100
for a in xrange(2, MAX):
for b in xrange(a, MAX):
answers.add((a, b))
print len(answers)
# sum knows product doesn't know the answer so potential a, b can't have one product solution
products = {}