Skip to content

Instantly share code, notes, and snippets.

@remram44
remram44 / o.cpp
Last active August 29, 2015 13:56
o/ \o/
#include <cassert>
#include <chrono>
#include <iostream>
#include <random>
#include <string>
#include <thread>
#define count(x) (sizeof(x)/sizeof(*(x)))
std::mt19937 rnd(std::random_device{}());
#-------------------------------------------------
#
# Project created by QtCreator 2014-02-28T17:28:33
#
#-------------------------------------------------
QT += core gui opengl openglextensions
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
# -*- encoding: utf-8 -*-
import sys
# Complicated stuff
import sip
api2_classes = [
'QData', 'QDateTime', 'QString', 'QTextStream',
'QTime', 'QUrl', 'QVariant']
for cl in api2_classes:
@remram44
remram44 / https.py
Created April 16, 2014 21:35 — forked from schlamar/gist:2993700
Secure usage of urllib2; default doesn't check SSL certificates at all
# Python's handling of certificate verification is irresponsible and wrong.
# Having to include the code below to get what should be the only acceptable
# default behavior is a shame
# Code from https://gist.github.com/schlamar/2993700
import httplib
import urllib2
import ssl
import contextlib
import os
import sys
import tarfile
import traceback
VERSION = sys.version_info[0]
PY3 = VERSION == 3
@remram44
remram44 / test.jl
Last active August 29, 2015 14:03
Translation of PyQt code at https://gist.github.com/remram44/9643396 to Julia
using PyCall
@pyimport sys
@pyimport sip
# Complicated stuff
api2_classes = [
"QData", "QDateTime", "QString", "QTextStream",
"QTime", "QUrl", "QVariant"]
for cl = api2_classes
@remram44
remram44 / twistedconsole.py
Created August 20, 2014 03:21
Version of Twisted StandardIO that actually works on Windows
import sys
from twisted.internet import interfaces, reactor
from twisted.python.runtime import platform
from zope.interface import implements
# Adapted from paramiko demo code
# Original note: thanks to Mike Looijmans for this code
class WindowsIO(object):
implements(interfaces.ITransport)
@remram44
remram44 / Vagrantfile
Last active August 29, 2015 14:08
Torque on Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "master", primary: true do |m|
m.vm.box = "remram/debian-7-amd64"
m.vm.network "private_network", ip: "10.4.8.11"
m.vm.provider "virtualbox" do |v|
@remram44
remram44 / makecerts.sh
Last active August 29, 2015 14:08
Tests requests with custom certificates
#!/bin/sh
set -e
ca_conf='
[ ca ]
default_ca = ca_default
[ ca_default ]
dir = ./
@remram44
remram44 / rémi
Last active August 29, 2015 14:11
Bro, do you even clone?
NOPE HAHA