Skip to content

Instantly share code, notes, and snippets.

@smoser
smoser / README.md
Last active March 29, 2024 07:19
set up a ssh tunnel only user for ssh proxy jump

Set up a ssh tunnel only user

In order to give someone access to hosts that are available only by ssh "bouncing" (ProxyJump), add a user for this specific purpose.

We have an internal openstack where instances get IPs on per-tenant networks. Each tenant has a 'bastion' host that has a "public" ip (floating ip). You can access other instances by bouncing through the bastion. From time to time I want to let someone else into an instance. This could be done either with:

a.) just give them shell access to the bastion and let them hop through. Sharing an unrestricted shell account on my bastion is less than ideal. b.) assign a floating/"public" IP to the instance so they could go directly in. Floating IPs are limited, so this is less than ideal.

So instead, I have set up a single user as described here that can only be used for ProxyJump. It allows others proxied access to my instances but without granting them full shell access.

@tartakynov
tartakynov / fourex.py
Last active March 29, 2024 07:18
Fourier Extrapolation in Python
import numpy as np
import pylab as pl
from numpy import fft
def fourierExtrapolation(x, n_predict):
n = x.size
n_harm = 10 # number of harmonics in model
t = np.arange(0, n)
p = np.polyfit(t, x, 1) # find linear trend in x
x_notrend = x - p[0] * t # detrended x
@ThioJoe
ThioJoe / Error-Lookup-Tool-Friendly.bat
Last active March 29, 2024 07:09
Error Lookup Tool Friendly Output
@echo off
:: Note: Lines beginning with "REM" or :: are comments
:: Script by: https://github.com/thiojoe
:: Purpose: Creates a much more user friendly output for the Microsoft Error Lookup Tool (err.exe). It parses the original output and modifies the text.
:: Usage: Just call the batch file with command prompt along with the error code the same as you would with err.exe
:: Example: error.bat 50
:: Recommended to rename this script to something shorter like 'error.bat'. Must be next to the lookup tool exe file.
@james2doyle
james2doyle / getXML.go
Last active March 29, 2024 07:08
Use HTTP to GET and parse XML in golang
// tweaked from: https://stackoverflow.com/a/42718113/1170664
func getXML(url string) ([]byte, error) {
resp, err := http.Get(url)
if err != nil {
return []byte{}, fmt.Errorf("GET error: %v", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return []byte{}, fmt.Errorf("Status error: %v", resp.StatusCode)
@hakerdefo
hakerdefo / sources.list
Last active March 29, 2024 07:15
Ubuntu 22.04 LTS (Jammy Jellyfish) complete sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
@badge
badge / demo.py
Last active March 29, 2024 07:04
from celery import Celery
from pydantic import BaseModel, TypeAdapter
from pydantic_serializer import PydanticCelerySerializer
app = Celery("tasks", broker="pyamqp://guest@localhost//", backend="rpc://")
class TaskDefinition(BaseModel):
x: int
@OrionReed
OrionReed / DOM3D.js
Last active March 29, 2024 07:04
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@jermicus
jermicus / Package-Sql-CU-tar.ps1
Created March 25, 2024 17:19
Fix missing assembly errors for SQL on Windows container image builds
<#
This script will help to address errors such as those below below when trying to build Windows container images with certain verions of SQL Server
This occurs with SQL 2016, 2017 as well as SQL 2022 if updates are included in the build
This script is specific to SQL 2022 and will extract the needed files from the a CU update without needing to install the update anywhere
The files will be packaged in a tar file that can be added to the image build
For 2016/2017, WizardFrameworkLite is also required and the missing files can be taken from the installation media
#>
<#
03/16/2023 09:11:46.863 [13296]: Detailed info about C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.NetEnterpriseServers.ExceptionMessageBox.resources\v4.0_16.0.0.0_de_89845dcd8080cc91
@jasoncoon
jasoncoon / LumosRingDemo.ino
Created April 23, 2022 20:35
FastLED DemoReel100 for LumosRing
// FastLED DemoReel100 for LumosRing by Bradán Lane STUDIO
// https://www.tindie.com/products/bradanlane/lumosring-circuitpython-led-ring-block/
#include <FastLED.h>
FASTLED_USING_NAMESPACE
// FastLED "100-lines-of-code" demo reel, showing just a few
// of the kinds of animation patterns you can quickly and easily
// compose using FastLED.