Skip to content

Instantly share code, notes, and snippets.

View MythodeaLoL's full-sized avatar

Castle MythodeaLoL

  • Developing Ideas
  • Brazil
View GitHub Profile
@rampion
rampion / try-catch-ex.c
Created April 8, 2009 02:35
TRY/CATCH/FINALLY macros for C
// gcc -o try-catch-ex try-catch.c try-catch-ex.c
#include <stdio.h>
#include "try-catch.h"
// Example of use for try-catch.h
int main(int argc, char *argv[])
{
int i = 101;
printf("before try block...\n");
@dalethedeveloper
dalethedeveloper / gist:1503252
Created December 20, 2011 21:00
Mobile Device Detection via User Agent RegEx

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

@HaNdTriX
HaNdTriX / image_to_data_url.js
Last active February 27, 2022 07:23
Convert an image to base64URL.
/**
* Converts an image to a dataURL
* @param {String} src The src of the image
* @param {Function} callback
* @param {String} outputFormat [outputFormat='image/png']
* @url https://gist.github.com/HaNdTriX/7704632/
* @docs https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement#Methods
* @author HaNdTriX
* @example
*
@douzifly
douzifly / gist:11086408
Created April 19, 2014 14:43
android get package name from jni
static jstring getpkg(JNIEnv* env, jobject thiz, jobject activity) {
jclass android_content_Context =env->GetObjectClass(activity);
jmethodID midGetPackageName = env->GetMethodID(android_content_Context,"getPackageName", "()Ljava/lang/String;");
jstring packageName= (jstring)env->CallObjectMethod(activity, midGetPackageName);
return packageName;
}
@aaronhurt
aaronhurt / curltest.c
Last active November 26, 2023 10:29
example code using libcurl and json-c to post and parse a return from http://jsonplaceholder.typicode.com
/**
* example C code using libcurl and json-c
* to post and return a payload using
* http://jsonplaceholder.typicode.com
*
* License:
*
* This code is licensed under MIT license
* https://opensource.org/licenses/MIT
*
@trueroad
trueroad / Makefile
Last active April 12, 2023 01:06
Unicode Filename Support for MinGW.org / MinGW-w64 Platform Software (hook)
CXX = i686-w64-mingw32-g++
testmain: testmain.cc mingw-utf8-main.cc mingw-utf8-hook.cc \
mingw-utf8-func.cc mingw-utf8-conv.cc
$(CXX) -static -o testmain testmain.cc \
mingw-utf8-main.cc mingw-utf8-hook.cc \
mingw-utf8-func.cc mingw-utf8-conv.cc \
-ldbghelp
clean:
@MaximAlien
MaximAlien / ClassName
Created April 22, 2015 09:19
[Android] [JNI] Method to get class name as std::string
static std::string getClassName(JNIEnv *env, jobject entity, jclass clazz)
{
jmethodID mid = env->GetMethodID(clazz, "getClass", "()Ljava/lang/Class;");
jobject clsObj = env->CallObjectMethod(entity, mid);
jclass clazzz = env->GetObjectClass(clsObj);
mid = env->GetMethodID(clazzz, "getName", "()Ljava/lang/String;");
jstring strObj = (jstring)env->CallObjectMethod(clsObj, mid);
const char* str = env->GetStringUTFChars(strObj, NULL);
std::string res(str);
@gtgt
gtgt / 00-ffmpeg_random_segment_format.patch
Last active April 2, 2023 10:05
ffmpeg - random filename segment patch (this way you only need to protect the playlist, not the segments)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 17ae300..7ff8c22 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3809,6 +3809,36 @@ uint64_t ff_ntp_time(void)
return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US;
}
+static char *randstring(size_t length) {
+ static char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
<?php
header("Connection: close"); // not sure we need this one
header("Content-Encoding: none");
include ("config.php");
use Carbon\Carbon;
ignore_user_abort( true );
set_time_limit(0);
register_shutdown_function('shutdown');
@0xallie
0xallie / lossless-stream-rip-cheatsheet.md
Last active April 27, 2024 04:41
Lossless stream rip cheatsheet

Lossless stream rip cheatsheet

Note: This guide may be slightly outdated. It may be still useful for older releases, but nowadays the vast majority of releases are correctly tagged as WEB-DL (unless it's RARBG/rartv). Protip: prefer looking at file names instead of release names, as they tend to be more accurate.

This is a short cheatsheet to help you determine whether a release from Amazon, Hulu, or Netflix contains the lossless/untouched (as in no further loss of quality compared to what the streaming services provide) video/audio or not. Most newer P2P releases are correctly tagged, but for older releases, it cannot be reliably determined based on the tags alone.

In most cases, non-lossless rips from these services are screen captures (which, when done by professional releasers, should be high quality and contain little to no glitches – see the history section for details), but in some cases they may be simply reencoded from the untouched stream, for example to crop black bars or reencode from a