Skip to content

Instantly share code, notes, and snippets.

@uraimo
uraimo / disable_show_menubar_fullscreen.md
Last active October 9, 2023 07:29
Force disable the menubar or dock appearing when in full screen in MacOS... need this for Sonoma on some applications

This needs to be done on a per-application basis.

Select the application, show package content, edit the plist.info and add:

  ...
  <dict>
  ...
  ...
  <key>LSUIPresentationMode</key>

3

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "Test": "rest"
      },
 "geometry": {
@uraimo
uraimo / graph.md
Last active November 9, 2022 17:37
Create graphs with markdown on github
@uraimo
uraimo / masto_this.go
Created November 7, 2022 10:51
Post a new toot to a Mastodon instance in Go
package main
import (
"os"
"strings"
"context"
"log"
"github.com/mattn/go-mastodon" //Thanks Mattn!
)
@uraimo
uraimo / TaxMan.java
Last active November 7, 2022 14:38
Interview question [entry-level,java,finance]: solve and comment on what's wrong with this sample
// Calculate the tax from the amount as you would do in a real world scenario.
class TaxMan{
//Return the tax as percentage of the amount plus penalty
private static double calcTaxes(long amount, int perc, double penalty){
//fill here
}
public static void main(String args...){
@uraimo
uraimo / bad_code_review.md
Created May 26, 2022 17:43
Interview question[entry-level, java]: Review the following samples and spot issues (5+ each)

Sample 1

public OSGiCommand getCmd() {
   if (path.equals("/bundle") ||
       path.equals("/bundles") ||
       path.equals("/bundle/json") ||
       path.equals("/list.html"))
       return new OSGiListCommand(context, new PrintWriter(out));
   else {
@uraimo
uraimo / oracle_long_to_varchar2.md
Last active March 28, 2022 15:05
Oracle string in LONG field to VARCHAR2 without temporary tables or anything else, pure PL/SQL

LONG fields were used in Oracle DB during the Dark Ages to store long text, but they are not selectable and cannot be used in where clauses with LIKE. A multitude of broken solutions exist (to_lob,substr,weird macros, converting the value into new tables, etc...) online to be able to search into this field with a normal query with LIKE, but they are mostly broken. This sample declares a temporary function for the conversion (size up to 4k, it's an oracle limit, some sei you can go up to 32k in PL/SQL but this does not seem the case) and then uses it in a query, ugly but simple.

Errors you could see while handling LONG fields:

ORA-00997: illegal use of LONG datatype
ORA-06502: PL/SQL: numeric or value error
@uraimo
uraimo / The-Long-Strange-Trip-to-Java.md
Last active July 20, 2024 08:23
The Long Strange Trip to Java - Patrick Naughton, March 18, 1996

Saved in case it gets lost, from: http://www.blinkenlights.com/classiccmp/javaorigin.html

The Long Strange Trip to Java

Note: This is an unabridged, unedited version of the Epilogue of my book, The Java Handbook. My editors fought with three problems, libel, slander and page count. We were out of space, and they were also worried a few of my associates from the last 12 years might want to sue them for things I've recalled about them. Well, I kinda see their point... but then everything I say in here is merely my opinion, and this web publication in no way should reflect the views of Osborne/McGraw-Hill, nor any of their personnel. And if I've insulted anyone in this page to the point that they feel like calling a lawyer, I'll snip them out of it as soon as they contact me. (I should also say that the contents of this page have nothing to do with Starwave Corporation while I'm here). 'nuff said. I've debated with myself for several years about whether or not to write this down. After so much time has passe

@uraimo
uraimo / raspberrypi_wifi_headless_config.md
Last active December 2, 2021 08:14
Config/recover an headless pi wireless

To configure the wireless connection of a newly installed Pi or an old one with an obsolete wireless config, just create a file wpa_supplicant.conf file on the /boot/ fat32 partition with this content:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=GB
update_config=1

network={
 ssid="<Name of your wireless LAN>"
 psk=""
@uraimo
uraimo / disable_ocsp.md
Created November 27, 2020 09:53
Disable oscp

This is usefull when you are experiencing network issues and the apps refuse to open (icon jumping, no window shown) because macOS can't complete its oscp signature verification on binaries. Or just if you want to disable it for other reasons.

Open /etc/hosts and add:

0.0.0.0 ocsp.apple.com

Everything should open normally now.