This file contains hidden or 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
'atom-text-editor': | |
'alt-l': 'editor:split-selections-into-lines' |
This file contains hidden or 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
<?php | |
$array = array(1,2,3,2,4,5,4); | |
sort($array); | |
$new_array = array(); | |
$duplicate = -1; | |
$x = 0; | |
for ($x = 0; $x < count($array)-1; $x++) { | |
if ($array[$x] != $array[$x+1] && $array[$x] != $duplicate) { | |
array_push($new_array,$array[$x]); |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>z</title> | |
</head> | |
<body> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> | |
<button onclick='getWeather()'>Get weather</button> |
This file contains hidden or 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 | |
if [ -z "$1" ]; then | |
echo "Usage: ./update_go.sh version (example 1.20.4)" | |
exit 1 | |
fi | |
GO_VERSION=$1 | |
GO_ARCHIVE="go${GO_VERSION}.linux-amd64.tar.gz" | |
GO_DOWNLOAD_URL="https://go.dev/dl/${GO_ARCHIVE}" |
This file contains hidden or 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
#!/usr/bin/env fish | |
set TMP_DIR "/tmp" | |
function get_latest_go_version | |
set GO_DEV_DL_PAGE "https://go.dev/dl/" | |
set LATEST_VERSION (curl -sL $GO_DEV_DL_PAGE | grep -oP 'go\d+(\.\d+)+\.linux-amd64\.tar\.gz' | awk -F '.linux-amd64.tar.gz' '{print $1}' | sort -V | tail -n 1 | sed 's/go//') | |
echo $LATEST_VERSION | |
end |
This file contains hidden or 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
// https://en.wikipedia.org/wiki/RSA_(cryptosystem) | |
// Least common multiple | |
function lcm(a, b) { | |
let min = (a > b) ? a : b; | |
while (true) { | |
if (min % a === 0 && min % b === 0) { | |
break; | |
} | |
min++; |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"os/exec" | |
"strings" | |
) |
This file contains hidden or 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
# https://github.com/nodesource/distributions/wiki/How-to-migrate-to-the-new-repository (for bash) | |
# Remove the GPG keyring file associated with the old repository | |
sudo rm /etc/apt/keyrings/nodesource.gpg | |
# Remove the old repository's list file | |
sudo rm /etc/apt/sources.list.d/nodesource.list | |
# Define the desired Node.js major version | |
set NODE_MAJOR 20 | |
# Update local package index |
This file contains hidden or 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
# ~/.config/fish/config.fish | |
if test -z (pgrep ssh-agent | string collect) | |
eval (ssh-agent -c) | |
set -Ux SSH_AUTH_SOCK $SSH_AUTH_SOCK | |
set -Ux SSH_AGENT_PID $SSH_AGENT_PID | |
end |
This file contains hidden or 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
# copy to ~/.config/fish/functions/ | |
function mc | |
if not test -d "/tmp/mc-$USER" | |
mkdir -p "/tmp/mc-$USER" | |
end | |
set SHELL_PID %self | |
set MC_PWD_FILE "/tmp/mc-$USER/mc.pwd.$SHELL_PID" | |
/usr/bin/mc -P $MC_PWD_FILE $argv |
OlderNewer