Skip to content

Instantly share code, notes, and snippets.

@waqaraqeel
waqaraqeel / Summary.md
Last active June 4, 2021 13:11
Clang-tidy findings summary

Description of Clang-Tidy Checks

Summary and full logs from make target clang_tidy_oai on Magma @ 81025e8

cat clang-tidy-oai.findings  | egrep "android|bugprone|cert|clang|concurrency|misc" | awk -F'[][]' '{print $2}' | sort | uniq -c
   2034 
      3 android-cloexec-fopen
      1 android-cloexec-open
     43 bugprone-branch-clone
     80 bugprone-macro-parentheses
@waqaraqeel
waqaraqeel / get_cdn.py
Last active February 23, 2023 22:43
Figures out which CDNs were involved in a webpage fetch given HAR file.
#!/usr/bin/env python3
"""
Figures out which CDNs were involved in a webpage fetch given HAR file.
Requires dnspython
Borrows heavily from https://github.com/turbobytes/cdnfinder
Thank you to cdnplanet.com
Usage: ./get_cdn.py -f har-file
Or you could just import the get_cdn function
#!/usr/bin/env python3
"""
This is a quick and dirty script written out of pure annoyance at proofpoint
URLdefense making emails unreadable and unusable. Phishing is dangerous, we get
it. Maybe you code change the hyperlink instead of the actual text in the email?
This script will decode all URLs in stdin.
Adapted from https://help.proofpoint.com/Threat_Insight_Dashboard/Concepts/How_do_I_decode_a_rewritten_URL%3F.
Thank you to proofpoint for providing it.
# The Category table
class Category(models.Model):
# has only one field, name, which is unique
name = models.CharField(max_length=128, unique=True)
# The Place table
class Place(models.Model):
# every place has a category
@waqaraqeel
waqaraqeel / pyretic_count.py
Last active August 29, 2015 14:17
Temporary pyretic count sample
count_policy = count_bytes(interval=5, group_by=["dstip", "inport", "outport"])
count_policy.register_callback(self.__count_callback)
def __count_callback(self, pkt):
with self.count_lock:
for match, byte_count in pkt.iteritems():
if 'inport' in match.map and 'dstip' in match.map:
if match.map['inport'] is not None and match.map['dstip'] is not None:
ip = str(match.map['dstip'])
@waqaraqeel
waqaraqeel / arraySortType.cpp
Last active August 29, 2015 14:07
Recursive function for detecting sorting type of passed array
#include <iostream>
using namespace std;
const int ASC = 0;
const int DESC = 1;
const int NOORDR = 2;
const int EQELEM = 3;
const int ARRAYEND = 4;
#define PI 3.14159265
#define EARTH_RADIUS 0.02
#define MARS_PERIOD 1.881
#define MERCURY_PERIOD 0.241
#define VENUS_PERIOD 0.615
#define MOON_PERIOD 0.0748
#define EARTH_PERIOD 1
#define JUPITER_PERIOD 11.86
#define SATURN_PERIOD 29.46
#define URANUS_PERIOD 84.32