Skip to content

Instantly share code, notes, and snippets.

@amidvidy
amidvidy / gist:b4883a84a7ac17f0d37a
Created October 10, 2014 22:03
Simple boost::asio Hello world udp server
#include <string>
#include <iostream>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
using boost::asio::ip::udp;
namespace {
class HelloWorldServer {
@amidvidy
amidvidy / polydiff.py
Last active April 10, 2020 05:43
polynomial evaluator
from typing import Mapping, List, Optional, Set
from collections import Counter
from functools import reduce
class Expr:
# evaluate this expression, with respect to the following variable substitutions
def eval(self, env: Mapping[str, float]) -> float:
raise NotImplementedError()
import markovify
import json
from collections import defaultdict
persontext = defaultdict(list)
transitions = []
rawm = []
@amidvidy
amidvidy / threadtest.cpp
Created November 26, 2012 11:14
C++11 std::thread example
// compile with g++-4.7 -std=c++11 -pthread threadtest.cpp -o threadtest
#include <iostream>
#include <thread>
#include <cstdlib>
#include <chrono>
static const int num_threads = 10;
int main() {
0x6789292e1d760968c9503ae6ac5700b176a46ba3
➜ ~ ls -l ~/.ethereum
total 16
-rw------- 1 amidvidy staff 37 Jul 29 12:51 keys.info
-rw------- 1 amidvidy staff 32 Jul 29 12:51 keys.info.salt
case OperationMode::CreateWallet: {
KeyManager wallet(m_walletPath, m_secretsPath);
if (m_masterPassword.empty())
m_masterPassword = createPassword(
"Please enter a MASTER passphrase to protect your key store (make it "
"strong!): ");
try {
wallet.create(m_masterPassword);
} catch (Exception const& _e) {
cerr << "unable to create wallet" << endl << boost::diagnostic_information(_e);
goroutine 316 [running]:
github.com/docker/docker/pkg/signal.DumpStacks(0x18f6c6a, 0xf, 0x0, 0x0, 0x0, 0x0)
/root/rpmbuild/BUILD/docker-engine/.gopath/src/github.com/docker/docker/pkg/signal/trap.go:82 +0xfc
github.com/docker/docker/daemon.(*Daemon).setupDumpStackTrap.func1(0xc4214ac0c0, 0x18f6c6a, 0xf, 0xc42044e200)
/root/rpmbuild/BUILD/docker-engine/.gopath/src/github.com/docker/docker/daemon/debugtrap_unix.go:19 +0xcb
created by github.com/docker/docker/daemon.(*Daemon).setupDumpStackTrap
/root/rpmbuild/BUILD/docker-engine/.gopath/src/github.com/docker/docker/daemon/debugtrap_unix.go:32 +0x10a
goroutine 1 [chan receive, 8265 minutes]:
main.(*DaemonCli).start(0xc4204eee10, 0x0, 0x1908125, 0x17, 0xc4204f2400, 0xc420056d70, 0xc420080360, 0x0, 0x0)
#include <iostream>
class Base1 {
public:
void foo() {
std::cout << "Base1" << std::endl;
}
};
class Base2 {
#include <iostream>
#include <string>
#include <vector>
class Base1 {
public:
void foo() {
std::cout << "Base1" << std::endl;
}
};