Skip to content

Instantly share code, notes, and snippets.

View fcolavecchia's full-sized avatar

Flavio Colavecchia fcolavecchia

View GitHub Profile
@fcolavecchia
fcolavecchia / copy_symlinked_files.py
Created April 4, 2024 15:23
Copy symlinked files to a directory
# This script copies files pointed to by symlinks from a specified source directory
# to a specified destination directory. It takes two command-line arguments: the
# source directory containing the symlinks and the destination directory where
# the files pointed to by the symlinks will be copied. If the source or destination
# directories do not exist, the script will display an error message and exit.
# The copied files will retain their original names in the destination directory.
#
# Typically used to copy files out of users .cache in Ubuntu
import os
import sys
@fcolavecchia
fcolavecchia / gist:cc747e4eaa294913116845d283b90513
Created May 15, 2023 12:59
Kill all dotnet processes left behind by VSCode .NET interactive in macOS
kill -9 $(ps aux | grep dotnet | awk '{print $2}')
@fcolavecchia
fcolavecchia / gitHowTo.md
Last active February 7, 2023 22:40
Git how to

What to do when initializing repo in gitHub and locally

git init 
git status
git add <whatever>
git commit -am "Initial commit"
@fcolavecchia
fcolavecchia / fullNameFromFirstAndLast.fs
Last active August 11, 2022 15:08
Get full name from firsts and last.
let toTitle (name : string) =
if System.String.IsNullOrEmpty name then
""
else
let s = name.Trim().[0].ToString().ToUpper()
// printfn "%s" (name.[0].ToString().ToUpper())
let rest =
if name.Length > 1 then
name.Substring(1).ToLower()
else
@fcolavecchia
fcolavecchia / gist:8ed347051cc63ae99b376e1f0b3f0ef4
Last active July 27, 2022 18:14
Refresh repo after .gitignore update

Edit .gitignore. Then

git rm -r --cached . 
git add . 
git commit -m "Commit message"
@fcolavecchia
fcolavecchia / isIntPage.fs
Created May 9, 2022 13:26
Different ways to test a Discriminated Union in F#
type Page =
| IntPage of int
| StrPage of string
let (|IP|SP|) page =
match page with
| IntPage _ -> IP
| StrPage _ -> SP
### Keybase proof
I hereby claim:
* I am fcolavecchia on github.
* I am fcolavecchia (https://keybase.io/fcolavecchia) on keybase.
* I have a public key ASDgkmNywwaatiSrmhh4MzUs3v7mvao2CYM3zeTST0pMDwo
To claim this, I am signing this object:
#include <stdio.h>
//
//
//
#define LAUNCH_BOUNDS // __launch_bounds__(512)
#define DEVICE_FUNCTION_QUALIFIERS __device__