Skip to content

Instantly share code, notes, and snippets.

View antoniopicone's full-sized avatar

Antonio Picone antoniopicone

View GitHub Profile
@antoniopicone
antoniopicone / LinkedList.php
Last active April 25, 2023 22:46
A simple Linked List in PHP
<?php
class Node {
public $data;
public $next;
public function __construct($data)
{
$this->data = $data;
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 / BinaryTree.php
Created August 23, 2016 15:16
A Binary Tree implementation with DFS and BFS traversal algorithms
<?php
class Node {
public $data;
public $next;
public function __construct($data)
@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;