This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"debug/buildinfo" | |
"encoding/json" | |
"flag" | |
"fmt" | |
"log" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// use: | |
// cat nested.json | go run . > flattenned.json | |
package main | |
import ( | |
"bytes" | |
"compress/gzip" | |
"encoding/base64" | |
"fmt" | |
"io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# recursively replace base64-encoded strings in a JSON file with the decoded string | |
# usage: python main.py <input_file> <output_file> | |
import sys | |
import json | |
import base64 | |
def decode_json(data): | |
if isinstance(data, dict): | |
return {decode_json(key): decode_json(value) for key, value in data.items()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
from bottle import Bottle, request, response, static_file | |
import json | |
import xml.etree.ElementTree as ET | |
from datetime import datetime | |
import pytz | |
import os | |
app = Bottle() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"testing" | |
json "github.com/bytedance/sonic" | |
"github.com/miekg/dns" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// email parser built to process large amounts of .tgz exports containing one or more .eml files inside | |
package main | |
import ( | |
"archive/tar" | |
"bytes" | |
"compress/gzip" | |
"crypto/sha256" | |
"encoding/json" | |
"fmt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"net" | |
"os" | |
"strconv" | |
"syscall" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script trys to add and delete records from cloudflare based on the current status of the account in tailscale, and eliminate the need for TailScale's magic DNS. | |
Each domain will be created under a subdomain "SUBDOMAIN", that way it'll be easier to find and detele records. | |
IMPORTANT: this script is not very well tested and it tries to DELETE some DNS records. Use it at your own risk, especially if your SUBDOMAIN value is generic and it's also used elsewhere in your domain. | |
""" | |
import os | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten_dict(in_, joiner="."): | |
out = dict() | |
retry = 0 | |
for item in in_: | |
if type(in_[item]) == list: | |
retry = 1 | |
for i,list_item in enumerate(in_[item]): | |
out[f"{item}{joiner}{i}"] = in_[item][i] | |
elif type(in_[item]) == dict: | |
retry = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -s escape-time 0 | |
setw -g aggressive-resize on | |
# First remove *all* keybindings | |
# unbind-key -a | |
# List keys | |
bind-key ? list-keys | |
# Copy mode |
NewerOlder