Skip to content

Instantly share code, notes, and snippets.

@justsml
justsml / fetch-api-examples.md
Last active February 24, 2024 18:05
JavaScript Fetch API Examples
@josy1024
josy1024 / SH-Set-KnownFolderPath.ps1
Last active October 23, 2023 02:11
powershell set shell folders! Use the SHGetFolderPath or SHGetKnownFolderPath function instead Shell Folders
<#
.SYNOPSIS
Sets a known folder's path using SHSetKnownFolderPath.
.PARAMETER Folder
The known folder whose path to set.
.PARAMETER Path
The path.
#>
# USAGE: # Set-KnownFolderPath -KnownFolder 'Desktop' -Path '\\netserver\desktop\username\desktop'
# FROM: http://stackoverflow.com/questions/25709398/set-location-of-special-folders-with-powershell
@giordanocardillo
giordanocardillo / install-pdf2htmlEX-ubuntu-14.04.sh
Last active April 27, 2022 19:21
Installing pdf2htmlEX on Ubuntu Server 14.04
#!/bin/sh
RESTORE=$(echo '\033[0m')
BOLD=$(echo '\033[1m')
GREEN=$(echo '\033[1;32m')
echo
echo ${GREEN}
echo "------------------------------"
echo " Installing prerequisites "
echo "------------------------------"
echo
@Jaykul
Jaykul / Get-ParameterValues.ps1
Created April 27, 2016 06:41
Rather better than `$PSBoundParameters`
function Get-ParameterValues {
<#
.Synopsis
Get the actual values of parameters which have manually set (non-null) default values or values passed in the call
.Description
Unlike $PSBoundParameters, the hashtable returned from Get-ParameterValues includes non-empty default parameter values.
NOTE: Default values that are the same as the implied values are ignored (e.g.: empty strings, zero numbers, nulls).
.Example
function Test-Parameters {
[CmdletBinding()]
function Export-MFT {
<#
.SYNOPSIS
Extracts master file table from volume.
Version: 0.1
Author : Jesse Davis (@secabstraction)
License: BSD 3-Clause
.DESCRIPTION
@fearthecowboy
fearthecowboy / associate-powershell.ps1
Last active September 15, 2017 14:14
Make PowerShell scripts runnable from anywhere ( ie, CMD.EXE, Explorer, Run Dialog, etc)
#==============================================================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@kouk
kouk / How to add a submodule with shallow checkout and shallow clone
Last active April 17, 2024 20:16
.How to add a submodule with shallow checkout and shallow clone
If you have a huge repository (in size and in history) and want to add a subfolder
to your project as a submodule you can follow this example to save time and space
using git's shallow clone and shallow checkout feature. It is a bit more complicated
in this example because I assume that you want your submodule to track a non-default
branch, called `mybranch`, instead of the `master` branch. Things could probably get
a lot simpler when using the default branch. After following the commands in these
examples you can use `git submodule update` and `git submodule update --remote` as normal.
@danharper
danharper / background.js
Last active March 30, 2024 18:25
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@andrewkolesnikov
andrewkolesnikov / get.rb
Last active December 13, 2015 23:39 — forked from sxua/get.rb
Exports every wall post from vkontakte.ru to a CSV Updated in Feb 2013, Ruby 1.9
# Usage:
# 1. Install required gems
# $ sudo gem install mechanize progressbar
#
# 2. Run with [vk.com|vkontakte.ru] [remixsid cookie] and [your_profile_id]
# $ ruby ./fetch.rb vk.com a528621366f13fb859a120b3a8c357dc98c1f7d93f5e66666662 8666676
# 54% |ooooooooooooooooooooooooooooooooooooooooooooooooooooo | ETA: 0:01:49
#
# 3. Enjoy the output
@obeattie
obeattie / hide-blogger-warning.user.js
Created April 11, 2010 08:39
Automatically skips the obnoxious "Content warning" on Blogger sites (only those with blogspot.com domains) — and doesn't require a page reload to do so. Winnah. To install using Google Chrome or Grasemonkey, click raw and you'll be prompted to install th
// ==UserScript==
// @name Blogger Content Warning Skip
// @description Automatically skips the content warning on blogspot.com sites without reloading the page
// @match http://*.blogspot.com/*
// ==/UserScript==
var fireEvent = function(obj,evt){
var fireOnThis = obj;
if (document.createEvent) {
var evObj = document.createEvent('MouseEvents');