Vue lecture

Pro-tip: Custom Editors in Unity

If you wanna make custom editors in Unity, be wary of the headaches.

That being said, you could always check the "newly" released Unity C# reference code on how they tackle their own Editors.

For instance, you see some fancy thing they did in their SpriteRenderer editor OnInspectorGUI, go look up the code and get inspired by their magic!
Permalink

Setup GoogleSheetToUnity

1) Go to http://console.developers.google.com/
2) Select a project or create a new one
3) In API & Services (on the left menu), click on Credentials and gen a API Key.
4) You might also want to add an OAuth key for non-public stylesheets
5) In the Dashboard (on the left menu), click on ENABLE APIS AND SERVICES
6) Request access to the Google Sheet API

7) In Unity, open Window > GTSU > Open Config
8) In the Private Tab, set your client ID and Client Secret Code from your OAuth key
9) Request an access code by pressing on "Get Access code", you can then authenticate.
10) Set your API Key in the Public Tab.

For code examples, look it up. :)
Permalink

~Debug your Android apps/games with Unity / Visual Studio~

Be sure to have the USB Debug mode On and that your phone has accepted your PC as such (popup alert on your phone when being plugged). (You can enable USB Debug after you enable the Android Developer mode - Google it)

1) Locate your adb location

To do that, check if it is in the path by typing `adb` in a terminal. If it isn't, run the following command:
setx PATH "%PATH%;<your sdk path>/platform-tools"

(To find your SDK path, open Android Studio > Configure > SDK Manager )
(or Unity > Preferences > External tools)

2) adb tcpip 5555

3) adb connect 192.168.xx.xx

4) adb devices

(You could now safely unplug your USB and "build and run" over Wifi)


---------

adb -s 192.168.xx.xx shell
then `input text "Hello"`
Permalink

Automate storing of Object given parameters at creation

Basically replacing this

class A:
    def __init__(self, b, c, d, e):
        self.b = b
        self.c = c
        self.d = d
        self.e = e

by

class A:
    def __init__(self, b, c, d, e):
        # You can edit parameters' value here before they are being stored
       
        for k, v in vars().items():
            setattr(self, k, v)


By me.
Permalink

Debugging Python script more easily with Notepad++

[path_to_script]\python-no-autoclose.py "$(FULL_CURRENT_PATH)"

In the menu  Run > Run, put this in the text field and hit Save, give it a name and a key combination. Personally I used Shift+F5. Be wary than all key combinations might not work, try it to make sure or change it.

The script:

import sys
import traceback
import subprocess
import os
import pathlib

if sys.argv[1:]:  # Failsafe
    try:
        os.chdir(str(pathlib.Path(sys.argv[1]).parent))
    except Exception as e:
        traceback.print_exc()

    try:
        subprocess.call(['python', sys.argv[1]])
    except Exception as e:
        traceback.print_exc()
else:
    print('I\'m very confused...')

print()
input('Press Enter to exit.')
Permalink

Easily compile some Java

I don't have any experience with compiling Java so I'm just leaving this here for future me.

1) Download Java JDK (Any version should be fine)
2) If you're lucky to have a .gradle file in your app directory, download Gradle. (You can then add gradle to your PATH, but that's optional)
3) Go in the directory where your .gradle file is situated and run

PATH_TO_YOUR_GRADLE/bin/gradle build

4) The compiled .jar will be situated in build/libs

That's it!
Permalink

How to easily extract X seconds of the audio stream of a video,

ffmpeg.exe -i "input.mp4" -vn -t 2:05 -q:a 2 "output.mp3"

-vn removes the video stream,
-t cuts to whichever time you wish, here set to 2min and 5s,
-q:a scales the quality bitrate (I previously had it at 128 kbit/s, with -q:a 2 it resulted into 148.6 kbit/s)

-ss would be to start at said time,

If you're using Windows, you can download ffmpeg here https://ffmpeg.zeranoe.com/builds/ , ffmepg.exe is available in the bin/ directory.

Thank to my dear friend Ramiro, the lord and master of ffmpeg for his greatful help.

EDIT: Glue/concatenate/put together several files together:

ffmpeg -i "concat:input1.mp3|input2.mp3|input3.mp3" -c copy output.mp3
Permalink

Timo, Kevin, Alda et les autres... - Bookmark Bronco

I feel you bro, ... I got no idea what you are talking about (I live in my cave and didn't follow up what was going on) but it makes me sad just to read what you posted.

Live simple, people. Peacefuly. I'm not sure that, whatever actually happened, that it was worth that fuss: life is short. Enjoy it.

I'm not talking about Yolo but I'm sure we'd be better off without fighting amongst, who shouls be considered as, our own.

We can make beautiful things together. But, yeah, if we really can't stand each other then the least we could try would be to ignore each other - that's pretty simple on internet! "Destroying" each other is conter-productive.

Lastly, sure it is easy to talk about it like that when not involved but ain't it the point? Personally I think we need "those people that are outside of it" 's opinions to help us see clearer. It is hard to see clear when we got our noses right in it.

Edit: Also, god knows how relationships and communication can be a hell of a tough situation. Take it easy on yourselves, people. It ain't always simple. Be strong, be happy, RELAX, breath.

(Via http://sebsauvage.net/links/?FI6O7w )
Permalink

The Internet's Own Boy: The Story of Aaron Swartz (CC available)

Il faut que vous regardiez ce documentaire sur Aaron Swartz, sous-titres en français disponibles.

Des lois comme la loi sur l'information n'aurait jamais du passer, tout comme l'Internet l'a fait contre SOPA et PIPA. Que s'est-il passé hein ? Nous francophones n'avons pas assez de couilles, c'est ça ?

PS: Si jamais je suis un peu en retard sur certaines infos, excusez-moi d'avance et je serais content si quelqu'un me corrige.
Permalink

PHP Fun: Exceptions

Ils sont sympas sur le tchat PHP de SO.

Quelques amis m'ont donné des exemples de codes à propos des exceptions en PHP, que j'ai, un peu trop souvent rechigné.

C'est *bô*. Jugez-en par vous même:

http://3v4l.org/NJJjO

function (╯°□°)╯︵┻━┻(){throw new ┻━┻;}
class ┻━┻ extends  Exception {public function __construct() {parent::__construct("Please respect tables! ┬─┬ノ(ಠ_ಠノ)");} public function __toString(){return "┬─┬";}}
// try/catch
try { (╯°□°)╯︵┻━┻ (); } catch ( ┻━┻ $niceguy) {echo $niceguy->getMessage();}
// ok now lets see an uncaught one
(╯°□°)╯︵┻━┻
();

// Output:
Please respect tables! ┬─┬ノ(ಠ_ಠノ)
Fatal error: Uncaught ┬─┬


Et http://3v4l.org/TkNpc

class JeromeException extends Exception
{
    protected $boobies = [];
   
    function __construct($message = null, $code = 0, Exception $previous = null, $arrayOfBoobies = [])
    {
        $this->boobies = $arrayOfBoobies;
    }
   
    function getTraceEx()
    {
        return $this->getTrace() + ['boobies' => $this->boobies];
    }
}

function jeromeIsExceptional()
{
    try {
        throw new JeromeException('herro', 0, null, ['34B', '32C', '36D']);
    }
    catch (JeromeException $e) {
        var_dump($e->getTraceEx());
    }
}

jeromeIsExceptional();
Permalink
❌