Skip to content

Instantly share code, notes, and snippets.

View ammachado's full-sized avatar

Adriano Machado ammachado

View GitHub Profile
<!--
XSLT for removing unused namespaces from an XML file.
Author: Dimitre Novatchev
Source: https://stackoverflow.com/a/4594626
License: CC BY-SA, https://creativecommons.org/licenses/by-sa/2.5/
Usage:
xmlstarlet tr remove-unused-namespaces.xslt -
@thatisuday
thatisuday / bash-special-characters.csv
Last active June 5, 2024 19:28
Special Characters in Bash
Special Character Description Extra information
$_ Absolute path of the shell binary file that is executing the script Ex. /bin/bash or /bin.sh
$0 Path of the executing Bash script Ex. ./my-file.sh
$N Nth argument passed to the executing Bash script $1 is 'apple' for the command 'bash file.sh apple'
$* All arguments passed to the executing Bash script expands to a word inside double-quotes
$@ All arguments passed to the executing Bash script expands to a separate words inside double-quotes
$# Number of arguments passed to the executing Bash script $# is 3 for the command 'bash file.sh A B C'
$? Exit status code of last executed command in the foreground returns a decimal number between 0-255
$! Process ID of last executed command in the background empty of no background command was extecuted
$$ Process ID of executing Bash script returns a decimal number
@dmorosinotto
dmorosinotto / TestTypedForms.ts
Last active July 7, 2023 05:09
Typed @angular/forms FIXED set/patchValue - strict all the way down ^_^
import { FormGroup, FormControl, FormArray, Validators } from "@angular/forms";
function testFormGroupTyped() {
var frm = new FormGroup({
a: new FormArray([new FormControl(0)]),
b: new FormControl(true),
c: new FormGroup({
s: new FormControl("abc"),
n: new FormControl(123)
})
@fengyuentau
fengyuentau / readme.md
Last active March 13, 2024 08:15
Enable X11 forward for ssh to load images from remote server on MacOS Mojave

Enable X11 forward to load images from remote server on MacOS Mojave

Steps

  1. Install Xquartz to get X11 support on MacOS. You can google Xquartz and download it from its official site, or install using HomeBrew.

    brew cask install xquartz
  2. Launch Xquartz. Go to Preference -> Security, click the box Allow connections from clients. NOTE: You have to lauch Xquartz with Allow connections from clients enable everytime you want to ssh to remote server with X11 forwarding support.

@sgoguen
sgoguen / wheel.fsx
Created February 13, 2019 04:04
Wheel of Fortune Solver
// First, clone the word list project here: https://github.com/dwyl/english-words.git
// Then save this file in the same folder and run!
open System.IO
// Ok... Here's how it works...
// First, we load all the words from the Moby text fil
let allTheWords = File.ReadAllLines("words.txt")
@nwade
nwade / README.md
Last active May 8, 2024 13:52
Remove SentinelOne Agent - macOS High Sierra/Mojave

Warning - use at your own risk

Remove SentinelOne agent from Mac

  1. Boot into Recovery Mode by holding Cmd+R during reboot
  2. Open Terminal from top menubar
  3. Run /Applications/Utilities/Disk\ Utility.app/Contents/MacOS/Disk\ Utility to open Disk Utility
  4. If your startup disk is encrypted, use Disk Utility to mount it
  5. In Terminal, run chroot /Volumes/Macintosh\ HD
  6. Execute the deletion commands or script
@luzfcb
luzfcb / README.md
Last active September 12, 2019 14:20
curl -L https://git.io/fx8PT -o increase_osx_max_opened_files.sh

chmod +x increase_osx_max_opened_files.sh

sudo ./increase_osx_max_opened_files.sh

before run this:

SSH into AWS ec2/ Digitalocean droplet/ or else other PAAS, linux machine

  1. Install Docker
$sudo apt install docker.io
$sudo usermod -aG docker $USER

I already installed docker

@nadavrot
nadavrot / Matrix.md
Last active July 21, 2024 17:27
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@fmbenhassine
fmbenhassine / FileIngestionJobConfiguration.java
Last active July 18, 2018 20:06
Spring Batch File ingestion job sample #SpringBatch
package io.github.benas.sbi;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import javax.sql.DataSource;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;