Skip to content

Instantly share code, notes, and snippets.

View heypano's full-sized avatar

Pano Papadatos heypano

View GitHub Profile
@heypano
heypano / readWriteFileNodeJsPromises.js
Created July 30, 2021 16:55
Read/Write file with promises in node js
const { promises } = require("fs");
const { readFile, writeFile } = promises;
const input = "src/index.js";
const output = "src/index2.js";
const errorHandler = (error) => {
console.error(error.message);
process.exit(1);
};
{
"Key Mappings": {
"0xf728-0x80000-0x75": {
"Label": "",
"Action": 10,
"Text": "d"
},
"0xf703-0x380000-0x7c": {
"Label": "",
"Action": 0,
@heypano
heypano / VS Code shortcuts.md
Last active January 30, 2021 23:14
VS code important shortcuts
  • cursorWordLeft Move to previous word
  • cursorWordLeftSelect Move to previous word word with selection
  • cursorWordRight Move to next word
  • cursorWordRightSelect Move to next word with selection
  • cursorHome Move to start of line
  • cursorHomeSelect Move to start of line with selection
  • cursorEnd Move to end of line
  • cursorEndSelect Move to end of line with selection
  • deleteWordLeft Delete word backward
  • deleteWordRight Delete word forward
@heypano
heypano / iterm keyboard shortcuts.md
Last active January 24, 2021 23:25
iterm keyboard shortcuts

Escape Sequences

  • Esc + b - Move back by word (option + left arrow)
  • Esc + f - Move forward by word (option + right arrow)
  • Esc + d - Delete word after (option + delete)

Hex Codes

  • 0x01 - Move to start of line (command + left arrow)
  • 0x05 - Move to end of line (command + right arrow)
  • 0x15 - Delete to start of line (command + backspace)
  • 0x17 - Delete word before (option + backspace)
@heypano
heypano / keybase.md
Last active May 16, 2019 17:00
keybase.io verification for my github account (heypano)

Keybase proof

I hereby claim:

  • I am heypano on github.
  • I am heypano (https://keybase.io/heypano) on keybase.
  • I have a public key ASCh5Y7R05v9r9wcvX9w9JemHgRhqlmowfCY3bHNi4Q_Tgo

To claim this, I am signing this object:

@heypano
heypano / restartPSQL.sh
Created December 6, 2016 15:40
Restart PSQL (installed through homebrew)
# Restart PSQL
brew services restart postgresql
@heypano
heypano / hash_bulk_to_1
Last active July 31, 2017 12:19
Set multiple keys of a hash ref to 1 without a loop
#! /usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
my %hash = (a => 1, b => 1, c => 1);
my $hashref = \%hash;
my @keys = ('d','e','f','g','h','i');
@heypano
heypano / lsSortByPermission.pl
Created August 15, 2013 13:35
sorts ls results by permission - Useful for finding similar files or folders
#! /usr/bin/perl
my @entries = reverse sort by_first_column `ls -la @ARGV`;
print @entries;
sub by_first_column{
(my $a1 = $a) =~ s/^[\s]*([\S]+).+$/$1/;
(my $b1 = $b) =~ s/^[\s]*([\S]+).+$/$1/;
return $a1 cmp $b1;
}
@heypano
heypano / cleanupGit.sh
Created August 14, 2013 17:17
To remove files recursively from a git repo
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch *.gwt.log' HEAD
@heypano
heypano / sizeOfCurrentDirectory.sh
Created August 14, 2013 17:16
Get the size of the current directory
du -ch | grep total