Skip to content

Instantly share code, notes, and snippets.

Jacek Wielemborek d33tah

Block or report user

Report or block d33tah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Cargo.toml
[package]
name = "publicsuffixtest"
version = "0.1.0"
authors = ["Jacek Wielemborek <d33tah@gmail.com>"]
[[bin]]
name = "publicsuffixtest"
path = "main.rs"
[dependencies]
View mmap_alloc.cpp
//My improved version of code from this blog post:
//http://voices.canonical.com/jussi.pakkanen/2013/09/14/serialising-any-c-data-structure-to-disk-with-20-lines-of-code/
#include <map>
#include <string>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
View quiz.py
#!/usr/bin/env python
import requests
import lxml.html
import subprocess
import os
import random
def digit_to_nondigit(x):
h = lxml.html.fromstring(requests.get('https://en.wiktionary.org/wiki/' + x).text)
View gist:bee8d72bb5f7fb25513bf457eb22d07a
#!/usr/bin/env python
import csv
import sys
r = csv.reader(sys.stdin)
max_file = 0
l = []
for line in r:
for i in range(max_file, len(line) + 1):
View gist:04bf11ff94925f0c5e18b8e2b15fd246
use std::error::Error;
use std::process;
use std::fs::File;
use std::io;
use std::io::Write;
use std::io::BufWriter;
extern crate csv;
fn run() -> Result<(), Box<Error>> {
View dht.py
#!/usr/bin/env python
import bencode
from io import BytesIO
from struct import unpack
from socket import AF_INET, inet_ntop, error as socket_error
from socket import gethostbyname, socket, SOCK_DGRAM
from unittest import TestCase, main as unittest_main
View sw.js
self.addEventListener('fetch', function(ev) {
if (ev.request.url.endsWith('.worker')) {
ev.respondWith(new Response('<strong>Ten URL istnieje!</strong>',
{headers:
{"Content-type":"text/html"}
}));
}
});
View index.html
<!doctype html>
<html>
<head>
<script>
navigator.serviceWorker.register('/sw.js').catch(e=>console.error('Ups!' + e))
</script>
</head>
<body>
Tutaj nic nie ma.
</body>
View index.html
<!doctype html>
<html>
<head>
<script>
navigator.serviceWorker.register('/sw.js').catch(e=>console.error('Ups!' + e))
</script>
</head>
<body>
Tutaj nic nie ma.
</body>
@d33tah
d33tah / parallel.py
Created May 3, 2016
thread limiter with a queue - boilerplate
View parallel.py
#!/usr/bin/python
import subprocess
import threading
import Queue
import math
SOME_LIST = [1,2,3]
WAIT_TIMEOUT = 1.0
You can’t perform that action at this time.