Skip to content

Instantly share code, notes, and snippets.

View Tomaszal's full-sized avatar

Tomas Zaluckij Tomaszal

  • Freelance Software Engineer
  • Edinburgh, United Kingdom
  • 05:16 (UTC)
  • LinkedIn in/tomaszal
View GitHub Profile
{
"egen": {
"prefix": "egen",
"body": [
"Effect.gen(function* () {",
" $0",
"})"
],
"description": "Effect.gen"
},
@borispoehland
borispoehland / effects.ts
Last active May 7, 2024 09:48
3 fetch effects for effect-ts. One uses cache: no-store, one cache: force-cache and one uses the default cache / revalidate
import * as S from '@effect/schema/Schema'
import { Context, Effect } from 'effect'
export interface IFetcher {
fetch: typeof fetch
}
export const TFetcher = Context.Tag<IFetcher>('IFetcher')
class FreshFetcher implements IFetcher {
@Kranzes
Kranzes / guide.md
Last active November 18, 2024 07:46
SSH Resident Key Guide

Initial checks

Start by checking that there aren't any previous ssh keys inside the FIDO2 authenticator of your YubiKey. You can check if they exist by running the command below:

nix shell nixpkgs#yubikey-manager -c ykman fido credentials list

If the command above outputs a string mentioning "ssh" or "openssh", then you have already got a key generated and store on your YubiKey.

Evaluating additional authentication factors

Before generating a new ssh key to store on your YubiKey you must consider which additional required authentication factors you want to use. Below you can see a table with the available factors and their corresponding command:

@frebib
frebib / hibereboot
Last active March 11, 2024 06:10
hibereboot: A 'hibernate & reboot' one-shot hack script for systemd-based hosts
#!/bin/sh
set -e
# hibereboot: A 'hibernate & reboot' one-shot hack script for systemd-based hosts
#
# Place this script somewhere in your $PATH and run it (as root) to hibernate and reboot.
# For full automation, allow the script to be run with passwordless-sudo:
#
# > /etc/sudoers
# yourusername ALL=(ALL) SETENV:NOPASSWD: /path/to/hibereboot
@sebastiencs
sebastiencs / volume.sh
Last active February 13, 2024 11:19
Script to get volume notification with dunst http://imgur.com/a/qWgAw
#!/bin/bash
# You can call this script like this:
# $./volume.sh up
# $./volume.sh down
# $./volume.sh mute
function get_volume {
amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
}
@trzecieu
trzecieu / install_wsl.bat
Last active July 5, 2024 14:28
WSL Scripts
@echo off
echo - This scripts automates process of installing Windows Subsystem for Linux (WSL)
REM Due some limitations, this script has to be can't be executed under PowerShell
Get-ChildItem >nul 2>&1
if %errorLevel% == 0 (
echo # Swich to CMD
cmd /c start "" %0
exit 0
)
@wafsek
wafsek / whiptailmenu.bash
Last active November 2, 2024 09:54
A Example of whiptail menu with functions
#! /bin/bash
# This program is just an example of how to make a whiptail menu and some basic commands.
# Copyright (C) 2016 Baljit Singh Sarai
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License.
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@thoroc
thoroc / Debloat-Windows10.ps1
Created August 18, 2015 14:46
Windows 10 PowerShell script to disable E.T. features ....
<#
NAME
Debloat-Windows10.ps1
DESCRIPTION
Debloats and customizes Windows 10 Enterprise N LTSB.
It changes your privacy options in the settings app and disables scheduled tasks and services that are there
to gather information about you. It also tweaks the registry to customize settings, make your font display properly
on DPI scaling 125% and disable OneDrive completely. Windows Features are also disabled, such as Internet Explorer
and XPS Viewer, while others are enabled such as .NET framework 3.5. On top of it all, it appends new lines to your
hosts file that block Microsoft from collecting data on you, as well as enables or disables local policies to
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule