Skip to content

Instantly share code, notes, and snippets.

View Alexis-D's full-sized avatar

Alexis Daboville Alexis-D

  • Palantir Technologies
  • London, UK
View GitHub Profile
@Alexis-D
Alexis-D / notes.md
Created May 8, 2019 10:41
How to install packages on a CentOS/RHEL server w/o internet access

Notes for later, how to install packages (and their deps!) on a server without access to internet? Definitely the 'quick way to do it' not the 'right one'.

$ docker run --rm -it centos:7.6.1810 /bin/bash
# cd
# yumdownloader --resolve nmap-ncat ... # download all required packages and their dependencies
# yum install -y createrepo
# createrepo $PWD
# tar cf repo.tar *
@Alexis-D
Alexis-D / DNS ad blocking on Android.md
Last active January 5, 2020 14:06
DNS ad blocking on Android

This took a bit of trial and error so documenting in the hope this helps someone.

Since Android P it possible to use a Private DNS which means we can now use an ad blocking DNS server without needing to use a VPN or root our Android devices. The only 'issue' is that this requires DNS-over-TLS which seems quite nascent at the time (Aug 2018). Fortunately for us blahdns offers a DNS-over-TLS ad blocking DNS server.

@Alexis-D
Alexis-D / taijy.py
Created October 27, 2014 22:16
taijy.py
import collections
import functools
# TODO(adaboville): represent grids using an immutable grid class with those
# methods:
# * get_n()
# * transpose()
# * replace(i, j, e)
@Alexis-D
Alexis-D / Error
Created November 26, 2012 16:23
Processing.js for loop bug?
In the error console (<ctrl><shift>j): TypeError: $it0.hasNext is not a function.
@Alexis-D
Alexis-D / compile.js
Created April 21, 2012 00:25
compile.js
var clone = function (o) {
// return a copy of o.
// http://stackoverflow.com/questions/728360/copying-an-object-in-javascript
if(null === o || 'object' !== typeof o) {
return o;
}
var copy = o.constructor();
for(var attr in o) {
@Alexis-D
Alexis-D / Makefile
Created March 24, 2012 12:51
Mandelbrot Set with OpenMP and SSE
CC=g++
CFLAGS=-c -pedantic -Wall -std=c++0x -O3 -fopenmp
LDFLAGS=-fopenmp
SOURCES=main.cpp Screen.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=mandelbrot
LIBS=-lSDL
all: $(SOURCES) $(EXECUTABLE)
@Alexis-D
Alexis-D / arlm.csv
Created March 10, 2012 14:13
arlm.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 10 columns, instead of 9. in line 7.
Date, pos freq, neg freq, pos / neg, volume, volume prev, volume epsilon, close, close prev, close epsilon
2008-09-19, 0.039590, 0.012070, 3.279924, 531247600.000000, 258805148.044150, 272442451.955850, 4324.870000, 3958.491268, 366.378732
2008-09-22, 0.037251, 0.011600, 3.211174, 207092300.000000, 395270550.004924, -188178250.004924, 4223.510000, 4299.653714, -76.143714
2008-09-23, 0.037311, 0.011553, 3.229680, 191699800.000000, 286195300.924077, -94495500.924077, 4139.820000, 4251.815375, -111.995375
2008-09-24, 0.038399, 0.011809, 3.251762, 162917400.000000, 225243919.444924, -62326519.444924, 4114.540000, 4141.206707, -26.666707
2008-09-25, 0.036034, 0.010791, 3.339216, 179839400.000000, 214763132.047345, -34923732.047345, 4226.810000, 4119.418730, 107.391270
2008-09-26, 0.036928, 0.012301, 3.002153, 144137000.000000, 231720249.900481, -87583249.900481, 4163.380000, 4200.401782, -37.021782
2008-09-29, 0.035816, 0.012034, 2.976256, 221762500.000000, 182289770.045872, 39472729.954128, 3953.480000, 4184.2707
@Alexis-D
Alexis-D / psort.c
Created February 27, 2012 11:20
Parallel Radix Sort with OpenMP
#include <stdlib.h>
#include <string.h>
#define INITIAL_SHIFT (((sizeof (long long)) - 1) * 010)
#define NTHREADS 64
#define SWITCH_TO_INSERTION 16
#define SWITCH_TO_QSORT 8192
#define DO_NOT_RADIX 2626144
/*
@Alexis-D
Alexis-D / Makefile
Created February 20, 2012 13:15
Printer Lab
all:
g++ -o printer -std=c++0x -Wall -pedantic -lpthread printer.cpp
@Alexis-D
Alexis-D / consumer.c
Created February 11, 2012 15:51
Producer / Consumer / Conditions variables / pthreads
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define BUF_SIZE 5
// the buffer works like a stack for
// the sake of simplicity, if needed
// we may implement a queue