Skip to content

Instantly share code, notes, and snippets.

@jftuga
jftuga / pyinstaller_and_setuptools.md
Last active November 13, 2021 08:47
HOWTO: Create a PyInstaller .exe for a package that uses setup tools

HOWTO: Create a PyInstaller .exe for a package that uses setup tools

Tested with Python 3.10 and PyInstaller 4.7

See also: pyinstaller-setuptools GitHub

Example

Desired package/program is called: alpha.exe

@jftuga
jftuga / Server_Core_App_Compatibility_Feature_on_Demand.md
Last active October 5, 2021 20:46
Windows Server 2022 - Server Core App Compatibility Feature on Demand

I am evaluating Server 2022 and ran across Server Core App Compatibility Feature on Demand (FOD).

Once installed and after a reboot, your Server 2022 Core instance will now be able to run the GUI versions of the following programs:

  • CluAdmin.msc - Cluster Admin
  • colorcpl.exe - Color Management
  • devmgmt.msc - Device Manager
  • diskmgmt.msc - Disk management
  • eventvwr.msc - Event Viewer
  • explorer.exe - File Explorer
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@jftuga
jftuga / HaversinFormula.go
Created September 16, 2021 13:17 — forked from cdipaolo/HaversinFormula.go
Golang functions to calculate the distance in meters between long,lat points on Earth.
// haversin(θ) function
func hsin(theta float64) float64 {
return math.Pow(math.Sin(theta/2), 2)
}
// Distance function returns the distance (in meters) between two points of
// a given longitude and latitude relatively accurately (using a spherical
// approximation of the Earth) through the Haversin Distance Formula for
// great arc distance on a sphere with accuracy for small distances
//
@jftuga
jftuga / default_gateway.go
Created August 12, 2021 19:46 — forked from abimaelmartell/default_gateway.go
Get default gateway by parsing RIB information using the net/route package. BSD Only.
package main
import (
"fmt"
"golang.org/x/net/route"
)
var defaultRoute = [4]byte{0, 0, 0, 0}
func main() {
@jftuga
jftuga / acm.tf
Created July 6, 2021 15:34
Terraform and ACM (AWS Certificate Manager)
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.48"
}
}
required_version = ">= 1.0.0"
}
@jftuga
jftuga / commands.sh
Last active July 26, 2021 22:34
Terraform and EC2 Spot Instances
#!/bin/bash
T=terraform
${T} init
${T} fmt
${T} validate
# to deploy:
${T} plan
@jftuga
jftuga / aspy.py
Created June 25, 2021 18:57
reddit asyncpraw example
import asyncio
import asyncpraw
import sys
class AsPr:
def __init__(self, sr: str):
self.sr = sr # subreddit
self.reddit = asyncpraw.Reddit(client_id=reddit_client_id, client_secret=reddit_client_secret,
user_agent=user_agent)
@jftuga
jftuga / *pycharm-setup-2020.3.2.md
Created June 18, 2021 20:07 — forked from rszeto/*pycharm-setup-2020.3.2.md
Setting up PyCharm project with remote interpreter

Setting up PyCharm project with remote interpreter

Setting up a remote interpreter on PyCharm is awfully unintuitive. I've pared it down to what I think is the minimal number of steps, and leaves the fewest number of deployment configurations and Python interpreters lying around. This is designed for my specific configuration (specifically PyTorch); adapt as needed.

Configuring default project (only do after installing PyCharm for the first time):

  1. (Optional) Add virtual environment path to excluded files
    1. From Welcome Page, go to Configure > Settings > Build, Execution, Deployment > Deployment > Options
    2. Add virtualenv path. For example, if you always have the project's virtualenv in .env, add ";.env" to the "Exclude items by name" field
@jftuga
jftuga / set_outer_border_for_range_xlsx.py
Created May 28, 2021 04:45 — forked from pankaj28843/set_outer_border_for_range_xlsx.py
A simple hack - set outer border for a range using xlsxwriter, a Python library
from __future__ import absolute_import
try:
import cStringIO as StringIO
except ImportError:
import StringIO
# Standard Library
import re
import string