Skip to content

Instantly share code, notes, and snippets.

View Dockerfile
FROM node:latest
WORKDIR /app
COPY . .
RUN yarn
CMD ["node", "index.js"]
@tarnacious
tarnacious / check.py
Last active Jun 9, 2021
Check for a desturbance in the CORS
View check.py
import requests
from datetime import datetime
def check(domain, referer):
url = 'https://' + domain + '/mesh/v1/category?location=com'
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
'Access-Control-Request-Method': 'GET',
@tarnacious
tarnacious / comments.py
Created Jan 29, 2020
scan comments in pyyaml
View comments.py
import yaml
from yaml.composer import Composer
from yaml.reader import Reader
from yaml.scanner import Scanner
from yaml.parser import Parser
from yaml.constructor import SafeConstructor
from yaml.resolver import Resolver
class CommentsScanner(Scanner):
def scan_to_next_token(self):
@tarnacious
tarnacious / main.py
Created Jan 29, 2020
maintain key order in pyyaml for python 2.7+
View main.py
import yaml
from collections import OrderedDict
class OrderedDumper(yaml.SafeDumper):
pass
def _dict_representer(dumper, data):
return dumper.represent_mapping(
yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
data.items())
@tarnacious
tarnacious / build-qcow2.nix
Last active Mar 9, 2021
Build a bare bones bootable nixos qcow2 image suitable for running with libvirt/qemu/kvm.
View build-qcow2.nix
{ config, lib, pkgs, ... }:
with lib;
{
imports =
[
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
./machine-config.nix
];
View HTTP 407 on CONNECT
$ curl -v https://www.example.com -k --proxy debugproxy.com:8080
* Trying 2a01:4f8:120:6104::2...
* TCP_NODELAY set
* connect to 2a01:4f8:120:6104::2 port 8080 failed: Connection refused
* Trying 178.63.44.71...
* TCP_NODELAY set
* Connected to debugproxy.com (178.63.44.71) port 8080 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to www.example.com:443
> CONNECT www.example.com:443 HTTP/1.1
View bootstrap_debian_image
#!/bin/bash
INCLUDES=${INCLUDES:="less,vim,sudo,openssh-server,acpid,dbus"}
ARCH=${ARCH:=amd64}
IMGSIZE=${IMGSIZE:=80G}
clean_debian() {
echo "Cleaning up.."
[ "$MNT_DIR" != "" ] && chroot $MNT_DIR umount /proc/ /sys/ /dev/ /boot/
sleep 1s
@tarnacious
tarnacious / all_rails_patches
Created Sep 13, 2018
How big are all the rails patches combined into a file and compressed?
View all_rails_patches
# clone
git clone https://github.com/rails/rails
# change working dir
cd rails
# grab all the branches
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
@tarnacious
tarnacious / delete-jobs.py
Created Apr 30, 2018
Delete all the CI/CD logs for a gitlab project
View delete-jobs.py
# Delete all the CI/CD logs for a gitlab project
#
# Requires:
# python 3
#
# requests==2.18.4
# lxml==4.2.1
# cssselect==1.0.3
#
View keybase.md

Keybase proof

I hereby claim:

  • I am tarnacious on github.
  • I am tarnacious (https://keybase.io/tarnacious) on keybase.
  • I have a public key ASA9h55GfuPJFf5iHgJutAMECbPW5r3ga84rlcL5Y108hgo

To claim this, I am signing this object: