Skip to content

Instantly share code, notes, and snippets.

@0xKD
0xKD / deploy.md
Created April 17, 2021 15:43
Single server deployment

Single server deployment

  • Create new user
adduser <username>
usermod -aG sudo <username>  # enable sudo
  • Setup passwordless sudo
@0xKD
0xKD / style.css
Created January 27, 2021 07:43
GitLab Code Stylebot
.container-limited.limit-container-width {
max-width: 1440px;
}
@0xKD
0xKD / get_gem_info.py
Last active January 10, 2021 10:57
Parse vendor rewards
import requests
import re
from bs4 import BeautifulSoup
GEM_REWARDS_PAGE = "https://pathofexile.gamepedia.com/List_of_skill_gems_rewarded_from_quests"
REWARD_TEXT_RE = re.compile("Act (\d{1}) after ([\w,\s]+) with (any character|[\w\,\s]+)")
VENDOR_REWARD_TEXT_RE = re.compile(
"Act (\d{1}) after ([\w,\s]+) from ([\w\s]+) with (any character|[\w\,\s]+)"
@0xKD
0xKD / pydantic_settings_gcs.py
Last active October 30, 2024 03:46
Pydantic - Google Cloud Secret
import logging
import os
from pathlib import Path
from typing import Any, Dict, Optional, Union, Mapping
from google.api_core.exceptions import GoogleAPIError
from google.auth.exceptions import GoogleAuthError
from google.cloud import secretmanager
from pydantic import BaseSettings, Field
@0xKD
0xKD / poe_stash_download.py
Created October 31, 2020 16:41
Path of Exile - Download Personal Stash
"""
Usage:
python3 poe_stash_download.py $accountname $POESESSID > tabs.json
$POESESSID is value of cookie variable (with same name)
after you login to the Path of exile website
"""
@0xKD
0xKD / json2csv.sh
Created September 28, 2020 15:15
json-to-csv
alias json2csv="python -c 'import json;b=json.loads(input());[print(f\"{k},{v}\") for k,v in b.items()]'"
# use it like this
cat file.json | json2csv
%load_ext autoreload
%autoreload 2
import sys
import logging
import numpy as np
import scipy as sp
import sklearn
import statsmodels.api as sm
#include <iostream>
#include <string>
#include "phonenumbers/phonenumberutil.h"
using i18n::phonenumbers::PhoneNumber;
using i18n::phonenumbers::PhoneNumberUtil;
using namespace std;
@0xKD
0xKD / help.md
Created September 24, 2017 02:46
Find shutdown cause macOS

Run this

log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h

Check reason code in following list:

Code	Description	Solution