Skip to content

Instantly share code, notes, and snippets.

View PurwantoGZ's full-sized avatar
🏠
Working from home

Purwanto PurwantoGZ

🏠
Working from home
  • Tangerang Banten
  • 12:52 (UTC -12:00)
View GitHub Profile
@PurwantoGZ
PurwantoGZ / gist:7a21bbc1c1e775a2d82538c09ae54b20
Created June 1, 2021 08:46 — forked from richardschoen/gist:78ed5bd3b0656ba8eb4adfff9715e811
C# - set directory permissions for Everyone to Full Control. Useful when you need to store settings and other files in your app directory
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Principal;
using System.Security.AccessControl;
using System.IO;
namespace RSSetDirPermissionsCS
Command Title Command
Show list virtual machine VBoxManage list vms
Start the Guest VM in headless mode VBoxManage startvm {uui} --type headless
Show list active machine VBoxManage list runningvms
Get Ip Info machine VBoxManage guestproperty get "Ubuntu16" "/VirtualBox/GuestInfo/Net/0/V4/IP"
Shutdown/poweroff machine VBoxManage controlvm {uui} poweroff
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
@PurwantoGZ
PurwantoGZ / ExcelData.cs
Last active April 23, 2019 08:20
Upload File Excel using EPPlus
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Astra.PartOnline.Domain.Models
{
public class ExcelData
{
@PurwantoGZ
PurwantoGZ / Encrypt
Created March 15, 2019 09:01
Encryp Decrypt C#
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Security.Cryptography;
@PurwantoGZ
PurwantoGZ / getqutes.php
Created November 22, 2017 02:41
Google Finance API
public function getQuetesv2($ticker)
{
$infoUrl='https://finance.google.com/finance?q=idx:'.$ticker.'&output=json';
$contents = str_replace('//','',file_get_contents($infoUrl));
$json = json_decode($contents, true);
if(!array_key_exists("results_type",$json)){
$data=$json[0];
@PurwantoGZ
PurwantoGZ / md5.cs
Created April 11, 2017 05:01
Hash String MD5 using C#
private string GetMD5Hash(string input)
{
System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("x2"));
}
@PurwantoGZ
PurwantoGZ / Parsing.cs
Last active March 17, 2017 08:27
Parsing Url in C#
class Program
{
static void Main(string[] args)
{
string url = "nama=purwanto&pacar=cantik & sexy&mobil=subaru & ferari&rumah=besar & mewah&rejeki=lancar & barokah & manfaat&ortu=senang bahagia";
Console.WriteLine("Text Asli\n{0}\n\nCount: {1} item\n",url,ParsingUrl(url).Count);
foreach (var item in ParsingUrl(url))
{
Console.WriteLine("{["+item.Key+"]:["+item.Value+"]}");
}
@PurwantoGZ
PurwantoGZ / Fann.cs
Created February 7, 2017 07:17
Fast Artificial Neural Network C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FANN
{
public class FANN
{