Skip to content

Instantly share code, notes, and snippets.

View ldx's full-sized avatar
🌪️
Wreaking havoc

Vilmos Nebehaj ldx

🌪️
Wreaking havoc
View GitHub Profile
@DuCanhGH
DuCanhGH / copy-traced-files.ts
Last active December 17, 2024 06:11
Reimplementing Next.js's Output File Tracing with a custom server
import { nodeFileTrace } from "@vercel/nft";
import { Sema } from "async-sema";
import { glob } from "glob";
import { NextConfigComplete } from "next/dist/server/config-shared";
import fs from "node:fs/promises";
import path from "node:path";
interface RequiredServerFilesManifest {
version: number;
config: NextConfigComplete;
@bitsurgeon
bitsurgeon / nvidia.md
Last active October 12, 2024 11:24
install Nvidia driver on Ubuntu with Secure Boot

Install Nvidia Driver on Ubuntu 18.04.3

Secure Boot

This section applies to machines with Secure Boot, such as ThinkPad.

  1. Before installation, switch to "Discrete Graphics" in BIOS, if both Intel and Nvidia graphics are present.
  2. During installation, make sure to select the "Install third-party software for graphics and Wi-Fi hardware and addition media formats" in "Updates and other software" screen.
  3. Select "Configure Secure Boot", and set password.
  4. Continue Ubuntu installation as normal.
apiVersion: configuration.konghq.com/v1
kind: KongConsumer
metadata:
name: consumer1
namespace: nginx-kong-test
username: consumer1
---
apiVersion: configuration.konghq.com/v1
kind: KongConsumer
@aspose-com-gists
aspose-com-gists / 3D-viewer-CF2.cs
Last active November 1, 2024 19:41
Aspose.CAD for .NET
// load CF2 in an instance of Image via its Load method
using (var image = Aspose.CAD.Image.Load("template.cf2"))
{
// create an instance of CadRasterizationOptions and set page height & width
var rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions()
{
PageWidth = 1600,
PageHeight = 1600
};
@lukeplausin
lukeplausin / bash_aws_jq_cheatsheet.sh
Last active January 4, 2025 17:42
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
@toolmantim
toolmantim / pipeline.sh
Last active December 8, 2022 07:19
Ensuring Buildkite pipeline steps run on the same agent, using a dynamic pipeline generator script
#!/bin/bash
# Outputs a pipeline that targets agents that have the same 'name' meta-data
# value as the step that does the pipeline upload. This means that all the
# steps will run on the same agent machine, assuming that the 'name' meta-data
# value is unique to each agent.
#
# Each agent needs to be configured with meta-data like so:
#
# meta-data="name=<unique-name>"
@heri16
heri16 / bgpd.conf
Last active April 4, 2025 10:10
AWS VPC VPN StrongSwan Virtual Tunnel Interface (VTI)
#@ /etc/quagga/bgpd.conf (Centos & Ubuntu)
hostname <Local OS hostname>
password <Any random phrase>
enable password <Any random phrase>
!
log file /var/log/quagga/bgpd
!debug bgp events
!debug bgp zebra
debug bgp updates
@andrealbinop
andrealbinop / setup-modernie-vagrant-boxes.md
Last active May 28, 2023 01:54
Setup modern.ie vagrant boxes

Setup modern.ie vagrant boxes

Since modern.ie released vagrant boxes, it' no longer necessary to manually import the ova file to virtualbox, as mentioned here.

However, the guys at modern.ie didn't configured the box to work with WinRM. This how-to addresses that, presenting steps to proper repackage these boxes, adding WinRM support. Additionally configures chocolatey package manager and puppet provisioner.

Pre-requisites

@branneman
branneman / better-nodejs-require-paths.md
Last active April 11, 2025 10:39
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

#!/bin/bash
# This snippet should hypothetically allow a totally unattended
# download of Apple's Xcode. After sourcing credentials from ENV,
# the script simulates a login, and downloads the XCode DMG.
# Based on: https://gist.github.com/cdata/817672
source /vagrant/apple_creds.sh
login="$ADC_LOGIN"
password="$ADC_PASSWORD"