Skip to content

Instantly share code, notes, and snippets.

View bogdangrigg's full-sized avatar

Luca-Bogdan Grigorescu bogdangrigg

View GitHub Profile
@bogdangrigg
bogdangrigg / dev_base.ps1
Last active August 29, 2015 14:02
Dev machine base setup
$env:Path += ";C:\Chocolatey\bin"
choco install ChocolateyGUI
choco install git poshgit
choco install VisualStudio2013Professional
choco install python pip easy.install
choco install notepadplusplus SublimeText3 aptana-studio
choco install winmerge linqpad4 SourceTree dotPeek SourceCodePro ScriptCs sqliteadmin HxD
choco install sysinternals filezilla winscp putty fiddler4 windirstat lockhunter wireshark truecrypt rdcman nmap
choco install GoogleChrome Firefox flashplayerplugin adobereader
choco install skype xnview adobereader vlc dropbox teamviewer paint.net 7zip curl Wget
@bogdangrigg
bogdangrigg / revert_lightroom.sqlite
Last active August 29, 2015 14:03
This SQLite query reverts all the pictures in a Lightroom collection the next-to-last step in their edit history
/*
The following SQLite query reverts all the photos in a Lightroom collection the next-to-last step in their edit history
It was initially provided by Dorin Nicolaescu-Musteață
Execution steps:
1. Create a Lightroom collection named "UndoLastOperation" and add the over-edited photos
2. Close Lightroom and backup the catalog
3. Open the .lrcat file (usually from C:\Users\<User>\Pictures\Lightroom) in SQLite Administrator (http://sqliteadmin.orbmu2k.de/)
4. Run this file (Copy-Paste + F9)
5. Close SQLite Administrator
Update-ExecutionPolicy Unrestricted
Move-LibraryDirectory "Personal" "$env:UserProfile\skydrive\documents"
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Set-TaskbarSmall
Enable-RemoteDesktop
cinst ChocolateyGUI
# dev tools
cinst VisualStudio2013Professional
@bogdangrigg
bogdangrigg / gist:5ea6dcd1cac188264c6a
Created February 6, 2015 14:48
Check if any application is using the SMTP port
Get-NetTCPConnection -RemotePort 25 -ErrorAction SilentlyContinue | Format-Table
@bogdangrigg
bogdangrigg / sso_login_freshdesk.cs
Created May 19, 2016 08:18 — forked from darkpssngr/sso_login_freshdesk.cs
SSO Login for Freshdesk support portal - ASP.Net C# Sample Code
static string GetSsoUrl(string baseUrl, string secret, string name, string email) {
var timems = (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds.ToString();
return String.Format("{0}/login/sso?name={1}&email={2}&timestamp={3}&hash={4}",
baseUrl, Server.UrlEncode(name), Server.UrlEncode(email), timems, GetHash(secret, name, email, timems));
}
private static string GetHash(string secret, string name, string email, string timems) {
var input = name + secret + email + timems;
var keybytes = Encoding.Default.GetBytes(secret);
var inputBytes = Encoding.Default.GetBytes(input);
@bogdangrigg
bogdangrigg / GET_ALL_COLUMNS.sql
Last active June 16, 2016 11:40
Get all columns for all tables & views
-- from: https://stackoverflow.com/questions/2729126/how-to-find-column-names-for-all-tables-in-all-databases-in-sql-server
SELECT
s.name as ColumnName
,sh.name+'.'+o.name AS ObjectName
,o.type_desc AS ObjectType
,CASE
WHEN t.name IN ('char','varchar') THEN t.name+'('+CASE WHEN s.max_length<0 then 'MAX' ELSE CONVERT(varchar(10),s.max_length) END+')'
WHEN t.name IN ('nvarchar','nchar') THEN t.name+'('+CASE WHEN s.max_length<0 then 'MAX' ELSE CONVERT(varchar(10),s.max_length/2) END+')'
WHEN t.name IN ('numeric') THEN t.name+'('+CONVERT(varchar(10),s.precision)+','+CONVERT(varchar(10),s.scale)+')'
ELSE t.name
public class FeedStorage
{
public FeedStorage()
{
GroupStoryChildIdList = "";
}
[PrimaryKey]
public string Id { get; set; }
public DateTime FeedItemDateTime { get; set; }
public string ItemType { get; set; }
tcpping.exe google.com:80
nameresolver.exe google.com
@bogdangrigg
bogdangrigg / http-ping.ps1
Last active December 15, 2016 18:30
http-ping.ps1
##############################################################################
## Original version @ https://gallery.technet.microsoft.com/scriptcenter/Powershell-Script-for-13a551b3
## Updated: 5/26/2015, Version 2.0, By: Sangamesh (sangameshb@yahoo) on 5/26/2015
##############################################################################
param (
[string]$url = 'https://google.com',
[switch]$t = $true,
[switch]$help
)
@bogdangrigg
bogdangrigg / Get-InternetFacingIP.ps1
Last active March 20, 2020 09:19
Returns the public / Internet-facing IP used by a host. Be careful with multiple outgoing IPs.
### WINDOWS ###
# option #1: generic version, from here: https://gallery.technet.microsoft.com/scriptcenter/Get-ExternalPublic-IP-c1b601bb
Invoke-RestMethod http://ipinfo.io/json | Select -exp ip
# option #2: Azure metadata service
(Invoke-RestMethod -H @{'Metadata'='true'} "http://169.254.169.254/metadata/instance?api-version=2017-08-01").network.interface.ipv4.ipAddress.publicIpAddress
### LINUX ###
dig +short myip.opendns.com @resolver1.opendns.com