Skip to content

Instantly share code, notes, and snippets.

@martinandersen3d
martinandersen3d / sync-time.sh
Created May 2, 2021 — forked from dungsaga/sync-time.sh
sync local clock in bash without NTP
View sync-time.sh
# I want to sync the local clock but don't have access to any NTP server.
# Websites such as https://time.is give me the correct time and I can manually adjust the local clock.
# But then I recall that a HTTP response often contains a date header with current time in GMT timezone.
# I'll use it to set the system clock with the precision of 1 or 2 seconds.
# in Linux
sudo date -us "$(curl -Is google.com | grep '^Date:' | cut -d' ' -f3-)"
# in Linux with fish shell
@martinandersen3d
martinandersen3d / Bash.desktop
Last active Apr 29, 2021
Dolphin Templates - /home/<username>/.local/share/templates/
View Bash.desktop
[Desktop Entry]
Name=Bash.sh
Comment=New custom entry:
Type=Link
URL=.source/bash.sh
Icon=application-vnd.oasis.opendocument.text
@martinandersen3d
martinandersen3d / print_installed_programs.sh
Created Apr 29, 2021
Linux / Ubuntu - List all installed programs and write to a text file
View print_installed_programs.sh
#!/bin/bash
sleep 1
LANG=en_US.UTF-8
outfile="~/installed_programs.txt"
# This Bash command will print all manually installed packages minus the ones that came from your Debian installation (in other words, the packages that you installed with apt install):
echo ' ' >> $outfile
echo 'COMMANDLINE UTILLITIES--------------------------------------------' > $outfile
apt-mark showmanual >> $outfile
View Javascript Typesafe Class.js
class Person {
constructor() {
this.data = {};
}
get first() {
return this.data.first || 'UNKNOWN';
};
set first(name) {
@martinandersen3d
martinandersen3d / CopyQ Export CLI commandline.ps1
Last active Jan 8, 2021
CopyQ Export CLI commandline - How to export all tabs to .txt files
View CopyQ Export CLI commandline.ps1
# CopyQ - How to export ALL you tabs from copyq to text files!
# Use Powershell for the export
# CopyQ Help, with command: copyq help | Write-Output
# https://copyq.readthedocs.io/en/latest/command-line.html
# http://manpages.ubuntu.com/manpages/bionic/man1/copyq.1.html
# -------------------------------------------------------
# STEP 1. List the availible tabs with command:
copyq tab | Write-Output
View The Ultimate Bad Ass .bashrc File
#!/bin/bash
iatest=$(expr index "$-" i)
#######################################################
# SOURCED ALIAS'S AND SCRIPTS BY zachbrowne.me
#######################################################
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@martinandersen3d
martinandersen3d / launch.json
Created Aug 13, 2020
VsCode Python - automatically kill the task terminal after debugging
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
View list_all_icons.py
#!/usr/bin/python
# simple.py
from PySide2.QtWidgets import QApplication,QMainWindow, QAction, QStyle
import sys
from PySide2.QtGui import QIcon
class Window(QMainWindow):
@martinandersen3d
martinandersen3d / show files in a listbox from directory in a python tkinter listbox.py
Created Jul 12, 2020
show files in a listbox from directory in a python tkinter listbox
View show files in a listbox from directory in a python tkinter listbox.py
from tkinter import *
import tkinter.messagebox as box
window = Tk()
window.geometry("400x500")
window.title( 'Select File' )
frame = Frame( window )
# ---------------------------------
View report-asp.net-vs-node.js-for-backend-comparison.md

Comparison of ASP.NET and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.