Skip to content

Instantly share code, notes, and snippets.

@turibbio
turibbio / PostBuildEvent.ps1
Created July 21, 2015 19:53
Post Build Event
param($ProjectDir)
$TargertDir = $env:LOCALAPPDATA + "\Totem"
$OrigineRisorse = $ProjectDir + "\Resources"
$OrigineTemi = $ProjectDir + "\Themes"
$DestRisorse = $TargertDir + "\Resources"
$DestTemi = $TargertDir + "\Themes"
$OrigineLang = $ProjectDir + "\Languages"
$DestLang = $TargertDir + "\Languages"
Write-Output "Esecuzione azioni Post Build"
@turibbio
turibbio / WriteMessagesToFiles.ps1
Last active August 4, 2017 18:00
Write Log in multiple files with Powershell
function Write-Messages
{
[CmdletBinding()]
param(
[string]$warningFilePath = "C:\Temp\warning.txt",
[string]$errorFilePath = "C:\Temp\error.txt"
)
Write-Host "Host message"
@turibbio
turibbio / WriteMessages.ps1
Created August 18, 2015 16:28
Write-Host vs Write-Output
function Write-Messages
{
[CmdletBinding()]
param()
Write-Host "Host message"
Write-Output "Output message"
}
# Run with:
@emiliano-poggi
emiliano-poggi / foreach.ps1
Created April 4, 2011 20:58
POSH: For each constructs
# foreach statement
foreach ($ps1 in ls -filter $home\*.ps1) {$ps1.length/1024}
# foreach inside the pipeline
ls -filter $home\*.ps1 | ForEach-Object -process {$_.length/1024}
# foreach inside the pipeline omitting -process
ls -filter $home\*.ps1 | ForEach-Object {$_.length/1024}
# foreach inside the pipeline using foreach alias
@damnit
damnit / hackedHN.js
Last active May 14, 2018 04:18
Tampermonkey style script for Hacker News
// ==UserScript==
// @name hackedHN.js
// @namespace https://gist.github.com/embayer/
// @version 1.0
// @description big font sizes, full width and alternate mark inversion rows, colorful points
// @match https://news.ycombinator.com/
// @copyright 2015, embayer
// ==/UserScript==
(function styleRows() {
@SkyLeach
SkyLeach / README.md
Last active September 27, 2018 22:41
Userscript for extracting data from Audible.com

Somewhat tempermental userscript for extracting data from Audible.com

@1999
1999 / procrastination_en.js
Last active February 2, 2019 11:32
Script samples for Control Freak extension
// Stop procrastination (a script for Control Freak extension)
// Paste this code into "Javascript" tab with a scope set to "All"
// @see https://chrome.google.com/webstore/detail/control-freak/jgnchehlaggacipokckdlbdemfeohdhc
var now = new Date();
if (now.getHours() >= 0 && now.getHours() < 6) {
var defaultOverflow = getComputedStyle(document.body).overflow || "visible";
document.body.style.overflow = "hidden";
var overlay = document.createElement("div");
overlay.style.background = "rgba(0, 0, 0, .85)";
// Bunch of javascript from the YouTubes API sample code which allows me to grab all my daily
// subsciption videos and insert them into a single playlist for easy listening.
// Currently I would have to open each song into a tab and listen to them one by one. Now I can
// just hit 'Play All' on the playlist and listen to all the new posts.
// Define some variables used to remember state.
var playlistId = 'PLyDoEZ08Zam3n_bPBi2ylc_NZV--spj5_';
var channelId;
var playlistArray = [];
@michih57
michih57 / pygmentize
Created April 6, 2012 13:59
Ugly wrapper around pygmentize to speed up pdflatex using the minted package for syntax highlighting
#!/bin/bash
# An ugly hack to speed up pdflatex using the minted package
# place this file with the name 'pygmentize' somewhere on your
# path before the 'real' pygmentize, such that this file gets
# executed and can act as a wrapper around the 'real' pygmentize.
# This script computes a hash-value (md5sum) of the input file
# from minted and caches the output of pygmentize.
# The working directory is used to store the cached files (it's an ugly hack...)
# The real pygmentize command, may need customization to work on your system.
@abombss
abombss / PSAddMember.psm1
Created August 8, 2012 19:02
PSAddMember -- Extend all objects with an easier to use PSAddMember function
Function PSAddMember() {
$this = $args[0]
switch($args.Count) {
2 {
($args[1] -as [HashTable]) | %{ $_.GetEnumerator() } | %{ Add-Member -InputObject $this -Name $_.Name -value $_.Value -MemberType Noteproperty -Force -PassThru }
break;
}
3 {