Skip to content

Instantly share code, notes, and snippets.

View BorzdeG's full-sized avatar
🏠
Working from home

Viktor Alenkov BorzdeG

🏠
Working from home
View GitHub Profile
@sevkin
sevkin / getfreeport.go
Last active April 17, 2024 19:38
get free port in golang
// GetFreePort asks the kernel for a free open port that is ready to use.
func GetFreePort() (port int, err error) {
var a *net.TCPAddr
if a, err = net.ResolveTCPAddr("tcp", "localhost:0"); err == nil {
var l *net.TCPListener
if l, err = net.ListenTCP("tcp", a); err == nil {
defer l.Close()
return l.Addr().(*net.TCPAddr).Port, nil
}
}
@IzzySoft
IzzySoft / ff57_addons.md
Last active June 1, 2022 16:40
Firefox 57+ Addon Compatibility / Replacements

Mozilla is doing it again: detering the addon developers who once made it „big“ (last time was when they forced them from XUL to their new „stable API“ for „long-time compatibility“ – which then proved to change as often as the XUL did before). So again, many of them are „jumping boat“, as they a) have no time to migrate to the new WebExtensions, b) WebExtensions don't offer the APIs required to perform the tasks needed by their addon, c) WebExtensions not even being ready yet (with just a couple of weeks left to the deadline, the API is still changing and far from being completed).

I won't start a rant on „if I wanted a browser that looks like Chrome (Aurora with FF29), behaves like Chrome (only signed addons via a central store), and now feels like Chrome, I'd use Chrome“. Of course that's true, and having to re-configure ~80% of the browser of course lets me consider changing to a different browser (certainly not Chrome, though). But first let's look where we stand (comments, additions and suggestions wel

@spilth
spilth / java-todo.md
Last active December 11, 2020 16:08
Java Developer To Do List

This is a collection of tasks/exercises/experience I want to have accomplished as a Java Developer. I'm leaving the tasks undone so that others can easily copy this list and track their own progress.

If you have suggested additions, please leave a comment below.

  • Create a Maven project using the command-line
  • Test Driven Development using a testing framework
    • JUnit
    • Hamcrest Matchers
  • Behavior Drive Development using a framework
  • Cucumber
@cy6erGn0m
cy6erGn0m / kotlin-websocket-example.kt
Last active June 20, 2023 15:28
This example demonstrates how to use WebSocket including reconnect when needed and error handling
import org.w3c.dom.MessageEvent
import org.w3c.dom.WebSocket
import kotlin.browser.window
class KWebSocketImpl(val url : String, val reconnectDelayMillis: Int, val listener : (dynamic) -> Unit) {
private var currentSocket : WebSocket? = null
private val queue = arrayListOf<String>()
private var closed = false
init {
@P7h
P7h / jdk_download.sh
Last active February 20, 2024 11:29
Script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@stefansundin
stefansundin / install-pre-commit.sh
Last active September 17, 2023 11:46
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding:
@inancsevinc
inancsevinc / nginx_subfilter_config
Created June 18, 2012 21:07
configuration example of HttpSubModule, replaces "__name__" in the response
server {
listen 80;
server_name localhost;
root D:/Development/public;
sub_filter_once off;
location / {
if ($uri ~* /(\w+)\.html$) {
set $filename "$1";
@musinsky
musinsky / gnome-shell.css
Last active May 7, 2024 10:09
GNOME 3 files
@import url("/usr/share/gnome-shell/theme/gnome-shell.css");
/* customizing GNOME Shell for desktop interface
with fonts size 9pt (instead default 11pt size) */
/* Text Styles */
/* default text style */
stage {
font-size: 9pt; /* 11pt */
}