Skip to content

Instantly share code, notes, and snippets.

@webtroter
webtroter / Invoke-WireGuardRoutingHelper.ps1
Last active May 17, 2024 05:23
WireGuard Windows Routing Helper Script
[CmdletBinding(DefaultParameterSetName = "PreDown")]
param (
[Parameter(ParameterSetName = "Setup")]
[switch]
$Setup,
[Parameter(ParameterSetName = "Setup")]
[switch]
$RestartWGService,
# WireGuard Interface
[Parameter(Position = 0)]
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 17, 2024 05:23
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
/*
Tetris Move
Have the function TetrisMove(strArr) take strArr parameter being passed
which will be an array containing one letter followed by 12 numbers
representing a Tetris piece followed by the fill levels for the 12 columns
of the board.
Calculate the greatest number of horizontal lines that can be completed
when the piece arrives at the bottom assuming it is dropped immediately
after being rotated and moved horizontally from the top.
@mjbalcueva
mjbalcueva / password-input.tsx
Last active May 17, 2024 05:13
shadcn ui custom password input
"use client"
import { forwardRef, useState } from "react"
import { EyeIcon, EyeOffIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Input, InputProps } from "@/components/ui/input"
import { cn } from "@/lib/utils"
const PasswordInput = forwardRef<HTMLInputElement, InputProps>(
({ className, ...props }, ref) => {
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 17, 2024 05:05
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

func scrollViewDidScroll(_ scrollView: UIScrollView) {
for (i, view) in scrollView.subviews.enumerated() {
var ty = 0.0
if scrollView.contentOffset.y < 0 {
// We're scrolling past the top of the scroll view.
// Translate each item in the scroll view by some amount based on its index and scroll offset.
ty = CGFloat(i) * abs(offsetY) / 8.0 * pow(1.12, CGFloat(i))
}
view.transform = CGAffineTransform(translationX: 0, y: ty)
}
@chriszielinski
chriszielinski / Image+Trim.swift
Last active May 17, 2024 05:00
[Swift 5] NSImage/UIImage Crop/Trim Transparency
// Image+Trim.swift
//
// Copyright © 2020 Christopher Zielinski.
// https://gist.github.com/chriszielinski/aec9a2f2ba54745dc715dd55f5718177
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@pichuang
pichuang / sources.list
Last active May 17, 2024 04:59
Kali Linux source.list /etc/apt/sources.list
deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free
#deb http://kali.cs.nctu.edu.tw/kali kali-rolling main non-free contrib