Skip to content

Instantly share code, notes, and snippets.

@not-inept
not-inept / per_process_cpu_usage.py
Last active March 28, 2019 20:47
Produces a CSV with
import subprocess
import signal
import time
import sys
import csv
# This is set in the first call to run_top()
headers = []
def get_column_starts(headerStr):
global headers
@not-inept
not-inept / usbToKey.py
Created November 13, 2018 16:41
Python script for converting usb keyboard HID data to a string (Python 2.7)
#!/usr/bin/python
# Based off a script originally found here: https://teamrocketist.github.io/2017/08/29/Forensics-Hackit-2017-USB-ducker/
# Additions include: More keys, deletion
KEY_CODES = {
0x04:['a', 'A'],
0x05:['b', 'B'],
0x06:['c', 'C'],
0x07:['d', 'D'],
0x08:['e', 'E'],
1: 1776 = 1 * 1492 + 284
2: 1492 = 5 * 284 + 72
3: 284 = 3 * 72 + 68
4: 72 = 1 * 68 + 4
5: 68 = 17 * 4 + 0
-----------------------------------------------
6: 4 = 72 - 1(68) # start from line 4, solved for the gcd
7: 4 = 72 - 68
8: 4 = 72 - (284-3(72)) # substitute from line 3, solved for 68
9: 4 = (1492 - 5(284)) - (284-3((1492 - 5(284)))) # substitute from line 2, solved for 72
not-inept (Jun, 2018)
I was watching brooklyn nine nine and figured I have a go at the brain teaser posed in s02 e19. I'm likely not the first or last to solve it, but it was fun :D
Question: Given 1 2 3 4 5 6 7 8 9 10 11 12, one of the 12 weighs more or less than the others with only 3 comparisons
A(1 2 3 4) vs B(5 6 7 8), with C(9 10 11 12) to the side
1a. Is balanced
The difference is in (9 10 11 12)
X(1 2) vs Y(11 12)
@not-inept
not-inept / err1.c
Last active November 12, 2017 07:13
net/ipv4/rpitcp_ipv4.c:2455:11: error: ‘struct netns_ipv4’ has no member named ‘sysctl_rpitcp_retries2’
net->ipv4.sysctl_rpitcp_retries2 = rpitcp_RETR2;
^
net/ipv4/rpitcp_ipv4.c:2455:37: error: ‘rpitcp_RETR2’ undeclared (first use in this function)
net->ipv4.sysctl_rpitcp_retries2 = rpitcp_RETR2;
^
net/ipv4/rpitcp_ipv4.c:2456:11: error: ‘struct netns_ipv4’ has no member named ‘sysctl_rpitcp_orphan_retries’
net->ipv4.sysctl_rpitcp_orphan_retries = 0;
^
net/ipv4/rpitcp_ipv4.c:2457:11: error: ‘struct netns_ipv4’ has no member named ‘sysctl_rpitcp_fin_timeout’
import discord
import asyncio
emailUser = '<insert your email username>' # gmail username
emailPass = '<insert your gmail password>' # gmail password
roleName = '<insert your role name>' # name of the role you'd like to award to verifiers
botToken = '<insert your token>' # token given to app
client = discord.Client()
-- 1
SELECT nameFirst AS `First Name`, nameLast AS `Last Name`, COUNT(allstarfull.playerID) AS `Appearances`
FROM allstarfull NATURAL JOIN master
GROUP BY playerID HAVING Appearances >= 5;
-- 2
SELECT name
FROM allstarfull NATURAL JOIN teams
GROUP BY teamID
ORDER BY COUNT(allstarfull.teamID) DESC
LIMIT 10;
from scapy.all import sniff, ARP
amazonMacs = ['F0D2F1','F0272D','A002DC','94BA31','8841C1','84D6D0','74C246','747548','5CC9D3','50F5DA','44650D','0C47C9','001A90','AC63BE']
def dashPrompt(pkt):
if pkt[ARP].op == 1: #who-has (request)
mac = pkt[ARP].hwsrc
macCode = mac[:8].replace(':','').upper()
if macCode in amazonMacs:
print "ARP Probe from: " + mac
@not-inept
not-inept / Linked Connector.js
Last active September 12, 2016 02:08
Linked In Connector Script
"use strict";
var number_of_people = 1000;
var people_list = [];
var people_added = [];
function processList() {
for (var i = 0; i < people_list.length; ++i) {
var person = people_list[i];
var connect_button = person.getElementsByClassName('bt-request-buffed')[0];
// ==UserScript==
// @name MAL Highlighter
// @namespace drillbit.notinept.me
// @description Highlights MAL shows.
// @include http://myanimelist.net/*
// @include https://myanimelist.net/*
// @version 1
// @grant none
// ==/UserScript==