Skip to content

Instantly share code, notes, and snippets.

View jarek-przygodzki's full-sized avatar

Jarek Przygódzki jarek-przygodzki

View GitHub Profile
@jarek-przygodzki
jarek-przygodzki / add-vscode-to-path.md
Created June 8, 2018 18:20
Add VS Code to PATH in macOS

To add code to PATH in macOS (in order to run code from the command line) we may to open up VS Code and open the 'Command Palette' with Shift+Command+P on Mac, or Shift+Control+P on Linux. In it, enter shell command and look for the Shell Command: Install 'code' command in PATH option. After doing this any new shell we open should be able to run code.

@jarek-przygodzki
jarek-przygodzki / node_exporter-as-systemd-service.md
Last active December 13, 2023 07:26
Installing node_exporter as systemd serivice
sudo useradd --system --shell /bin/false node_exporter
curl -fsSL https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz \
  | sudo tar -zxvf - -C /usr/local/bin --strip-components=1 node_exporter-1.3.1.linux-amd64/node_exporter \
  && sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
@jarek-przygodzki
jarek-przygodzki / windows-unicode-encode-error.md
Last active November 6, 2023 15:01
Windows - python 3 UnicodeEncodeError: 'charmap' codec can't encode character '\u2013' in position 9629: character maps to <undefined>

If you to run into this problem change the console encoder to utf-8 before starting python

chcp 65001
set PYTHONIOENCODING=utf-8
@jarek-przygodzki
jarek-przygodzki / aria2-add.csx
Created July 4, 2014 16:19
aria2 add download using JSON-RPC
/*
* scriptcs -install Newtonsoft.Json
* scriptcs -install CommandLineParser
*/
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@jarek-przygodzki
jarek-przygodzki / procmon.go
Last active August 18, 2023 09:26
procmon - tools to monitor process creation on various platforms
package main
import (
"bytes"
"encoding/binary"
"fmt"
"os"
"syscall"
"unsafe"
@jarek-przygodzki
jarek-przygodzki / git-core-longpaths.md
Last active July 10, 2023 15:40
How core.longpaths works in Git

I've recently looked into how core.longpaths Git options works and how it's related to Enable Win32 long paths Windows option. Turns out they are not related, and longpaths is both clever and hacky.

Many Windows wide char APIs support longer than MAX_PATH paths through the file namespace prefix (\\?\ or \\?\UNC\) followed by an absolute path. When long paths support is enabled via 'core.longpaths' option, handle_long_path function expands long paths using the '\?' file namespace prefix. See this commit message for detailed explantion.

@jarek-przygodzki
jarek-przygodzki / gist:4721932bba3bd434512ae6cc58f508b0
Created November 23, 2021 12:06
vm.max_map_count in docker-desktop distro for WSL2
open powershell
wsl -d docker-desktop
echo "vm.max_map_count = 262144" > /etc/sysctl.d/99-docker-desktop.conf
Restart docker-desktop
@jarek-przygodzki
jarek-przygodzki / ORA-01882.md
Last active May 18, 2023 22:23
ORA-01882: timezone region not found

JDBC client sends command to setup session when physical connection is established via a modified AUTH_ALTER_SESSION OCI attribute in the authentication phase.

If the JVM time zone is one of the magic constants in the oracle.sql.ZONEIDMAP class and oracle.jdbc.timezoneAsRegion = true (default) then AUTH_ALTER_SESSION looks like this (where Etc/UTC is the default timezone picked up by the JVM)

ALTER SESSION SET TIME_ZONE='Etc/UTC' NLS_LANGUAGE='POLISH' NLS_TERRITORY='POLAND' 

which can fail with

@jarek-przygodzki
jarek-przygodzki / windows-11-rog-strix-z790f.txt
Created April 23, 2023 12:11
How to install Windows 11 on ROG STRIX Z790-F
https://www.asus.com/support/FAQ/1048887/
@jarek-przygodzki
jarek-przygodzki / waitForEnter.java
Last active April 14, 2023 10:39
Wait for enter key pressed in Java
/*
* Be beware http://stackoverflow.com/questions/4203646/system-console-returns-null
*/
public static void waitForEnter(String message, Object... args) {
Console c = System.console();
if (c != null) {
// printf-like arguments
if (message != null)
c.format(message, args);
c.format("\nPress ENTER to proceed.\n");