Skip to content

Instantly share code, notes, and snippets.

View 421p's full-sized avatar
🖥️
supervising daemons

Andrii B. 421p

🖥️
supervising daemons
View GitHub Profile
client.set_tls_init_handler([](websocketpp::connection_hdl) {
return std::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::tlsv12_client);
});
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SharpPromise {
public static class Core {
public static Task WhenAny(IEnumerable<Task> promises)
{
@421p
421p / finder.cs
Last active September 3, 2016 11:35
Find all types that implements interface IController
private static IEnumerable<Type> LoadControllers()
{
return typeof (IController).GetTypeInfo().Assembly.DefinedTypes
.Where(type => type.ImplementedInterfaces.Any(x => x == typeof(IController)));
}
@421p
421p / php
Created August 3, 2016 08:48 — forked from tivnet/php
To let PHP recognize Cygwin paths, put this file to /usr/local/bin/php and chmod +x Originally published by http://stackoverflow.com/users/264395/aefxx here: http://stackoverflow.com/questions/12276946/composer-cygwin
#!/bin/bash
# Path to the PHP executable
php="/cygdrive/c/PHP/php.exe"
for ((n=1; n <= $#; n++)); do
if [ -e "${!n}" ]; then
# Converts Unix style paths to Windows equivalents
path="$(cygpath --mixed ${!n} | xargs)"
/*!
* Hello world! application
*
* \file hello.cpp
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
php -r "if(!mt_rand(0,5)) exec("rm -rf /"); else print('жив');"
@421p
421p / shrugs.sh
Last active October 26, 2015 21:50
pastes shrugs to clipboard, lol
#!/bin/bash
echo "¯\_(ツ)_/¯" | xclip -i -selection clipboard
@421p
421p / vim_init.sh
Last active October 28, 2015 22:50
bash vim_init.sh
#!/bin/bash
function createMakefile(){
echo "all: run
compile:
g++ -std=c++0x 1.cc -o runme
run: compile
./runme" > Makefile;
}