Skip to content

Instantly share code, notes, and snippets.

@ollien
ollien / output.txt
Created July 29, 2024 17:14
Tracemalloc Test, Narrowed
[~/Documents/code] nick.krichevsky@M3M-NKrichevsky$ python3 tracemalloc_test.py
Total: 64, Peak: 30040
Total: 64, Peak: 363040
Total: 64, Peak: 30040
set guicursor=n-v-c-sm:block,i-ci-ve-r-cr-o:ver25
set clipboard=unnamedplus
set nrformats+=alpha
set nrformats+=hex
let mapleader=","
if exists('g:vscode')
syntax off
call plug#begin(stdpath('data'))
Plug 'tpope/vim-surround'
defmodule HttpStream do
use GenServer
@doc """
Stream an http response. The given function `make_request` should accept a PID and
return a `HTTPoison.AsyncResponse`. The given PID is intended to be passed to `stream_to`
in `HTTPoison.request/5`. The optional `message_timeout` argument can be used to configure
the timeout on a per-message basis (i.e, it is not a timeout for the full stream, but rather for
each chunk received)
@ollien
ollien / close_args.py
Created January 4, 2020 06:30
A decorator to close all given arguments
def close_args(*to_close):
def decorator(func: Callable):
@functools.wraps(func)
def wrapper(*args, **kwargs):
res = func(*args, **kwargs)
arg_names = inspect.getfullargspec(func)[0]
all_args = {**kwargs, **dict(zip(arg_names, args))}
for arg in to_close:
all_args[arg].close()
@ollien
ollien / applylicense.py
Created August 20, 2019 02:49
Apply the Apache License to a set of Go files
import glob
import pprint
HEADER = """
/*
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
// removeExecuteBits will remove the execute bits from the given FileMode
func removeExecuteBits(mode os.FileMode) os.FileMode {
mask := ^os.FileMode(0111)
return mode & mask
}
@ollien
ollien / decode.py
Last active April 16, 2018 20:52
WPICTF: Dance Writeup
import base64
def caesar(string, n):
result = ""
for char in string:
if not char.isalpha():
result += char
continue
is_upper = char == char.upper()
import sys
def convertToBinaryString(num):
if num == 0:
return "0"
result = ""
prevNum = 0
while abs(num) > 0:
isOdd = num % 2 != 0
@ollien
ollien / command
Last active August 21, 2017 04:44
Fedora 26 WPA2 Enterprise Fix
sudo dnf install NetworkManager-1.4.4-5.fc25 --release=25 --allowerasing
#Optional - seems to work for me; the transaction downgraded python to 3.5. The next command re-upgrades python
sudo dnf install python3.x86_64 --release=26 --allowerasing
I'd just like to interject for a moment. What you're referring to as Linux, is in fact, GNU/bluez-cups/gpg-pubkey/libpath_utils/gstreamer1-plugins-base/telepathy-mission-control/libwayland-client/libidn2/gpg-pubkey/libtdb/anaconda-widgets/qtwebkit/appstream-data/cups-client/python3-hawkey/libpsl/PackageKit-gstreamer-plugin/gstreamer1-plugins-bad-free-gtk/rpmdevtools/libxfce4ui/kf5-libkdepim/fluidsynth-libs/mesa-dri-drivers/kf5-kcoreaddons/perl-CPAN/libXrandr/perl-WWW-RobotRules/libreoffice-draw/psmisc/libXext-devel/python3-dnfdaemon/tzdata/k3b/zvbi/rpm-build-libs/kf5-kauth/python2-olefile/glib2/libusb/xbindkeys/libsepol/libnatpmp/wmctrl/konqueror/cryptsetup-libs/kf5-kbookmarks/sound-theme-freedesktop/ncurses-libs/mozjs17/perl-Mail-Transport-Dbx/libblockdev-btrfs/libXt/recordmydesktop/libnl3/konsole5/xsane-common/qt-x11/kernel-devel/ruby-libs/traceroute/sssd-krb5-common/ruby-devel/xfce4-terminal/tcp_wrappers-libs/perl-HTTP-Cookies/device-mapper-event/poppler-utils/expat/lohit-bengali-fonts/sssd-proxy/teamd/kde