Skip to content

Instantly share code, notes, and snippets.

View antoniopicone's full-sized avatar

Antonio Picone antoniopicone

View GitHub Profile
on:
workflow_dispatch:
jobs:
ssh:
name: "ssh to remote server"
runs-on: ubuntu-latest
steps:
- name: Create SSH Config on temporary VM
run: |
@antoniopicone
antoniopicone / docker-tailscale_ubuntu.sh
Last active May 20, 2022 04:18
Install Docker and Tailscale on Ubuntu
# 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
@antoniopicone
antoniopicone / ubuntu_desktop_to_server.sh
Created April 17, 2020 17:10
Make an Ubuntu desktop setup more server friendly
#!/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
@antoniopicone
antoniopicone / .Xmodmap
Last active August 21, 2019 13:40 — forked from bonndan/.Xmodmap
xmodmap config for Italian apple keyboard under ubuntu
! 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
! -----------------
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++) {
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) {
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;
};
// 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;
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
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;