Skip to content

Instantly share code, notes, and snippets.

View vpereira's full-sized avatar

Victor Pereira vpereira

View GitHub Profile
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: kubeflow
spec:
restartPolicy: Never
containers:
- name: volume-check
image: busybox
require 'benchmark'
def div_by_2(n)
n % 2 == 0 ? true : false
end
a = 0.upto(rand(31337))
b = 0.upto(rand(31337))
require 'java'
require 'jnetpcap.jar'
require 'ipaddr'
require 'json'
class PacketHandler
include Java::org::jnetpcap::packet::PcapPacketHandler
def initialize
@tcp_header = Java::org::jnetpcap::protocol::tcpip::Tcp.new
@vpereira
vpereira / gist:8543492
Last active January 4, 2016 00:39
some translations gnutls -> openssl and vice-versa

gnutls NORMAL ciphersuite to openssl

./gnutls NORMAL | ./cipher_translate.rb gnutls_to_openssl


TLS_RSA_AES_128_GCM_SHA256 -> -
TLS_RSA_AES_128_CBC_SHA1 -> -
TLS_RSA_AES_128_CBC_SHA256 -> -
TLS_RSA_AES_256_CBC_SHA1 -> AES256-SHA

TLS_RSA_AES_256_CBC_SHA256 -> -

( 4/33) Installing: python-six-1.4.1-2.1.2 ....................................................................................................[error]
Installation of python-six-1.4.1-2.1.2 failed:
Error: Subprocess failed. Error: RPM failed: error: unpacking of archive failed on file /usr/lib/python2.7/site-packages/six-1.4.1-py2.7.egg-info: cpio: rename failed - Is a directory
@vpereira
vpereira / exploit.rb
Created November 27, 2013 16:51 — forked from jacopen/exploit.rb
require 'yajl'
require 'json'
require 'oj'
def digit_pattern
digit_pattern ||= rand(10000).to_s
end
def integer_part
digit_pattern
@vpereira
vpereira / A.java
Created September 26, 2013 21:04
endianess from scrypt
//data from here https://litecoin.info/Scrypt
import java.io.*;
import java.util.*;
import java.net.*;
import java.security.*;
import java.text.*;
import java.util.zip.*;
public class A {
@vpereira
vpereira / gist:6502201
Created September 9, 2013 22:09
mindstatec Makefile
CC = clang
CFLAGS = -march=native -Wall -funroll-all-loops -O3 -fstrict-aliasing -Wall -std=c99 -I/usr/include/python2.7
LDFLAGS = -Wl, -Wl, -lpython2.7
all: test midstate.so
test: midstatemodule.c
$(CC) $(CFLAGS) midstatemodule.c -o test $(LDFLAGS)
midstate.so: midstatemodule.c
@vpereira
vpereira / iostats.rb
Created November 9, 2012 10:50
simple iostats in ruby
def read_file
File.open('/proc/diskstats').collect do |line|
entries = line.split
next unless entries[2] =~/sda/
[entries[2],entries[4],entries[5]]
end.compact.flatten
end
while true
time_1 = Time.now.to_f
@vpereira
vpereira / petzer.py
Created October 24, 2012 12:35
Petzer.py
#!/usr/bin/env python
# run it as root
# as result you get list pid -> number of fds
import os
for pid in [pid for pid in os.listdir('/proc') if pid.isdigit()]:
print pid,len([name for name in os.listdir(os.path.join('/proc',pid,'fd')) if not os.path.isdir(name)])