This file contains 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 <Python.h> | |
int Cfib(int n){ | |
if (n < 2) | |
return n; | |
return Cfib(n-1) + Cfib(n-2); | |
} | |
static PyObject* fib(PyObject* self, PyObject* args){ | |
int n; |
This file contains 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
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ | |
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ | |
xz-utils tk-dev libffi-dev systemtap-sdt-dev | |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc | |
docker run --rm -it gcc:11 bash -c "gcc -march=native -Q --help=target " |
This file contains 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
/etc/docker/daemon.json | |
{ | |
"dns": ["10.0.0.2", "8.8.8.8"] | |
} | |
sudo service docker restart |
This file contains 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
wget -O - https://bootstrap.pypa.io/get-pip.py | sudo python |
This file contains 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
import asyncio | |
import base64 | |
import os | |
import random | |
from sqlalchemy import Column, Integer, String | |
from sqlalchemy import create_engine | |
from sqlalchemy.orm import scoped_session, sessionmaker, declarative_base | |
# SQLAlchemy==2.0.4 |
This file contains 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
import vpk | |
def build_cache(path, map_name): | |
pak1 = vpk.open(path) | |
total = 0 | |
for i, f in enumerate(pak1): | |
if map_name in f: | |
print(f'reading {i}', f, pak1[f].file_length) | |
pak1[f].read() |
This file contains 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
import asyncio | |
import inspect | |
from textwrap import dedent | |
def asynchronize(method): | |
argspec = inspect.getfullargspec(method) | |
args = ', '.join(argspec.args) | |
args_without_self = ', '.join(argspec.args[1:]) | |
source = f""" |
This file contains 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
import socket, sys, select | |
class Proxy: | |
def __init__(self, raddr, rport, laddr='0.0.0.0', lport=5000): | |
self.local_addr = laddr | |
self.local_port = lport | |
self.lsock = [] | |
self.remote_addr = raddr | |
self.remote_port = rport |
This file contains 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 collections import defaultdict | |
create_dict = lambda: defaultdict(create_dict) | |
def auto_defaultidct(keys, d=create_dict()): | |
buffer = '' | |
for i, item in enumerate(range(len(keys))): | |
if i == 0: | |
buffer = 'd' |
This file contains 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
# update docker images | |
docker images | awk '{if(NR>1)print $1 ":" $2}' | xargs -n1 docker pull | |
# remove dangling images | |
docker images | grep none | awk '{print $3}' | xargs docker rmi |
OlderNewer