Skip to content

Instantly share code, notes, and snippets.

@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active June 11, 2024 08:36
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@sumnjc
sumnjc / thread1.cpp
Created December 10, 2012 03:25
POCO Simple Thread example
// sample of using POCO's Thread
#include "Poco/Runnable.h"
#include "Poco/Thread.h"
#include <iostream>
using namespace std;
class Worker:public Poco::Runnable{
public:
@willurd
willurd / web-servers.md
Last active July 22, 2024 15:25
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@denji
denji / http-benchmark.md
Last active July 18, 2024 09:01
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@Kein1945
Kein1945 / gist:9111512
Last active July 2, 2023 16:14
Стеммер Портера для русского языка на Python
# -*- coding: utf-8 -*-
# Портирован с Java по мотивам http://www.algorithmist.ru/2010/12/porter-stemmer-russian.html
import re
class Porter:
PERFECTIVEGROUND = re.compile(u"((ив|ивши|ившись|ыв|ывши|ывшись)|((?<=[ая])(в|вши|вшись)))$")
REFLEXIVE = re.compile(u"(с[яь])$")
ADJECTIVE = re.compile(u"(ее|ие|ые|ое|ими|ыми|ей|ий|ый|ой|ем|им|ым|ом|его|ого|ему|ому|их|ых|ую|юю|ая|яя|ою|ею)$")
PARTICIPLE = re.compile(u"((ивш|ывш|ующ)|((?<=[ая])(ем|нн|вш|ющ|щ)))$")
VERB = re.compile(u"((ила|ыла|ена|ейте|уйте|ите|или|ыли|ей|уй|ил|ыл|им|ым|ен|ило|ыло|ено|ят|ует|уют|ит|ыт|ены|ить|ыть|ишь|ую|ю)|((?<=[ая])(ла|на|ете|йте|ли|й|л|ем|н|ло|но|ет|ют|ны|ть|ешь|нно)))$")
@tristanfisher
tristanfisher / Ansible-Vault how-to.md
Last active June 11, 2024 13:23
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

Working with ansible-vault


I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@meetingcpp
meetingcpp / jsonimport.hpp
Created February 26, 2016 20:20
Generic JSON Import - this code is accessing json via the json:: namespace and forwarding the types to various visitors to filter/import
template<class Import, class StringType = boost::string_ref>
struct JsonVisitor
{
JsonVisitor(Import& import,const boost::dynamic_bitset& filterresult):import(import),key(key),filterresult(filterresult){}
template<class Value>
bool operator()(const Value& v)const
{
import.processKeyValue(current_key,v);
return true;
}
@donaldmunro
donaldmunro / gist:38841d72c65a1c32f2bf83a4a00a2c9a
Created March 5, 2017 13:26
Display/print a GLM mat or vec
#include <glm/gtx/string_cast.hpp>
..
..
glm::mat4 mat;
..
..
std::cout << glm::to_string(mat) << std::endl;
@juzim
juzim / packtpub_get_dl_links.js
Last active March 4, 2018 14:48
Create wget commands for all claimed books on packtpub
@arichardson
arichardson / CLion_Ninja.md
Last active January 25, 2024 15:23 — forked from nevkontakte/CLion_Ninja.md
Ninja support for CLion IDE

Ninja support for CLion IDE (working with newer versions of clion)

This script enables Ninja-powered builds in CLion IDE by wrapping around CMake, which it uses. See my blog post for details.

Disclaimer

This script is provided AS IS with no guarantees given or responsibilities taken by the author. This script relies on undocumented features of CLion IDE and may lead to instability of build and/or IDE. Use it on your own risk under WTFPL terms.