Skip to content

Instantly share code, notes, and snippets.

@bskiefer
bskiefer / .php
Created January 24, 2014 16:05 — forked from myselfsufiyan/.php
<?php
// place this code inside a php file and call it f.e. "download.php"
$path = $_SERVER['DOCUMENT_ROOT']."/path2file/"; // change the path to fit your websites document structure
$fullPath = $path.$_GET['download_file'];
if ($fd = fopen ($fullPath, "r")) {
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);
@bskiefer
bskiefer / bluetooth.sh
Last active May 27, 2019 02:23
Connect rpi bluetooth devices automatically
#!/bin/bash
BLUETOOTH_DIR=/var/lib/bluetooth
for CONTROLLER_DIR in ${BLUETOOTH_DIR}/*; do
CONTROLLER_MAC=$(basename ${CONTROLLER_DIR})
if [ -d "${CONTROLLER_DIR}" ] && [[ $CONTROLLER_MAC =~ ^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$ ]] ; then
for DEVICE_DIR in ${CONTROLLER_DIR}/*; do
DEVICE_MAC=$(basename ${DEVICE_DIR})
if [ -d "${DEVICE_DIR}" ] && [[ $DEVICE_MAC =~ ^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$ ]] ; then
@bskiefer
bskiefer / blackfire.sh
Last active March 4, 2020 09:26
PHPBrew Blackfire Extension Installer
#!/usr/bin/env bash
# Automatically finds your php version, installs, and enables the blackfire extension on your current php.
source ~/.phpbrew/bashrc
EXTENSION_URL="https://packages.blackfire.io/binaries/blackfire-php/1.27.0/blackfire-php-linux_amd64-php-VERSION.so"
PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION . PHP_MINOR_VERSION;')
EXT_DIR=$(phpbrew path ext)
{
"info": {
"_postman_id": "2488776b-8759-4fb7-ba5f-252d41ec5817",
"name": "Gov2Go",
"description": "## Getting Started\n\nRun each request under Schema\n> This stores schema for each request type in your variables, which is used for testing.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Schema",
{
"info": {
"_postman_id": "2488776b-8759-4fb7-ba5f-252d41ec5817",
"name": "Tag Renewal",
"description": "### Contents\n- Chains: Full steps to completing a renewal in Gov2Go. All requests are testable and currently check for 2 types of valid schema (generic and step-specific), status code, and no errors.\n- Errors: The tag renewal mock is loaded with error-specific plates that trigger a certain error. These tests parse the error text to confirm the correct error was throw.\n- Translate: Checks translation responses.\n- Tests: General tests to confirm the forms act appropriately when a certain scenario's requirements are met.\n- Schema: Loads the environment with form specific schema.\n\n### Schema\nIf the schema must change, select the appropriate schema request and modify the JSON schema under **Pre-request scripts**. It is best to run the request for your target environment upon initialization.\n\n### Collection Tests\n- Schema\n - set by `pm.environment.set(\"schema-key\", \"address\");` in the pr
@bskiefer
bskiefer / clean_node_vendor_dirs.md
Last active May 18, 2022 17:57
List & delete all node_modules and vendor directories recursively

Output:

293M /Users/name/repos/app1/vendor

504M /Users/name/repos/app1/node_modules

423M /Users/name/repos/app2/node_modules

View folders sizes:

find ~/repos -type d \( -name "vendor" -o -name "node_modules" \) -exec du -sh {} \; -maxdepth 2

Delete folders

find ~/repos -type d ( -name "vendor" -exec du -sh {} ; -o -name "node_modules" -exec du -sh {} ; ) -exec rm -rf {} ; -maxdepth 2

@bskiefer
bskiefer / reset-expired-ad-password.ps1
Created February 16, 2022 21:58
Reset Expired AD Password
function Set-PasswordRemotely {
[CmdletBinding(DefaultParameterSetName = 'Secure')]
param(
[Parameter(ParameterSetName = 'Secure', Mandatory)][string] $UserName,
[Parameter(ParameterSetName = 'Secure', Mandatory)][securestring] $OldPassword,
[Parameter(ParameterSetName = 'Secure', Mandatory)][securestring] $NewPassword,
[Parameter(ParameterSetName = 'Secure')][alias('DC', 'Server', 'ComputerName')][string] $DomainController
)
Begin {
$DllImport = @'
@bskiefer
bskiefer / .pre-commit-config.yaml
Created April 1, 2022 17:04
pre-commit hooks & config
repos:
- hooks:
- id: trailing-whitespace
- id: check-docstring-first
- id: check-json
- id: pretty-format-json
- id: check-merge-conflict
- id: check-yaml
- id: debug-statements
- id: name-tests-test
@bskiefer
bskiefer / README.md
Last active June 10, 2024 14:50
VSCodium Update Extensions from VS Marketplace

This script will gather the extensions currently installed for VSCodium and update them from marketplace.visualstudio.com automatically.

  • Packages defined under $SKIP are ignored.
  • Old extension folders are removed before the update is installed.

Why?

  • open-vsx.org doesn't get updated very quickly, if at all
  • it's "illegal" to use the VS Marketplace as the extension source in non-M$ products
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp74\Rector\ArrowFunction\ArrowFunctionToAnonymousFunctionRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Visibility\Rector\ClassMethod\ExplicitPublicClassMethodRector;