Skip to content

Instantly share code, notes, and snippets.

View samsour's full-sized avatar
🐙

Sam Sauer samsour

🐙
View GitHub Profile
@samsour
samsour / scan_npm.sh
Last active April 1, 2025 14:29
An actually pretty solid bash script for quickly scanning both local and global installs for suspicious packages.
#!/bin/bash
# Run the script with:
# chmod +x scan_npm.sh # make the script executable
# ./scan_npm.sh # both local and global
# ./scan_npm.sh local # only local
# ./scan_npm.sh global # only global
# Suspicious packages list
packages=(
@samsour
samsour / _breakpoints.scss
Created November 5, 2024 21:21
Still the best SCSS dynamic breakpoint mixin snippet
$breakpoints: (
'default': '',
'2xs': 390px,
'xs': 480px,
's': 667px,
'm': 1024px,
'l': 1180px,
'xl': 1600px,
'2xl': 1800px,
);
git rebase -i <parent-commit-sha> -x "git commit --amend --reset-author -CHEAD"
# Opens a PowerShell instance with elevation, finds the wsl ip without relying on hostname, since ArchWSL and others doesn't have it
# then iterate opening the selected ports
$principal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
if($principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
$remoteport = wsl -- ip -o -4 -json addr list eth0 ` | ConvertFrom-Json ` | %{ $_.addr_info.local } ` | ?{ $_ }
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if($found) {
$remoteport = $matches[0];
} else{
@samsour
samsour / main.js
Created March 3, 2022 12:58
Custom Vue 3 Integration
import { createApp } from 'vue';
import clickOutside from './directives/clickOutside';
// Decide on which element to mount the vue application
const vueInitContainer = document.getElementById('app');
// Collect all illegal tags in <div id="app">
// that will be used to create the initial app template
// Templates should only be responsible for mapping the state to the UI.
// Avoid placing tags with side-effects in your templates, such as <script> or <style>
@samsour
samsour / rewrite-committer-author.bash
Last active September 20, 2021 15:22
Rewrite Commit History (Author & Committer)
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "<Old Name>" ];
then
GIT_COMMITTER_NAME="<New Name>";
GIT_AUTHOR_NAME="<New Name>";
GIT_COMMITTER_EMAIL="<New Email>";
GIT_AUTHOR_EMAIL="<New Email>";
git commit-tree "$@";
else
git commit-tree "$@";
@samsour
samsour / .zshrc
Created September 20, 2021 11:00
Bash aliases
alias lg="git log --pretty=format:'%h %an, %ar: %s' --graph"
alias nah="git reset --hard && git clean -df"
alias squash="git rebase -i HEAD~2"
alias new="git checkout -b"
@samsour
samsour / scroll-listener.js
Last active August 12, 2020 00:03
Debounced on-scroll-event-listener at nearly 60 fps
(function() {
var lastScrollY = 0;
var ticking = false;
var update = function() {
// Add scroll logic
ticking = false;
};
var requestTick = function() {
@samsour
samsour / webpack.config.js
Last active April 25, 2020 00:27
Webpack Boilerplate Config (feat. SASS/SCSS, minifyied & uglified Javascript ES6, Browsersync, font & asset loading)
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const devMode =
process.argv[process.argv.indexOf('--mode') + 1] === 'development';
@samsour
samsour / semantic-commit-messages.md
Last active March 20, 2020 09:29 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example