Skip to content

Instantly share code, notes, and snippets.

View fzed51's full-sized avatar
πŸ‘¨β€πŸ’»
I may be slow to respond.

Fabien S. fzed51

πŸ‘¨β€πŸ’»
I may be slow to respond.
View GitHub Profile
@zippy1981
zippy1981 / DisplayImage.ps1
Created May 13, 2011 02:20
Display an image from Windows Powershell
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
$file = (get-item 'C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg')
#$file = (get-item "c:\image.jpg")
$img = [System.Drawing.Image]::Fromfile($file);
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274
@jpoehls
jpoehls / Elevate-Process.ps1
Created December 14, 2011 20:34
Elevate-Process (sudo) for PowerShell
# Put this in your PowerShell profile.
function Elevate-Process
{
<#
.SYNOPSIS
Runs a process as administrator. Stolen from http://weestro.blogspot.com/2009/08/sudo-for-powershell.html.
#>
$file, [string]$arguments = $args
$psi = New-Object System.Diagnostics.ProcessStartInfo $file
@ser1zw
ser1zw / dragdrop.ps1
Created March 22, 2012 17:48
PowerShell Drag & Drop sample
# PowerShell Drag & Drop sample
# Usage:
# powershell -sta -file dragdrop.ps1
# (-sta flag is required)
#
Function DragDropSample() {
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$form = New-Object Windows.Forms.Form
$form.text = "Drag&Drop sample"
$listBox = New-Object Windows.Forms.ListBox
@jpoehls
jpoehls / mklink.psm1
Created June 7, 2012 19:40
Native PowerShell wrapper for MKLINK.
@chklauser
chklauser / Manage-AppConfig.ps1
Created July 22, 2012 19:23
PowerShell script to make ~\Documents more usable, hides directories and makes them accessible via a symlink in a different location.
param(
[Parameter(Position=0)]
$Item,
[Switch] $WhatIf,
[String] $AppConfig = "$env:HOMEDRIVE$env:HOMEPATH\AppConfig",
[String] $BaseDir = ".",
[Parameter(ParameterSetName="register")]
[Switch]
$Register,
@bzerangue
bzerangue / array2xml.php
Last active June 28, 2023 04:29
Decoding JSON to a PHP Array and then converting it to XML.
<?php
/**
* Array2XML: A class to convert array in PHP to XML
* It also takes into account attributes names unlike SimpleXML in PHP
* It returns the XML in form of DOMDocument class for further manipulation.
* It throws exception if the tag name or attribute name has illegal chars.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes
* License: Apache License 2.0
@MattSeen
MattSeen / .gitconfig
Last active April 30, 2024 09:20
These are a series of the Git alias I use on use on a daily basis. I have included references to the places where I have found each one to give the authors due credit.
[alias]
# Source: http://stackoverflow.com/questions/7066325/how-to-list-show-git-aliases#answer-7067489
# Found on stackoverflow list all available aliases ==
alias = config --get-regexp '^alias.*'
s = status
ss = status --short
ssb = status --short --branch
co = commit
@bohwaz
bohwaz / get_time_from_ntp.php
Created April 28, 2017 02:48
Fetches timestamp from a NTP server in PHP
<?php
/**
* Returns UNIX timestamp from a NTP server (RFC 5905)
*
* @param string $host Server host (default is pool.ntp.org)
* @param integer $timeout Timeout in seconds (default is 10 seconds)
* @return integer Number of seconds since January 1st 1970
*/
function getTimeFromNTP($host = 'pool.ntp.org', $timeout = 10)
@zcmgyu
zcmgyu / CHANGELOG.md
Created December 28, 2017 17:10 — forked from dispix/CHANGELOG.md
OAUTH2 Authentication and token management with redux-saga

Revision 5

  • Fix error parsing

Revision 4

  • Add missing yield in the login function

Revision 3

@INQTR
INQTR / axios-interceptors-refresh-token.js
Last active March 2, 2025 13:30
Axios interceptors token refresh for few async requests. ES6
import axios from "axios";
import { settings } from "../settings";
import { authAPI } from ".";
const request = axios.create({
baseURL: settings.apiV1,
});
request.interceptors.request.use(
(config) => {