Skip to content

Instantly share code, notes, and snippets.

@valentinradu
valentinradu / npm-supply-chain.sh
Last active May 22, 2026 14:53
Check and harden against the 2026 Axios and Mini Shai-Hulud npm supply chain attacks
#!/usr/bin/env bash
# npm-supply-chain.sh
# Check for and harden against the 2026 Axios and Mini Shai-Hulud npm supply chain attacks.
# Usage: ./npm-supply-chain.sh <check|harden>
set -eo pipefail
BOLD="\033[1m"
RED="\033[31m"
GREEN="\033[32m"
@valentinradu
valentinradu / Example.swift
Created September 27, 2019 09:10
Get size of arbitrary views in SwiftUI
func calcSize<T: View>(views: [T], fitting: CGSize) -> CGSize {
let stack = HStack(spacing: 0) {
ForEach(views.indices) {r in views[r]}
}
let renderer = UIHostingController(rootView: stack)
return renderer.sizeThatFits(in: fitting)
}
@valentinradu
valentinradu / Iconizer.sh
Created October 17, 2017 11:54 — forked from richellis/Iconizer.sh
Create iOS application icons from one PDF file. Requires ImageMagick.
#!/bin/sh
#
# Iconizer shell script by Steve Richey (srichey@floatlearning.com)
# Modified by Rich Ellis (rich@richellis.net) based on contributions on Github from crishoj, giria
# https://gist.github.com/steverichey/8493f3bd31ae71a9c933/forks
#
# This is a simple tool to generate all necessary app icon sizes and the JSON file for an *EXISTING* Xcode project from one file.
# To use: specify the path to your vector graphic (PDF format) and the path to your Xcode folder containing Assets.xcassets
# Example: sh iconizer.sh MyVectorGraphic.pdf MyXcodeProject
execute pathogen#infect()
syntax on
filetype plugin indent on
set backspace=indent,eol,start
set laststatus=2
let g:airline_theme='solarized'
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/c/ycm_extra_conf.py'
set nu
@valentinradu
valentinradu / gist:9523fe547859becb3bc6
Created December 13, 2015 20:35
Top 5 system resource consumers
ps -eo pmem,pcpu,vsize,pid,command | sort -k 1 -nr | head -5