Skip to content

Instantly share code, notes, and snippets.

View virtadpt's full-sized avatar
💭
First thing that Microsoft does when buying Github: Add statuses. Whee.

The Doctor virtadpt

💭
First thing that Microsoft does when buying Github: Add statuses. Whee.
View GitHub Profile
@virtadpt
virtadpt / systemd_service_hardening.md
Created July 28, 2021 21:37 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@virtadpt
virtadpt / copilot-risk-assessment.md
Created July 12, 2021 23:33 — forked from 0xabad1dea/copilot-risk-assessment.md
Risk Assessment of GitHub Copilot

Risk Assessment of GitHub Copilot

0xabad1dea, July 2021

this is a rough draft and may be updated with more examples

GitHub was kind enough to grant me swift access to the Copilot test phase despite me @'ing them several hundred times about ICE. I would like to examine it not in terms of productivity, but security. How risky is it to allow an AI to write some or all of your code?

Ultimately, a human being must take responsibility for every line of code that is committed. AI should not be used for "responsibility washing." However, Copilot is a tool, and workers need their tools to be reliable. A carpenter doesn't have to

Normies just don't care about privacy

If you're a privacy enthusiast, you probably clicked a link to this post thinking it's going to vindicate you; that it's going to prove how you've been right all along, and "normies just don't care about privacy", despite your best efforts to make them care. That it's going to show how you're smarter, because you understand the threats to privacy and how to fight them.

Unfortunately, you're not right. You never were. Let's talk about why, and what you should do next.

So, first of all, let's dispense with the "normie" term. It's a pejorative term, a name to call someone when they don't have your exact set of skills and interests, a term to use when you want to imply that someone is clueless or otherwise below you. There's no good reason to use it, and it suggests that you're looking down on them. Just call them "people", like everybody else and like yourself - you don't need to turn them into a group of "others" to begin with.

Why does that matter? Well, would *y

@virtadpt
virtadpt / index.html
Created November 19, 2020 21:16 — forked from hexerei/index.html
Liquid number format with thousands and decimal seperator
<h1>Usage Template</h1>
<h2>With integer to decimal conversion</h2>
<p>
{% include numf.html number=12345 %} <!-- output is 12.345,00 --><br />
{% include numf.html number=12345 decimals=0 %} <!-- output is 12.345 --><br />
{% include numf.html number=12345 decimals=4 %} <!-- output is 12.345.0000 --><br />
{% include numf.html number=12345 ds='.' ts=',' %} <!-- output is 12,345.00 --><br />
</p>
@virtadpt
virtadpt / index.html
Created November 19, 2020 21:15 — forked from johnteske/index.html
Liquid number format with commas
{% include numberWithCommas.html number=1 %}
{% include numberWithCommas.html number=12 %}
{% include numberWithCommas.html number=123 %}
{% include numberWithCommas.html number=1234 %}
{% include numberWithCommas.html number=12345 %}
{% include numberWithCommas.html number=123456 %}
{% include numberWithCommas.html number=1234567 %}
{% include numberWithCommas.html number=12345678 %}
{% include numberWithCommas.html number=123456789 %}
{% include numberWithCommas.html number=1234567890 %}
@virtadpt
virtadpt / key_value_pipe_to_json.sh
Created October 14, 2020 04:08 — forked from Jimilian/key_value_pipe_to_json.sh
Returns json created from pipe
#!/bin/bash
# Example:
# > echo "key1 value1 key2 value2" | ./key_value_pipe_to_json.sh
# {'key1': value1, 'key2': value2}
arr=();
while read x y;
do
@virtadpt
virtadpt / entropy_calculation_in_python.py
Created September 6, 2020 21:53 — forked from jaradc/entropy_calculation_in_python.py
Four different ways to calculate entropy in Python
import numpy as np
from scipy.stats import entropy
from math import log, e
import pandas as pd
import timeit
def entropy1(labels, base=None):
value,counts = np.unique(labels, return_counts=True)
return entropy(counts, base=base)
# please read every steps as this is not an automated script
# tested on LXC alpine 3.12
# 2.3.8 compatible only with php 7.2 (alpine 3.9)
vi /etc/apk/repositories # change to 3.9
# update and install
apk update && apk add php php-dom php-simplexml php-json php-gd php-mbstring php-xml php-tidy php-iconv php-curl php-gettext php-tokenizer php-bcmath php-intl php-session php-fpm php-pdo_mysql mariadb mariadb-client nginx iproute2
# start at boot
@virtadpt
virtadpt / example.py
Created July 13, 2020 02:27 — forked from mjkillough/example.py
MicroPython Feather HUZZAH FeatherWing OLED
# https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py
# https://learn.adafruit.com/micropython-hardware-ssd1306-oled-display/micropython
import machine
import ssd1306
i2c = machine.I2C(-1, machine.Pin(5), machine.Pin(4))
oled = ssd1306.SSD1306_I2C(128, 32, i2c)
oled.fill(1)
oled.show()
@virtadpt
virtadpt / nginx config for icecast2
Created April 20, 2020 00:35 — forked from highgain86j/nginx config for icecast2
nginx configuration for reverse-proxying icecast2 streaming server.
server {
listen 80;
listen [::]:80;
server_name radio.example.com;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
location / {