Skip to content

Instantly share code, notes, and snippets.

View hardselius's full-sized avatar
🐢
all the way down

Martin Hardselius hardselius

🐢
all the way down
View GitHub Profile
@hardselius
hardselius / test.txt
Created August 18, 2022 14:02
Text I want to share
+000006608
+000006608
+000006608
+000006609
+000006609
+000006608
+000006608
+000006608
+000006608
+000006608

TCP - Transport Layer

Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of octets (bytes) between applications running on hosts communicating via an IP network.

TCP is connection-oriented, and a connection between client and server must be established before data can be sent. The server must be listening (passive open) for connection requests from cilents before a connection is established. Three-way handshake (active open), retransmission, and error detection adds to

cURL in Vim

curl allows you to specify a text file from wich it will read its arguments from via the -K, --config <file> flag. This is a useful feature if you want to maintain a set of commands but you care about seeing the output and not about keeping/editing/analyzing it. Something like a rudimentary test suite as an alternative to Postman.

From the curl manual:

Options and their parameters must be specified on the same line in the file, separated by whitespace, colon, or the equals sign. Long option names can optionally be given in the config file without the initial double dashes and if so, the colon or equals characters can be used as separators. If the option is specified with one or two dashes, there can be no colon or equals character between the option and its parameter.

If the parameter contains whitespace (or starts with : or =), the parameter must be enclosed within quotes. Within double quotes, the following escape sequences are available: \, ", \t,

@hardselius
hardselius / cursor.vim
Created November 17, 2021 08:38
Different cursor for different mode
if &term =~? 'rxvt' || &term =~? 'xterm' || &term =~ 'st-'
" 1 or 0 -> blinking block
" 2 -> solid block
" 3 -> blinking underscore
" 4 -> solid underscore
" Recent versions of xterm (282 or above) also support
" 5 -> blinking vertical bar
" 6 -> solid vertical bar
" Insert Mode
let &t_SI .= "\<Esc>[5 q"
@hardselius
hardselius / toc.md
Last active February 12, 2022 21:30
My Gists

My gists

All-round computer science

Let's refresh our memories.

Vim

@hardselius
hardselius / AbstractPrioritizedRequiredAction.java
Created April 3, 2018 16:24
Keycloak Required Action ordering
public abstract class AbstractPrioritizedRequiredAction implements RequiredActionProvider, RequiredActionFactory {
@Override
public void requiredActionChallenge(RequiredActionContext context) {
if (!ActionPriorityUtils.isNext(getId(), context.getUser().getRequiredActions(), context.getAuthenticationSession().getRequiredActions())) {
context.ignore();
return;
}
requiredActionChallengeImpl(context);
}
Look at https://github.com/gambol99/keycloak-proxy for setting up the proxy and the rules 'n stuff.
Basically, what you need to do is
- create a client in Keycloak,
- run the proxy from the command line, and
- open a browser and

Keybase proof

I hereby claim:

To claim this, I am signing this object:

<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-min.js"></script>
<div class="container">
<div class="row">
<button class="btn btn-default" data-bind="click: getMedals">Get medal count</button>
</div>