Skip to content

Instantly share code, notes, and snippets.

@zxexz
zxexz / aws_metadata_proxy.md
Created February 28, 2022 22:00 — forked from anapsix/aws_metadata_proxy.md
How to proxy EC2 metadata

How to proxy to EC2 Metadata

Sometimes, you need to use your EC2 instance's credentials to access the AWS resources, for testing, development, etc.. This is how you do it.

Step 1

create 169.254.169.254 on loopback interface

linux

sudo ip a add 169.254.169.254 dev lo
@zxexz
zxexz / snpedia.R
Created September 12, 2021 17:45 — forked from bschiffthaler/snpedia.R
Analyze your own SNP data from 23andMe using SNPedia
library(SNPediaR)
library(tidyverse)
# Original function has som issues with parsing that need fixing
getPages2 <- function (titles, verbose = FALSE, limit = 50, wikiParseFunction = identity,
baseURL, format, query, ...)
{
if (missing(baseURL))
baseURL <- "https://bots.snpedia.com/api.php"
if (missing(format))
@zxexz
zxexz / Dockerfile-eCRNow
Created May 15, 2020 13:22
eCR Now Docker
FROM maven:3.6.3-jdk-8
RUN apt update \
&& apt install -y git \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash \
&& apt install -y nodejs
RUN git clone https://github.com/drajer-health/eCRNow.git
WORKDIR eCRNow/
COPY eCRFiles/application.properties src/main/resources/application.properties
COPY eCRFiles/config.js frontend/public/config.js
RUN sed -i s/newJsonParser/newXmlParser/g src/main/java/com/drajer/ecrapp/config/SpringConfiguration.java
@zxexz
zxexz / 0-spatial-sql-postgis.md
Created October 9, 2019 15:24 — forked from pramsey/0-spatial-sql-postgis.md
Spatial SQL and PostGIS
@zxexz
zxexz / PostgisPostgres12-Dockerfile
Last active October 9, 2019 05:46
Dockerfile for PostGIS 2.5.3 on PostgreSQL 12
FROM postgres:12-alpine
ENV POSTGIS_VERSION 2.5.3
ENV PROJ_VERSION 4.9.3
ENV PROTOBUF_VERSION 3.10.0
ENV PROTOBUF_C_VERSION 1.3.2
RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
@zxexz
zxexz / mutate_string.py
Last active September 22, 2023 16:39
Ever been told strings are immutable in Python? I wanted to test that.
#! /usr/bin/env python3
def replace_contents(
string: str,
search_string: str,
replace_string: str = "",
global_replace: bool = False,
terminate_char: str = ' ',
return_type: type = str,
memoryview_cast: str = '@c'
):
@zxexz
zxexz / inline-persistent-python.sh
Last active November 8, 2017 19:17
use a persistent python session throughout a bash script
#! /bin/bash
TMPLOC=/tmp
RD=$TMPLOC/readylock.$$
RQ=$TMPLOC/request_fifo.$$
RS=$TMPLOC/result_file.$$
start_cmdserver() {
mkfifo $RQ
(
#! /bin/bash
begin='2017-01-01'
segments=\
"YEAR 2017-01-01 2018-01-01
Q1 2017-01-01 2017-04-01
Q2 2017-04-01 2017-07-01
Q3 2017-07-01 2017-10-01
Q4 2017-10-01 2018-01-01
JAN 2017-01-01 2017-02-01
FEB 2017-02-01 2017-03-01
@zxexz
zxexz / dislocker_mount.sh
Created October 28, 2017 05:08
mounts a bitlocker drive in linux using dislocker
#! /bin/bash
# Created by Eric Marriott
for i in perl dislocker sudo; do
if ! type "$i" > /dev/null;then
echo "$i not found. exiting..."
exit 1
fi
done
@zxexz
zxexz / wifi.sh
Created October 28, 2017 05:02
quick 'n' dirty
#! /bin/bash
sudo rfkill unblock all
sudo killall wpa_supplicant
sudo killall dhclient
sudo rm -r /run/wpa_supplicant
sudo wpa_supplicant -B -iwlp2s0 -Dnl80211 -m '' -c/etc/wpa_supplicant/wpa_supplicant.conf
sudo dhclient wlp2s0 $!