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 <bits/stdc++.h> | |
#ifdef __mr__ | |
#include "prettyprint.hpp" | |
#else | |
#define endl '\n' | |
#endif | |
#define uint unsigned int | |
#define ulong unsigned long long | |
using namespace std; | |
const ulong mod = 1000000007ul; |
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
import socket, threading | |
lock = threading.Lock() | |
clients = [] #list of clients connected | |
class TelnetServer(threading.Thread): | |
def __init__(self, (sock, address)): | |
threading.Thread.__init__(self) | |
self.socket = sock | |
self.address = address |
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
import lzma | |
with lzma.open('test.7z', 'w') as lf: | |
lf.write(b'123\n'*1000) | |
with lzma.open('test.7z', 'r') as lf: | |
arr = list(lf) | |
print(len(arr)) | |
print(set(arr)) |
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
class defaultlist(object): | |
def __init__(self, factory, data=None): | |
self.factory = factory | |
self.list = [] | |
self.data = data | |
def __getitem__(self, x): | |
if x >= len(self.list): | |
self.list.extend([self.factory() for _ in range(len(self.list), x + 1)]) | |
return self.list[x] |
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
#!/usr/bin/python3 | |
import os | |
import stat | |
from os import environ, listdir | |
from jinja2 import Template | |
from datetime import datetime | |
from mimetypes import guess_type | |
def mylistdir(path): | |
items = listdir(path) |
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
html { | |
font-family: sans-serif; | |
-webkit-text-size-adjust: 100%; | |
-ms-text-size-adjust: 100%; | |
} | |
body { | |
margin: 0; | |
} | |
footer, | |
header { |
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
diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c | |
index 48ac9b4..2921325 100644 | |
--- a/src/mod_dirlisting.c | |
+++ b/src/mod_dirlisting.c | |
@@ -12,9 +12,11 @@ | |
#include <stdlib.h> | |
#include <string.h> | |
#include <dirent.h> | |
+#include <sys/types.h> | |
#include <assert.h> |
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 "base.h" | |
#include "log.h" | |
#include "buffer.h" | |
#include "plugin.h" | |
#include "response.h" | |
#include "stat_cache.h" | |
#include "stream.h" |
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
void setItemModes(const char* itemname, char* modes) { | |
struct stat info; | |
stat(itemname, &info); | |
mode_t mode = info.st_mode; | |
strcpy(modes, "----------"); | |
if ( S_ISDIR(mode) ) modes[0] = 'd'; | |
if ( S_ISCHR(mode) ) modes[0] = 'c'; | |
if ( S_ISBLK(mode) ) modes[0] = 'b'; | |
if ( mode & S_IRUSR ) modes[1] = 'r'; |
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
#!/usr/bin/env python3 | |
from subprocess import call | |
import tempfile | |
import os.path | |
import socket | |
import sys | |
import mimetypes | |
from netifaces import interfaces, ifaddresses, AF_INET | |
types_map = { |