sudo apt update
sudo apt install git -y
git clone --recursive https://github.com/donno2048/Empire.git
cd Empire/
yes | sudo ./setup/install.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy import * | |
N(summation(floor((n := symbols('n')) * tanh(pi)) / Pow(10, n), (n, 1, oo)) - 1 / S(81)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
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};
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pypp import Str, Int, Float, cout, cin, endl | |
if __name__ == "__main__": | |
str1, str2, int1, float1 = Str(), Str(), Int(), Float() | |
cout << "Hello, " << "world!" << endl | |
cin >> str1 >> str2 >> int1 >> float1 | |
cout << str1 << endl << str2 << endl << (int1 + Int(1)) << endl << float1 << endl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# enable "Alt" + "+" + "3" + "3" to write "3" (unicode input) | |
from winreg import * | |
SetValueEx(OpenKey(HKEY_CURRENT_USER, r"Control Panel\Input Method", 0, KEY_ALL_ACCESS), "EnableHexNumpad", 0, 1, "1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void*memset(void*s,int c,int n){} | |
int main(int argc, char *argv[]) { | |
while(argc --> 0) argv[argc] = 0; | |
printf("%s\n", argv); | |
return 0; | |
} | |
/* | |
`gcc .\main.c -O3 -o main;./main` | |
and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import environ | |
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1' | |
from pygame import Rect, init, K_LEFT, K_RIGHT, K_UP, K_DOWN, K_RETURN, K_ESCAPE, K_r, K_p, QUIT | |
from pygame.event import get | |
from pygame.font import Font | |
from pygame.key import get_pressed | |
from pygame.display import set_mode, flip | |
from pygame.draw import rect | |
from pygame.time import delay | |
from random import randint, choice |