Skip to content

Instantly share code, notes, and snippets.

View sicet7's full-sized avatar

Martin René Sørensen sicet7

View GitHub Profile
{ config, pkgs, lib, ... }:
let
configFile = pkgs.writeText "init-mongo.sh"
''
#!/bin/bash
if which mongosh > /dev/null 2>&1; then
mongo_init_bin='mongosh'
else
mongo_init_bin='mongo'
@sicet7
sicet7 / index.html
Last active February 7, 2024 12:41
[POC] Using SharedWorker in vanilla javascript to synchronize data between tabs/windows when polling an expensive computation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
<p id="data-output">Nothing</p>
<script type="text/javascript">
const DomUpdateWorker = {
@sicet7
sicet7 / configuration.nix
Last active October 15, 2024 09:34
My Nixos Configuration
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, lib, ... }:
let
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz";
dotnetPkg = pkgs.dotnetCorePackages.sdk_8_0;
forcedUnstable = import
@sicet7
sicet7 / jwk_with_phpseclib_test.php
Last active September 6, 2023 16:29
Use JWK from JSON with the lcobucci/jwt library through phpseclib. Credit to @whatTool for helping with the implementation
<?php
//REQUIREMENTS!
//"phpseclib/phpseclib": "^3.0"
//"lcobucci/jwt": "^5.0"
require_once __DIR__ . '/vendor/autoload.php';
$json = '{
"keys": [
{
@sicet7
sicet7 / main.go
Created March 6, 2023 12:13
String seeded random string generator in GO
package main
import (
"crypto/sha256"
"encoding/base64"
"encoding/binary"
"fmt"
"io"
"math/rand"
)
function Decode {
If ($args[0] -is [System.Array]) {
[System.Text.Encoding]::ASCII.GetString($args[0])
}
Else {
"Not Found"
}
}
#$test = Get-WmiObject WmiMonitorID -Namespace root\wmi
#$test
#!/bin/sh
echo "It now $(date +%d-%m-%Y_%H-%M)"
@sicet7
sicet7 / flameshot.sh
Last active January 29, 2021 18:13
Installs and configures flameshot for Ubuntu 20.04
#!/bin/sh
sudo apt install -y flameshot && \
gsettings set org.gnome.settings-daemon.plugins.media-keys screenshot '[]' && \
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot/']" && \
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot/ name 'flameshot' && \
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot/ command '/usr/bin/flameshot gui' && \
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/flameshot/ binding 'Print'
@sicet7
sicet7 / commands.sh
Created January 25, 2021 07:17
Some useful cli commands
#!/bin/sh
watch "mutagen list | tail --lines=2 | head --lines=1"
docker stats --format="table {{.Name}}\t{{.CPUPerc}}\t{{.MemPerc}}\t{{.MemUsage}}\t{{.NetIO}}"
@sicet7
sicet7 / style.css
Created February 28, 2019 08:47
Cross browser disable text selection
element{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}