This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
workflow_dispatch: | |
jobs: | |
ssh: | |
name: "ssh to remote server" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create SSH Config on temporary VM | |
run: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install docker | |
sudo apt remove docker docker-engine docker.io containerd runc | |
sudo apt update && sudo apt install -y ca-certificates curl gnupg lsb-release | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
sudo usermod -aG docker $USER | |
# install tailscale VPN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set runlevel 3 (disable gui) | |
sudo systemctl set-default multi-user.target | |
# Disable power management | |
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! clean most of the modifiers | |
clear control | |
clear mod4 | |
clear mod1 | |
! gt, lt | |
keycode 49 = less greater less greater bar brokenbar bar | |
keycode 94 = backslash bar backslash brokenbar | |
! ----------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CountingSort = function(A,k) { | |
var B=[]; | |
B.push(null); // avoid undefined | |
var C=[]; | |
for (var i=0;i<=k;i++){ | |
C[i] = 0; | |
} | |
for(var j=1;j<A.length;j++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.swap = function(x,y) { | |
if(x == undefined || y == undefined) return; | |
var temp = this[x]; | |
this[x] = this[y]; | |
this[y] = temp; | |
}; | |
var Partition = function(A,p,r) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.swap = function(x,y) { | |
if(this[x] == undefined || this[y] == undefined) return; | |
var temp = this[x]; | |
this[x] = this[y]; | |
this[y] = temp; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require Merge.js | |
var MergeSort = function(A,p,r) { | |
if (p < r) { | |
var q = Math.floor(r-p); | |
var left = MergeSort(A,p,q); | |
var right = MergeSort(A,q+1,r); | |
return Merge(A,p,q,r); | |
} | |
return A; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var merge = function(A,p,q,r) { | |
// 1, 4 , 9, intervalli da [1..4] incluso, [5...9] | |
var n1 = q - p +1; // = 4 -1 +1 = 4 | |
var n2 = r - q; // 5 | |
var L = [], R = []; | |
for(var i=1; i<=n1;i++) { // da 1 a 4 | |
L[i] = A[p + i - 1]; // setta L[i] = A[1+1-1]= 6, L[1+2-1]=L[2]=7, L[1+3-1]=L[3]=8, L[1 + 4 -1]=L[4] = 9 | |
} | |
for (var j=1;j<=n2;j++) { // da 1 a 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sequence = [3,4,1,2,6,5,8,7,9,0]; | |
function insertionSort() { | |
for (var j=1;j<sequence.length;j++) { | |
var key = sequence[j]; | |
var i=j-1; | |
while( i>=0 && sequence[i]>key ) { | |
sequence[i+1] = sequence[i]; | |
i = i-1; |
NewerOlder