Skip to content

Instantly share code, notes, and snippets.

View nelsestu's full-sized avatar

Erik Nelsestuen nelsestu

View GitHub Profile
@nelsestu
nelsestu / create_restore_dmg_macosx.md
Created February 18, 2024 21:56 — forked from disulfidebond/create_restore_dmg_macosx.md
Create or Restore Disk Image in Mac OSX

Overview

This gist details how to create or restore a disk image in Mac OSX. There are three methods that are described: Carbon Copy Cloner, Disk Utility, and CommandLine.

  • Disclaimer:
    • I have no financial incentives to https://bombich.com or Apple.
    • Always make a backup of your data, and make 2 separate backups before trying something new.
    • The following steps have been tested and are a summary of my personal recommendations, but should be used at your own risk.
    • If there is a chance of imminent data loss, contact a professional for assistance, and do not rely on a random person from the Internet for help.

Method 1: Carbon Copy Cloner (CCC)

@nelsestu
nelsestu / submit.md
Created February 15, 2024 06:10 — forked from tanaikech/submit.md
Creating Quizzes in Google Form using Google Forms Service with Google Apps Script

Creating Quizzes in Google Form using Google Forms Service with Google Apps Script

This is a sample script for creating quizzes in Google Form using Google Forms Service with Google Apps Script.

Usage

1. Prepare questions and answers.

@nelsestu
nelsestu / docker-remove-images-by-name.md
Created November 7, 2023 09:02 — forked from zulhfreelancer/docker-remove-images-by-name.md
How to delete Docker images that contains a sub-string inside the name?

docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep 'imagename')

For example, to delete all images that contains zulh inside the name, run:

docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep 'zulh')

@nelsestu
nelsestu / JavaTwoWaySSLClient.md
Created November 7, 2023 05:52 — forked from gvisoc/JavaTwoWaySSLClient.md
2-Way SSL: HTTPs Client

What is this

This Gist is about using Client Certificates in Java when making HTTPs calls with plain Java code (java(x).net, no other frameworks) in a 2-way SSL context, that is: the Server trusts and uses a Client Public Key to establish the secure connection. The example is a Java runnable class for a Client that uses a Certificate to establish a Two Way SSL communication with a Server.

Disclaimer: this gist reflects my understanding, and is not necessarily 100% accurate. Feedback is appreciated.

Context

For this to work, the Client certificate has to be issued by a CA (Certification Authority) trusted by the Server, the same way that the Client has to trust the CA of the Server. In Java, "trust a CA" means having that CA stored in an encrypted file called "trust store" accessible from our code by the use of a password and the appropriate security SDK provided by the JDK.

How to store that trust stores' passwords securely in our enviroments is another story.

@nelsestu
nelsestu / quick-actions-finder-macos-big-sur.md
Created October 23, 2023 17:39 — forked from aamnah/quick-actions-finder-macos-big-sur.md
Add Quick Actions to Finde in macOS Big Sur to open a folder in VS Code
  • Open Automator
  • Choose Quick Action as the document type
  • Change Workflow receives current to files or folders in Finder.app
  • For Action, choose Open Finder items from the left hand sidebar
  • Change Open with to Visual Studio Code.app (find it in Other... )
  • For the Icon, change Image to "Choose..." and select the Visual Stuido Code app. It'll automatically pick the icon
  • Save it (Cmd+S) as something like "Open in VS Code"
@nelsestu
nelsestu / linux startup sounds.md
Created August 18, 2023 04:53 — forked from forksofpower/linux startup sounds.md
startup sounds in linux

How to add startup sound to linux

I use this implementation on my RuneAudio player to play a sound when the raspberry pi is powered on.

  1. Place your audio file in /var/local/

    cp startupsound.mp3 /var/local/
  2. Create /usr/bin/startupsound.sh with these contents:

@nelsestu
nelsestu / nextcloud.conf
Created August 6, 2023 06:04 — forked from xxblx/nextcloud.conf
nextcloud nginx config
upstream php-handler {
server unix:/run/php-fpm/www.sock;
}
server {
#listen 443 ssl;
listen 80;
server_name 192.168.1.8;
#ssl_certificate /etc/ssl/nginx/cloud.example.com.crt;
@nelsestu
nelsestu / host.json
Created May 3, 2023 17:19 — forked from TotallyNotChase/host.json
Native Messaging - Rust
{
"name": "pingpong",
"description": "Native messaging host example",
"path": "path/to/release_executable",
"type": "stdio",
"allowed_origins": [
"chrome-extension://extension_id/"
]
}
@nelsestu
nelsestu / 00-README.md
Created April 12, 2023 23:06 — forked from pazams/00-README.md
How to upload a file with $.ajax to AWS S3 with a pre-signed url

Upload a file with $.ajax to AWS S3 with a pre-signed url

When you read about how to create and consume a pre-signed url on this guide, everything is really easy. You get your Postman and it works like a charm in the first run.

Then you open your browser, try your usual $.ajax() and send your PUT operation, and you hit the cold iced wall of AWS error message, a simple <Code>SignatureDoesNotMatch</Code> that will steal hours from your productivity.

So here I come to save you and give you a free working example of how to upload a file directly to AWS S3 from your browser. You are wellcome :).

General file permissions for ssh.

chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub  
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts