Skip to content

Instantly share code, notes, and snippets.

// determine padding for scanlines
int old_padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
float newbiWidth = newbi.biWidth; //make new width a float
newbiWidth *= nn; //get downsize number
newbiWidth = round(newbiWidth); //round downsize number
int inewbiWidth = newbiWidth;
int horizontal_pixels = round(bi.biWidth/newbiWidth);
Traceback (most recent call last):
File "C:/Users/dmnte/PycharmProjects/graph/project.py", line 30, in <module>
update_graph()
File "C:/Users/dmnte/PycharmProjects/graph/project.py", line 26, in update_graph
win.after(20000, update_graph())
File "C:/Users/dmnte/PycharmProjects/graph/project.py", line 26, in update_graph
win.after(20000, update_graph())
File "C:/Users/dmnte/PycharmProjects/graph/project.py", line 26, in update_graph
win.after(20000, update_graph())
[Previous line repeated 959 more times]
@Ari-Roda
Ari-Roda / scapy
Created September 17, 2018 08:16
from scapy.all import * #import scapy module to python
from sklearn.externals import joblib
import pandas as pd
thisdict = { 1:"icmp",3:"ggp",6: "tcp", 11:"nvp", 12:"pup", 17: "udp", 28:"irtp",39: "tp++", 41:"ipv6" , 42:"sdrp",46:"rsvp", 47: "gre", 53: "swipe" ,55:"mobile" , 56: "tlsp", 57: "skip" , 59:"ipv6-no", 77: "sun-nd", 87: "tcf" ,89: "ospf", 103: "pim", 105:"scps",129:"iplt", 132: "sctp",
133:"fc", 82:"secure-vmtp", 94:"ipip", 108:"ipcomp", 85:"nsfnet-igp", 100:"gmtp", 25:"leaf-1", 98:"encap", 95:"micp", 84:"ttp",86:"dgp", 32:"merit-inp", 10: "bbn-rcc", 109:"snp", 15:"xnet",
44:"ipv6-frag", 79:"wb-expak", 69:"sat-mon", 7:"cbt", 107:"a/n", 23:"trunk-1", 70:"visa", 27:"rdp", 18:"mux", 104:"aris", 20:"hmp", 75:"pvp", 64:"sat-expak", 121:"smp", 22:"xns-idp", 30:"netblt",
126:"crtp", 16:"chaos", 131:"pipe", 31:"mfe-nsp", 40:"il", 110:"compaq-peer", 92:"mtp", 120:"uti", 90:"sprite-rpc", 24:"trunk-2", 74:"wsn", 37:"ddp", 76:"br-sat-mon",80:"iso-ip", 8:"egp",
We can't make this file beautiful and searchable because it's too large.
,srcip,sport,dstip,dsport,proto,service,smeansz,dmeansz,attack_cat,Label
0,59.166.0.0,1390,149.171.126.6,53,udp,dns,66,82,,0
1,59.166.0.0,33661,149.171.126.9,1024,udp,-,132,76,,0
2,59.166.0.6,1464,149.171.126.7,53,udp,dns,73,89,,0
3,59.166.0.5,3593,149.171.126.5,53,udp,dns,66,82,,0
4,59.166.0.3,49664,149.171.126.0,53,udp,dns,73,89,,0
5,59.166.0.0,32119,149.171.126.9,111,udp,-,142,78,,0
6,59.166.0.6,2142,149.171.126.4,53,udp,dns,66,82,,0
7,10.40.182.3,0,10.40.182.3,0,arp,-,46,0,,0
8,59.166.0.5,40726,149.171.126.6,53,udp,dns,73,89,,0
@Ari-Roda
Ari-Roda / platex out
Created June 7, 2018 16:54
platex output error
platex -kanji=utf8 paper.tex
This is e-pTeX, Version 3.14159265-p3.7.1-161114-2.6 (utf8.euc) (TeX Live 2017/Debian) (preloaded format=platex)
restricted \write18 enabled.
entering extended mode
(./paper.tex
pLaTeX2e <2017/10/28>+4 (based on LaTeX2e <2017-04-15>)
Babel <3.18> and hyphenation patterns for 84 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/acmart/acmart.cls
Document Class: acmart 2018/02/07 v1.50 Typesetting articles for the Associatio
n for Computing Machinery
#include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
#define N 20
int my_reduce(int *a, int *b, int c)
{
int i;
for (i = 0; i < c; i++){
b[i] = a[i] + b[i];
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include "mpi.h"
int main(int argc, char *argv[])
{
int r, myid, procs, ierr, i;
struct timeval tv;
int myval, val, tval;
@Ari-Roda
Ari-Roda / input dict
Created December 9, 2017 01:19
dict value to integer
dict = {'24': [2543.0, 212.0, 3.0, 810.0, 941.0, 137.0, 22.0, 66.0, 25834.0, 465.0, 115.0, 1248.0, 1865.0, 1923.0, 6218.0, 3708.0, 100.0, 530.0, 996.0, 2094.0, 2474.0, 15.0, 1866.0], '25': [107.0, 226.0, 192.0, 1383.0, 144.0, 679.0, 36236.0, 91.0, 199.0, 101.0, 8853.0, 284.0, 115.0, 1.0, 1.0], '26': [1706.0, 49920.0, 6082.0, 3738.0, 848.0, 61.0, 1110.0, 721.0, 292.0, 403.0, 1916.0, 61.0, 268.0, 6630.0, 1354.0, 396.0], '27': [1820.0, 86.0, 163.0, 359.0, 698.0], '20': [529.0, 151.0, 390.0, 2190.0, 166.0, 1779.0, 1441.0, 36884.0, 474.0, 831.0, 681.0, 3972.0, 28.0, 328.0, 6109.0, 80.0], '21': [537.0, 40335.0, 2122.0, 10.0, 23129.0, 190.0], '04': [2585.0, 2716.0], '23': [1236.0, 52.0, 256.0, 2293.0, 826.0, 254.0, 651.0, 1071.0, 8467.0], '29': [2176.0, 514.0, 3577.0, 32.0], '01': [1807.0, 1192.0], '14': [642.0, 1263.0, 2964.0, 7616.0, 41402.0, 15884.0, 6135.0], '11': [557.0, 196.0, 642.0, 1588.0, 292.0, 44.0, 134.0, 90.0, 542.0, 521.0, 91.0, 3.0, 562.0, 699.0, 1450.0, 1800.0, 2498.0, 3181.0, 3087.0, 3864.0, 518.0,
This file has been truncated, but you can view the full file.
adict = {'04': ['20:48:05', '20:48:07', '20:48:16', '20:48:33', '20:48:34', '20:49:11', '20:49:24', '20:52:01', '20:52:47', '20:52:51', '20:53:00', '20:53:00', '20:53:06', '20:53:06', '20:55:02', '20:56:15', '20:56:25', '20:56:39', '21:50:15'], '24': ['00:00:04', '00:00:27', '00:00:40', '00:00:40', '00:00:40', '00:01:03', '00:01:03', '00:01:03', '00:01:20', '00:01:34', '00:01:34', '00:01:34', '00:01:38', '00:01:38', '00:01:40', '00:01:41', '00:01:43', '00:01:44', '00:01:45', '00:01:45', '00:01:45', '00:01:46', '00:01:46', '00:01:46', '00:01:46', '00:01:46', '00:01:46', '00:01:48', '00:01:55', '00:01:56', '00:02:01', '00:02:07', '00:02:07', '00:02:09', '00:02:09', '00:02:13', '00:02:19', '00:02:27', '00:02:31', '00:02:39', '00:03:45', '00:03:51', '00:03:53', '00:03:53', '00:03:53', '00:03:53', '00:03:53', '00:03:53', '00:03:57', '00:03:57', '00:04:09', '00:04:15', '00:04:15', '00:04:15', '00:04:18', '00:04:18', '00:04:20', '00:04:20', '00:04:20', '00:04:21', '00:04:28', '00:04:28', '00:04:28', '00:04:28', '00:
import pymongo
import json
from pymongo import MongoClient
#command event
that_list = ['17:00:25', '17:00:25', '17:00:25', '17:03:37', '17:03:37', '17:05:52', '17:05:52', '17:05:52',
'17:05:54', '17:05:54', '17:05:54', '17:06:10', '17:06:13', '17:06:41', '17:06:48', '17:06:52',
'17:06:53', '17:06:56', '17:06:57', '17:06:57', '17:06:57', '17:06:57', '17:06:57', '17:06:57',
'17:06:57', '17:06:57', '17:06:57', '17:06:57', '17:06:57', '17:06:57', '17:06:58', '17:06:58',
'17:06:58', '17:06:58', '17:06:58', '17:06:58', '17:06:58', '17:06:58', '17:06:58', '17:06:58',