Skip to content

Instantly share code, notes, and snippets.

View jossef's full-sized avatar
🌶️

Jossef Kadouri jossef

🌶️
View GitHub Profile
@jossef
jossef / 7seg.ino
Last active August 27, 2015 14:52
Arduino 7seg 8 digits countdown
#include "LedControl.h"
LedControl lc = LedControl(7, 6, 5, 1);
void setup() {
lc.shutdown(0, false);
lc.clearDisplay(0);
lc.setIntensity(0, 15);
}
void printDashes() {
@jossef
jossef / iterate_pcap.cpp
Created August 12, 2015 17:01
iterates pcap using libpcap
#include <stdio.h>
#include <pcap.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <netinet/if_ether.h>
#include <string>
#include <sstream>
@jossef
jossef / analysis.py
Last active August 29, 2015 14:26
wireshark mac manuf to json file
import json
def main():
contents = open('json_data_raw.json').read()
response = json.loads(contents)
items = {k.replace('-','').replace(':','').lower():v for k, v in response.iteritems()}
short_macs = filter(lambda x: len(x[0]) == 6, items.iteritems())
long_macs = filter(lambda x: len(x[0]) == 10, items.iteritems())
@jossef
jossef / make-uuid.sh
Last active August 29, 2015 14:26
python create guid uuid
#! /bin/sh
python -c 'import uuid; print uuid.uuid4()'
var Table = require("./table");
var async = require('asyncawait/async');
var await = require('asyncawait/await');
async(function () {
var table = Table({});
var index = 123;
var row = await(table.row(index));
@jossef
jossef / arduino_modbus.ino
Last active September 24, 2016 21:19
arduino modbus function code 16
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x4E, 0xFB, 0xDD, 0x13, 0x06, 0x28 };
IPAddress ip(10, 0, 0, 50);
byte server[] = { 10, 0, 0, 17 };
EthernetClient client;
void setup()
{
@jossef
jossef / killa
Last active July 6, 2023 08:29
python kill process by port
#!/usr/bin/env python
import subprocess
import sys
import re
import os
def get_pids(port):
command = "sudo lsof -i :%s | awk '{print $2}'" % port
pids = subprocess.check_output(command, shell=True)
@jossef
jossef / get_opened_issues.py
Created March 22, 2015 07:36
Github API Get Opened Issues count
#!/usr/bin/python
import requests
import re
url = 'https://api.github.com/repos/<username>/<repo name>/issues'
args = {
'access_token': '<Your Access Token Here>',
'state': 'open',
'per_page': 1
@jossef
jossef / share-fixer
Created March 3, 2015 12:57
Linux Share Permissions Fixer
#!/usr/bin/python
import pyinotify
import subprocess
import os
wm = pyinotify.WatchManager()
class EventHandler(pyinotify.ProcessEvent):
def process_IN_CREATE(self, event):
@jossef
jossef / enums.py
Created February 19, 2015 09:55
C#/Java style Enum with names in Python 2.7+
from abc import ABCMeta, abstractmethod
import inspect
class BaseEnum(object):
__metaclass__ = ABCMeta
def __init__(self):
self._names = dict()
self._names_reversed = dict()