Skip to content

Instantly share code, notes, and snippets.

View xkef's full-sized avatar
:bowtie:
Working from home

xkef

:bowtie:
Working from home
  • Zürich
View GitHub Profile
@xkef
xkef / gist:22116699743da2a4c8c5d6dcbf5fc7dc
Created January 1, 2017 15:47 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

@xkef
xkef / http_streaming.md
Created April 11, 2019 09:13 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@xkef
xkef / README.md
Created April 11, 2019 09:13 — forked from magnetikonline/README.md
Setting Nginx FastCGI response buffer sizes.
@xkef
xkef / image.svg
Last active April 20, 2019 20:42
regex.md
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xkef
xkef / shell.txt
Last active May 16, 2019 04:03
zsh vim ...
https://www.youtube.com/watch?v=gU5nFonVEh0
## 16/05/19
❯ lsof -i -n -P | grep node 0.17s [master] ~/code/curl
node 764 xkef 15u IPv4 0x2069afb6333f5135 0t0 TCP 127.0.0.1:49395 (LISTEN)
node 764 xkef 19u IPv4 0x2069afb6333f47b5 0t0 TCP 127.0.0.1:49396 (LISTEN)
❯ mtr 8.8.8.8.
@xkef
xkef / compress_encrypt_upload.sh
Last active December 13, 2019 02:15
upload utility script
#!/bin/sh
# 1. 'tar' saves many files together into a single tape or
# disk archive.
#
# 2. 'xz' is a general-purpose data compression tool,
# we use high compression rate and verbose output.
#
# 3. 'openssl is a cryptography toolkit, we use strong, symmetric
# aes256 encryption.
@xkef
xkef / html
Created January 15, 2020 14:41
xkcd
<html>
<script>
var x = document.createElement("IMG");
fetch("https://xkcd.now.sh/?comic=2254")
.then(res => res.json())
.then(({ img }) => {
x.setAttribute("src", img);
document.body.appendChild(x);
})
.catch(e => console.log(e));
@xkef
xkef / sh
Created January 15, 2020 15:07
url shorteners
#!/bin/sh
# say we have a service shrtnr.io,
# this bcrypt implementation (10 salting rounds)
# gives a unique hash for the short url
# -> shrtnr.io/abcd (abcd - postfix must be choosen with constraints by user)
$ htpasswd -nbBC 10 abcd 'www.google.com'
# out: abcd:$2y$10$SkjTJYoRgELA7E1dZe11KOB4cT0DsYxbqZGIBJTwZSHbbx.TPnAZq
@xkef
xkef / index.html
Created February 22, 2020 18:58
monte-carlo for π
<!DOCTYPE html>
<html>
<head>
<script src="https://d3js.org/d3.v3.min.js"></script>
<title>monte carlo</title>
</head>
<body>
<script>
var width = 800;
var height = 800;
@xkef
xkef / colab_ssh.py
Last active March 15, 2020 20:23 — forked from yashkumaratri/Google Colab SSH
SSH into google colab
#CODE
#Generate root password
import random, string
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd