Skip to content

Instantly share code, notes, and snippets.

@nathan130200
nathan130200 / WarfaceRadiationHelpFormatter.cs
Created April 15, 2019 18:23
Formatador de ajuda do bot Warface Radiation.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DSharpPlus;
using DSharpPlus.CommandsNext;
using DSharpPlus.CommandsNext.Converters;
using DSharpPlus.CommandsNext.Entities;
using DSharpPlus.Entities;
using WarfaceRadiation.Attributes;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using System.Text;
using agsXMPP;
using agsXMPP.protocol.client;
using agsXMPP.Xml.Dom;
using U = agsXMPP.Uri;
@nathan130200
nathan130200 / AsyncTask.cs
Last active May 27, 2019 18:45
Small "conversion" about Android AsyncTask to .NET (+3.5) | Tested with .NET 3.5 WinForms and modify UI by other threads.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace System.Threading
{
public abstract class AsyncTaskBase
{
public SynchronizationContext Context { get; }
@nathan130200
nathan130200 / script.sql
Last active May 31, 2019 19:42
Testando coisas de SQL e modelo relacional.
-------------------------
---- Questão: 106432 ----
-------------------------
-- ALUNO (matricula, nome, endereço, telefone)
-- CURSA (matricula, codigo)
-- matricula REFERENCIA matricula em ALUNO
-- codigo REFERENCIA codigo em DISCIPLINA
@nathan130200
nathan130200 / DiscordExtensions.cs
Last active June 7, 2019 14:34
D#+: Construct embed by dynamic (expando) object (.NET)
namespace Larpl.Extensions
{
public static class DiscordExtensions
{
static void ValidateEmbed(dynamic d, out bool has_fields, out bool has_timestamp, out bool has_color, out bool has_description)
{
try { has_fields = !(d.fields is null); }
catch { has_fields = false; }
try { has_timestamp = !(d.timestamp is null); }
@nathan130200
nathan130200 / script
Last active June 16, 2019 02:03
Overwatch: 3rd Person Camera with Workshop
Start Camera(
Event Player,
Add(
Add(
Add(
Event Player,
World Vector Of(
Vector(-0.4, 0.0, 0.3),
Event Player,
Rotation
@nathan130200
nathan130200 / setup.bat
Created July 13, 2019 12:09
Install all VSIX in current directory using windows batch file.
@echo off
set app="C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe"
for /r %%f in (*.vsix) do (
call :setup "%%f"
)
goto end
:setup
@nathan130200
nathan130200 / DSharpPlusExtensions.cs
Last active July 14, 2019 15:41
Respond command context with dynamic embed creation.
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using DSharpPlus.CommandsNext;
using DSharpPlus.Entities;
namespace DSharpPlus
{
@nathan130200
nathan130200 / MessageBox.cs
Created July 14, 2019 18:39
C# user32.dll MessageBox Raw implementation without System.Windows.Forms (based on https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox)
namespace User32
{
public static class MessageBox
{
[DllImport("user32.dll")]
static extern int MessageBoxA(IntPtr hWnd,
string lpText,
string lpCaption,
uint uType);
@nathan130200
nathan130200 / ApplicationAssetsDownloader.cs
Last active July 20, 2019 23:24
C# Discord application assets downloader using D#+. (produces a ZIP file with all assets files)
public delegate Task ApplicationAssetsDownloaderEventHandler(DiscordApplicationAsset asset);
class ApplicationAssetsDownloader : IDisposable
{
private ConcurrentQueue<DiscordApplicationAsset> _a;
private ZipArchive _ar;
private MemoryStream _ms;
public event ApplicationAssetsDownloaderEventHandler DownloadStartedAsync;
public event ApplicationAssetsDownloaderEventHandler DownloadCompletedAsync;