Skip to content

Instantly share code, notes, and snippets.

View nerzhul's full-sized avatar
🤠

Loïc Blot nerzhul

🤠
View GitHub Profile
{ pkgs, ... }:
{
# https://devenv.sh/packages/
packages = [
pkgs.git
pkgs.direnv
pkgs.starship
pkgs.kubectl
pkgs.bash-completion
@nerzhul
nerzhul / asio.cpp
Created September 26, 2017 21:11
asio tcp server/client
#include <iostream>
#include <asio/io_service.hpp>
#include <asio/ip/tcp.hpp>
#include <thread>
#include <asio.hpp>
using asio::ip::tcp;
#define MAX_DATABUF_SIZE 10240
#define HEADER_LEN 4
@nerzhul
nerzhul / crc32.py
Created June 19, 2017 21:02
ansible crc32 filter
# plugins/filter/crc32.py
import binascii
def crc32(s):
return binascii.crc32(s) & 0xffffffff
class FilterModule(object):
''' Ansible core jinja2 filters '''
@nerzhul
nerzhul / collectd-postgresql.conf
Created June 16, 2017 09:19
collectd-postgresql.conf (Ansible template)
{{ ansible_managed | comment }}
{% if collectd_plugin_postgresql %}
LoadPlugin postgresql
<Plugin postgresql>
<Query query_plans>
Statement "SELECT sum(seq_scan) AS seq, \
sum(seq_tup_read) AS seq_tup_read, \
sum(idx_scan) AS idx, \
sum(idx_tup_fetch) AS idx_tup_fetch \
FROM pg_stat_user_tables;"
@nerzhul
nerzhul / git-stash-pull
Created June 7, 2017 08:20
git-stash-pull
function git-stash-pull () {
git stash clear
git stash
git pull --rebase
git stash apply
git stash clear
}
@nerzhul
nerzhul / git-shell-funcs.sh
Created May 31, 2017 14:18
git-misc-funcs
function gitcs () {
if [ -z $1 ]; then
echo "Missing commit number"
return 1
fi
git commit -am "TEMP" && git rebase -i HEAD~$1
}
function git-merge-to () {
{{ ansible_managed | comment }}
[Unit]
Description=Tomcat 8 %I servlet container
After=network.target
[Service]
Type=forking
PIDFile=/var/run/tomcat8_%I.pid
Environment=CATALINA_PID=/var/run/tomcat8_%I.pid
Environment=TOMCAT_TMP_DIR=/var/lib/tomcat8_%I/tmp