Skip to content

Instantly share code, notes, and snippets.

View lyf-is-coding's full-sized avatar
💓
Live Laugh Love

lyf-is-coding

💓
Live Laugh Love
View GitHub Profile
@marbel82
marbel82 / EnumGetValuesCastBenchmark.md
Last active August 18, 2022 13:18
When we iterate on the Enum values, why it is faster when we explicitly cast type?

This post refers to:

  • [Simple test of Enum.GetValues() with casting type and without][my_prev_enum_simple]
  • stackoverflow.com: [How do I iterate over an enum?][stack_comm_enum_bdn]
  • [bartoszkp/EnumGetValuesTest.cs][bartoszkp_enum]

When we iterate on the Enum values, why it is faster when we explicitly cast type?

@marbel82
marbel82 / EnumGetValuesCastTest.md
Last active August 18, 2022 13:18
Simple test of Enum.GetValues() with casting type and without

Simple test of Enum.GetValues() with casting type and without

It was some time ago. I wondered why some people explicitly cast the type of value returned by the Enum.GetValues() function. I did some tests.

Unfortunately, the functions are so short that StopWatch is inaccurate. Therefore, I call them in a large loop and then divide the time by the number of repetitions.

public class C {
    enum Sizes
	{
@sudhackar
sudhackar / Frida.js
Last active September 10, 2023 04:43
Frida hook Java functions in Android
Java.perform(function () {
var act1 = Java.use("CryptoUtilities");
act1.getKey.implementation = function (arg1) {
var ret = this.getKey("v2");
return ret;
};
var db1 = Java.use("android.database.sqlite.SQLiteDatabase");
db1.rawQuery.overload('java.lang.String', '[Ljava.lang.String;').implementation = function (arg1, arg2){
console.log(arg1,arg1.replace("v1","v2"));
var ret = this.rawQuery(arg1.replace("v1","v2"),arg2);
NetLimiter 3
Registration name: Peter Raheli
Registration code: C99A2-QSSUD-2CSBG-TSRPN-A2BEB
NetLimiter 4
Registration Name: Vladimir Putin #2
Registration Code: XLEVD-PNASB-6A3BD-Z72GJ-SPAH7
https://www.netlimiter.com/download
# Netlimiter Full Netlimiter Activated Netlimiter cracked Netlimiter Full Version Netlimiter Serial Netlimiter keygen Netlimiter crack Netlimiter 4 serial Netlimiter 4 Crack Netlimiter 4 register Netlimiter 4 patch Netlimiter full Full version Netlimiter 4 Activated Netlimiter 4 Cracked Netlimiter Pro
@heiswayi
heiswayi / SimpleLogger.cs
Last active March 14, 2024 00:19
Simple C# logger utility class
/*
MIT License
Copyright (c) 2016 Heiswayi Nrird
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
import discord
from discord.ext import commands
from asyncio import sleep
me = commands.Bot(command_prefix='.', self_bot=True)
@me.event
async def on_ready():
@tommyready
tommyready / NetworkAdaptersUtility.cs
Last active April 18, 2024 15:01
Using C# to Disable and Enable a Network Adapter
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace NetworkAdaptersUtility
{
class Program
{
static void Main(string[] args)
{
@ctrl-freak
ctrl-freak / android-adb-pull-apk.md
Last active May 1, 2025 03:27
Retrieve APK from Non-Rooted Android Device through ADB

https://stackoverflow.com/a/18003462/348146

None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name (this may vary with the version of Android OS). The following sequence of commands is what worked for me on a non-rooted device:

  1. Determine the package name of the app, e.g. com.example.someapp. Skip this step if you already know the package name.

    adb shell pm list packages

    Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

@whoshuu
whoshuu / curlget.cpp
Created March 31, 2015 06:44
Example libcurl GET request
#include <curl/curl.h>
#include <string>
size_t writeFunction(void *ptr, size_t size, size_t nmemb, std::string* data) {
data->append((char*) ptr, size * nmemb);
return size * nmemb;
}
int main(int argc, char** argv) {
auto curl = curl_easy_init();
@bartoszkp
bartoszkp / EnumGetValuesTest.cs
Last active August 18, 2022 13:16
Enum.GetValues: cast vs. no cast to typed array test.
// Intel(R) Core(TM) i7-2600 CPU @ 3.40 GHz 3.40 GHz
// 16 GB RAM, Windows 7, 64 bit
//
//No cast:0.854751600000001 +- 0.182965645566156ms
//Cast:0.724137 +- 0.148216330378943ms
// Conclusion: Cast is indeed faster, but remember that we are talking here about _miliseconds_
// for 1000 enumerations of an enum with 1000 elements. First verify whether this is really significant in your code, before
// proceeding with micro-optimizations.
// Context: http://stackoverflow.com/a/105402/2642204