This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Helper methods for determining the platform. | |
| /// </summary> | |
| public static class Platform | |
| { | |
| /// <summary> | |
| /// Gets if the platform is Windows NT or later. | |
| /// </summary> | |
| public static bool IsWindows | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AdHelper | |
| { | |
| public WindowsAccount GetWindowsAccount(string username = "") | |
| { | |
| // NOTE: If the username is not specified, use the current users account | |
| // The username should also include the domain if available | |
| var identity = String.IsNullOrWhiteSpace(username) | |
| ? WindowsIdentity.GetCurrent().Name | |
| : username; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -x | |
| # ================================== | |
| # iptables default configuration script | |
| # | |
| # - this locks down our servers port access | |
| # ================================== | |
| # install fail2ban | |
| sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ImageMagick : IDisposable | |
| { | |
| IntPtr _wand; | |
| public ImageMagick(string file) | |
| { | |
| var data = File.ReadAllBytes(file); | |
| Initialise(data); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class TimeExtensions | |
| { | |
| // Good website for conversions: | |
| // http://www.epochconverter.com/ | |
| // ToUnixTime(DateTime.Parse("20/10/2014 12:00:00 AM")) - should equal 1413734400 | |
| public static long ToUnixTime(this DateTime date) | |
| { | |
| return (date.ToUniversalTime().Ticks - 621355968000000000) / 10000000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-ChildItem .\ -include bin,obj,_ReSharper* -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create or replace procedure delete_object(object_name varchar2, object_type varchar2) | |
| is | |
| v_counter number := 0; | |
| begin | |
| if object_type = 'TABLE' then | |
| select count(*) into v_counter from user_tables where table_name = upper(object_name); | |
| if v_counter > 0 then | |
| execute immediate 'drop table ' || object_name || ' cascade constraints'; | |
| dbms_output.put_line('table ' || object_name || ' deleted'); | |
| end if; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Helper methods for reading configuration values. | |
| /// </summary> | |
| public static class ConfigurationHelpers | |
| { | |
| /// <summary> | |
| /// Reads an enum value from configutation. | |
| /// </summary> | |
| /// <typeparam name="T">The enum type.</typeparam> | |
| /// <param name="key">The configuration key.</param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set serveroutput on; | |
| declare | |
| raw_guid raw(16); | |
| guid varchar2(64); | |
| begin | |
| raw_guid := guid_to_raw ('88c6a267-65d2-48d6-8da2-6f45e2c22726'); | |
| guid := raw_to_guid('67A2C688D265D6488DA26F45E2C22726'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server ipv6only=on; | |
| root /usr/share/nginx/html; | |
| index index.html index.htm; | |
| # Make site accessible from http://localhost/ | |
| server_name localhost; |