Skip to content

Instantly share code, notes, and snippets.

@nathan130200
nathan130200 / LICENCE SUBLIME TEXT
Created November 28, 2016 12:43
Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
93F6323C FD7F7544 3F39C318 D95E6480
FCCC7561 8A4A1741 68FA4223 ADCEDE07
@nathan130200
nathan130200 / FileDownloader.cs
Created December 17, 2017 14:32 — forked from yasirkula/FileDownloader.cs
C# Download Public File From Google Drive™ (works for large files as well)
using System;
using System.IO;
using System.Net;
public static class FileDownloader
{
private const string GOOGLE_DRIVE_DOMAIN = "drive.google.com";
private const string GOOGLE_DRIVE_DOMAIN2 = "https://drive.google.com";
// Normal example: FileDownloader.DownloadFileFromURLToPath( "http://example.com/file/download/link", @"C:\file.txt" );
@nathan130200
nathan130200 / format.cs
Created August 31, 2018 15:28
C# printf function
private static string PrintF(params object[] a)
{
if (a == null || a.Length == 0) return string.Empty;
int[] i = { 1 };
string s = (a[0] is string) ? System.Text.RegularExpressions.Regex.Replace((string)a[0], "%[sdi%]",
match => match.Value == "%%" ? "%" : i[0] < a.Length ? a[i[0]++].ToString() : match.Value) : a[0].ToString();
for (; i[0] < a.Length; i[0]++)
s += " " + a[i[0]];
return s;
}
@nathan130200
nathan130200 / CommandContext.kt
Created August 31, 2018 17:46 — forked from luaugg/CommandContext.kt
Basic Kotlin code example with very helpful comments.
package kunou.commands
import kunou.startup.Kunou
import net.dv8tion.jda.core.entities.Member
import net.dv8tion.jda.core.entities.Message
import org.slf4j.LoggerFactory
import java.lang.NumberFormatException
/* This is an example of primary constructors in Kotlin. Note the use of the "val" keyword, which declares
an immutable property/field/variable. Notice how it can be used in constructors to declare properties.
@nathan130200
nathan130200 / YtAudio.cs
Created November 15, 2018 17:58 — forked from Emzi0767/YtAudio.cs
YouTube audio stream url extractor
// requires Jint
//
// this can be used for video streams as well, with few modifications
public async Task<string> GetYtAudioUrl(string id)
{
await Task.Yield();
var utf8 = new UTF8Encoding(false);
var wc = new WebClient();
@nathan130200
nathan130200 / gist:83c55446e9adc17ee2030d08a99eaa61
Created February 4, 2019 11:24 — forked from gregerhalltorp/gist:1853953
Custom type converter for converting between MongoDB.Bson.ObjectId and string
public class ObjectIdConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context,
Type sourceType)
{
if (sourceType == typeof(string))
return true;
return base.CanConvertFrom(context, sourceType);
}
@nathan130200
nathan130200 / ow cmd
Created September 16, 2019 10:26 — forked from Toyz/OW1 CMD
All command line options to Overwatch
----------POSSIBLE OPTIONS----------------------------------------------
--account : [optional] account name to login with
--key : [optional] connection key for the server (defaults to 1 in debug)
--automationRoutine : [optional] automation routine to run after login
--startAutomationGraph : [optional] start up and execute automation global graph using provided guid
--gatherEffectStats : [optional] enables effect stat gathering
--noautoconnect : [optional] Do not automatically connect to a server
--fastQuit
--dumpAssetNames : Write to <file> a JSON map of GUID (String "0xabc...") to asset name for all soft assets
--startPosition : [optional] start position when joining a map
package test;
import cn.nukkit.network.Network;
import cn.nukkit.network.protocol.BatchPacket;
import cn.nukkit.network.protocol.DataPacket;
import cn.nukkit.network.protocol.ProtocolInfo;
import cn.nukkit.raknet.protocol.EncapsulatedPacket;
import cn.nukkit.utils.Zlib;
import java.util.Arrays;

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@nathan130200
nathan130200 / ffmpegToWeb.js
Created May 25, 2021 01:42 — forked from moeiscool/ffmpegToWeb.js
FFMPEG to Web Browser with Express, Socket.IO and JSMPEG
// Shinobi (http://shinobi.video) - FFMPEG H.264 over HTTP Test
// How to Use raw H.264 (Simulated RTSP)
// 1. Start with `node ffmpegToWeb.js`
// 2. Get the IP address of the computer where you did step 1. Example : 127.0.0.1
// 3. Open VLC and "Open Network Stream".
// 4. Input the following without quotes : `http://127.0.0.1:8001/h264` and start.
var child = require('child_process');
var io = require('socket.io');
var events = require('events');