Skip to content

Instantly share code, notes, and snippets.

View duncte123's full-sized avatar
:fishsticks:
yummy fishticks

Duncan Sterken duncte123

:fishsticks:
yummy fishticks
View GitHub Profile
@duncte123
duncte123 / PostStats.java
Last active February 12, 2018 16:25
A simple util class to post stats
import net.dv8tion.jda.core.JDA;
import okhttp3.*;
import org.json.JSONObject;
import java.io.IOException;
public class PostStats {
private static final OkHttpClient CLIENT = new OkHttpClient();
@duncte123
duncte123 / simple_xml_encode.php
Last active December 9, 2017 17:38 — forked from paulferrett/simple_xml_encode.php
Super simple class to encode an object into XML.
<?php
class XML {
/**
* Encode an object as XML string
*
* @param Object $obj
* @param string $root_node
* @return string $xml
*/
public static function encodeObj($obj, $root_node = 'response') {
@duncte123
duncte123 / MainSandBox.java
Created January 25, 2019 08:17 — forked from asaskevich/MainSandBox.java
Java Reflection - Remove "private final" modifiers and set/get value to field
package sandbox;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
public class MainSandBox {
public static void main(String[] args) throws Exception {
Example ex = new Example();
// Change private modifier to public
Field f = ex.getClass().getDeclaredField("id");
@duncte123
duncte123 / MarkovChain.java
Created January 30, 2019 14:43 — forked from CalebFenton/MarkovChain.java
Markov Chain implementation
import gnu.trove.map.TCharDoubleMap;
import gnu.trove.map.hash.TCharDoubleHashMap;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
public class MarkovChain implements Serializable {
private static final long serialVersionUID = 986958034001823764L;
@duncte123
duncte123 / laravel-queue.service
Created April 9, 2019 08:30 — forked from thomasjsn/laravel-queue.service
Laravel queue worker using systemd.
# Laravel queue worker using systemd
# ----------------------------------
#
# /lib/systemd/system/queue.service
#
# run this command to enable service:
# systemctl enable queue.service
[Unit]
Description=Laravel queue worker
@duncte123
duncte123 / TwemojiParser.java
Created November 9, 2019 19:14 — forked from danfickle/TwemojiParser.java
Twemoji parser for Java 8 using trie (replaces emoji with img tags).
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@duncte123
duncte123 / generated-second-try.txt
Last active December 6, 2019 13:06
Our first AI autput
Strain and loaf
Shot acrost better than catches the most amount of tread
Knock once the salt
No man is what you get
The pot calling thee croses
Gutsied of nead
Abses make love not work is like a drink with a brame
Life is like a box of chocolates, sometimes hard to find, have an elephant at this mouths have big ears
Kick your own cannot stand
Prime to pleasure
@duncte123
duncte123 / m3u8-to-mp4.md
Last active June 16, 2021 10:25 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@duncte123
duncte123 / index.js
Created January 5, 2022 21:09
Fetch oengus schedule to file
// https://www.npmjs.com/package/ky
const ky = require('ky');
const fs = require('fs');
const MARATHON_ID = '';
// can be found in devtools (f12) -> application -> localstorage -> oengus.io -> token
const TOKEN = '';
async function downloadSchedule() {
const json = await ky.get(`https://oengus.io/api/marathons/${MARATHON_ID}/schedule`, {
@duncte123
duncte123 / TwitchIngest.swift
Created December 13, 2022 06:56 — forked from AFathi/TwitchIngest.swift
A simple Swift enum that contains Twitch RTMP addresses in different cities
//
// TwitchIngest.swift
//
//
// Created by Ahmed Bekhit on 5/12/18.
// Copyright © 2018 Ahmed Bekhit. All rights reserved.
//
// MARK:- Source: https://stream.twitch.tv/ingests/