Skip to content

Instantly share code, notes, and snippets.

View donno2048's full-sized avatar
:octocat:
πŸ΄πŸ˜΄πŸ‘¨β€πŸ’»πŸ”

Elisha Hollander donno2048

:octocat:
πŸ΄πŸ˜΄πŸ‘¨β€πŸ’»πŸ”
View GitHub Profile
@donno2048
donno2048 / main.py
Last active April 24, 2022 18:28
Inverse square root and fast inverse square root
# Inverse square root and fast inverse square root
from ctypes import c_long, c_float, addressof, cast, POINTER
def fisr(number: float) -> float:
y = c_float(number)
i = c_long(0x5f3759df - (cast(addressof(y), POINTER(c_long)).contents.value >> 1))
y = cast(addressof(i), POINTER(c_float)).contents.value
return y * (3 - (number * y * y)) / 2
"""
float fisr(float number) {
float y = number;
flowchart TD
    A[Why do you want to learn programming?] -- Fun --> B[Simplicity or Efficiency?];
    B -- Simplicity --> C[Is portability important?];
    C -- Yes --> D{JS};
    C -- No --> E[Aesthetics or Clearness?];
    E -- Aesthetics --> F{Ruby};
    E -- Clearness --> G[Ease or Versatility?];
    G -- Ease --> H{Python};
    G -- Versatility --> I{Lua};
@donno2048
donno2048 / stream.sh
Last active January 30, 2022 22:26
Stream movies from cmd for wsl
# Stream movies from cmd for wsl (requires xlaunch and pulseaudio)
# Install requirements: sudo npm i peerflix -g && sudo apt install mpv -y
# Execute: bash stream.sh endgame
/mnt/c/pulseaudio/bin/pulseaudio.exe 2>/dev/null & export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 && sleep 1 && export PULSE_SERVER=tcp:$(grep nameserver /etc/resolv.conf | awk '{print $2}');
peerflix -k $(curl -s https://1337x.wtf/$(curl -s https://1337x.wtf/search/$(printf '%s' "$*" | tr ' ' '+' )/1/ | grep -Eo "torrent\/[0-9]{7}\/[a-zA-Z0-9?%-]*/" | head -n 1) | grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*" | head -n 1) > /dev/null
from sympy import *
N(summation(floor((n := symbols('n')) * tanh(pi)) / Pow(10, n), (n, 1, oo)) - 1 / S(81))
# Simple python shell
## Use:
### In cmd:
#### python3 shell.py
#### echo "ls" | python3 shell.py
### In python:
#### main("ls")
from os import name, popen, getcwd
from sys import stdin, exit
if name != 'nt': import readline

Empire - PowerShell based hacking tool

Install

sudo apt update
sudo apt install git -y
git clone --recursive https://github.com/donno2048/Empire.git
cd Empire/
yes | sudo ./setup/install.sh
// cute demo for line drawing in p5js
async function setup() {
createCanvas(400, 400);
background(0);
stroke(0, 200, 0);
fill(0, 200, 0);
const distance = 25;
for (var i = 0; i < 300 / distance + 1; i++) {
drawLine(new p5.Vector(50 + distance * i, 350), new p5.Vector(50 + distance * i, 50), 50, 1);
await drawLine(new p5.Vector(50, 350 - distance * i), new p5.Vector(350, 350 - distance * i), 50, 1);
from os.path import isdir
def cpu_count() -> int:
i = 0
while isdir('/sys/devices/system/cpu/cpu%d' % i): i += 1
return i
def __check_cpu(i: int) -> None:
assert i < cpu_count(), "CPU index out of range"
assert isinstance(i, int), "CPU index must be an integer"
assert i > 0, "CPU 0 is always active and cannot be deactivated nor activated"
def cpu_active(i: int) -> bool:
@donno2048
donno2048 / main.js
Last active November 6, 2021 18:43
Alert the IP address
// alert the IP address
var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; var pc = new myPeerConnection({iceServers: [{urls: 'stun:stun.l.google.com:19302'}]}), ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g; pc.createDataChannel(''); pc.createOffer(function(sdp) {pc.setLocalDescription(sdp, () => {}, () => {});}, () => {}); pc.onicecandidate = function(ice) {if (ice && ice.candidate && ice.candidate.candidate && ice.candidate.candidate.match(ipRegex)) alert('Your IP address is: ' + ice.candidate.candidate.match(ipRegex)[0]);};
#include <stdio.h>
int main() {
    char a[6], *b = "test\n\0";
    char *temp=a;while(*temp++=*b++);
    printf("%s", a);
    return 0;
}