Skip to content

Instantly share code, notes, and snippets.

View jdiez17's full-sized avatar

José Manuel Díez jdiez17

View GitHub Profile
@jdiez17
jdiez17 / lol.py
Last active October 25, 2016 11:54
import inspect
import ast
def d(*values):
f = inspect.currentframe()
f_name = f.f_code.co_name
caller_ast = ast.parse(inspect.getsource(f.f_back))
def find_names(root):
for child in ast.iter_child_nodes(root):
// a.hpp
class A {
virtual void do() = 0;
}
// b.hpp
#include "a.hpp"
class B: public A {
void do_something_else();
}
from collections import defaultdict
events = [
('a', 0),
('b', 1),
('a', 2),
('b', 2),
('b', 3),
('a', 3)
]
static float decode_float(const uint8_t *data) {
float f;
uint8_t bytes[] = {data[3], data[2], data[1], data[0]};
memcpy(&f, bytes, 4);
return f;
}
jdiez@WarpPrism  ~/dev/sway/sway/build   master  cmake ..
CMake Warning (dev) at CMakeLists.txt:33 (add_definitions):
Policy CMP0005 is not set: Preprocessor definition values are now escaped
automatically. Run "cmake --help-policy CMP0005" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at CMakeLists.txt:64 (add_manpage):
Unknown CMake command "add_manpage".
coreos:
units:
- name: 00-eth1.network
runtime: yes
content: |
[Match]
Name=eth1
[Network]
DHCP=ipv4
- include: service.yaml
with_items:
- elasticsearch
- logstash
- kibana
- mongo
- postgres
ok: [kylink-dev] => {
"service": {
"changed": false,
"msg": "All items completed",
"results": [
{
"_ansible_no_log": false,
"_ansible_notify": [
"reload systemd"
],
@jdiez17
jdiez17 / out
Last active March 3, 2016 11:02
jdiez@Hobgoblin:~/dev/ops/infrastructure/ansible$ ansible-playbook -i inventory/all bootstrap.yml --limit kylink-dev
PLAY [Install basic services] **************************************************
TASK [setup] *******************************************************************
ok: [kylink-dev]
TASK [common : Install services] ***********************************************
ok: [kylink-dev] => (item=elasticsearch)
ok: [kylink-dev] => (item=logstash)
ok: [kylink-dev] => (item=kibana)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "server.h"
void client_connect(int fd, const char* host, const char* port) {
printf("New connection from %s:%s on fd %d\n", host, port, fd);
}
void client_disconnect(int fd) {