Skip to content

Instantly share code, notes, and snippets.

@nbareil
nbareil / shell.nix
Last active April 13, 2023 07:51
Nix configuration to setup binary-refinery
# nixos-unstable - 2023-04-10
with (import (fetchTarball https://github.com/nixos/nixpkgs/archive/db24d86dd8a4769c50d6b7295e81aa280cd93f35.tar.gz) {});
let
larkparser = pkgs.python3Packages.buildPythonPackage rec {
name = "lark-parser";
version = "0.12.0";
src = pkgs.fetchPypi {
FROM ubuntu:bionic
RUN apt-get update && \
apt-get install -y git libglib2.0-dev zlib1g-dev autoconf automake libtool \
libpcap-dev libnet-dev \
python-pip python-setuptools python-nids && \
apt-get clean && \
apt-get autoclean
RUN cd /tmp && \
@nbareil
nbareil / blog.tf
Last active January 22, 2020 12:10
provider "aws" {
region = "eu-central-1"
}
provider "aws" {
alias = "us_east_1"
region = "us-east-1"
}
locals {
import sys
import tempfile
import os
import csv
import requests
import tarfile
tar = tarfile.TarFile(name='all-yara.tar', mode='w')
headers = {
'Accept': 'application/vnd.github.v3+json',
#! /usr/bin/env python
# -*- coding: utf-8 *-*
#
# Copyright (C) Nicolas Bareil <nico@chdir.org>
#
# This program is published under Apache 2.0 license
from optparse import OptionParser
import fileinput
import logging

Keybase proof

I hereby claim:

  • I am nbareil on github.
  • I am nbareil (https://keybase.io/nbareil) on keybase.
  • I have a public key whose fingerprint is 64AC 6FB1 6BDB 6B44 A11B 5668 F768 F933 AB3A B498

To claim this, I am signing this object:

@nbareil
nbareil / forward-gpgified-mail
Created March 15, 2013 19:20
This script was called by a Procmail rule in order to forward specific messages to another mail address, using GnuPG encryption.
#! /bin/bash
cleartext="$(mktemp)"
FINALADDR="me@example.com"
TXTINTRO="$HOME/.etc/introduction_forward-me-gpgified"
if [[ "x$cleartext" = "x" ]]; then
exit 1
fi
@nbareil
nbareil / slugify.py
Created September 9, 2012 09:58
self-contained slug generator
def slugify(s):
import unicodedata, re
s = unicodedata.normalize('NFKD', unicode(s)).encode('ASCII', 'ignore')
s = re.sub('[^\w\s-]', '', s).strip().lower()
return re.sub('[-\s]+', '-', s)
@nbareil
nbareil / cloner.c
Created October 18, 2011 09:28
clone() without using GNU libc
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/syscall.h>