Skip to content

Instantly share code, notes, and snippets.

View skarllot's full-sized avatar
💭
I may be slow to respond.

Fabrício Godoy skarllot

💭
I may be slow to respond.
View GitHub Profile
@wdolek
wdolek / ConsoleApp153.csproj
Created March 27, 2024 08:42
Proof that AutoMapper can be slower than your own manually written code
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@skarllot
skarllot / TypeClipboard.md
Last active April 22, 2024 10:06 — forked from ethack/TypeClipboard.md
Scripts that simulate typing the clipboard contents. Useful when pasting is not allowed.

It "types" the contents of the clipboard.

Why can't you just paste the contents you ask? Sometimes pasting just doesn't work.

  • One example is in system password fields on OSX.
  • Sometimes you're working in a VM and the clipboard isn't shared.
  • Other times you're working via Remote Desktop and again, the clipboard doesn't work in password boxes such as the system login prompts.
  • Connected via RDP and clipboard sharing is disabled and so is mounting of local drives. If the system doesn't have internet access there's no easy way to get things like payloads or Powershell scripts onto it... until now.

Windows

The Windows version is written in AutoHotKey and easily compiles to an executable. It's a single line script that maps Ctrl-Shift-V to type the clipboard.

@Tamal
Tamal / set-chroot.sh
Last active April 26, 2024 09:57
Setting up chroot from a live image in Fedora. Regenerate grub2 for Fedora.
$ # Use Live CD to boot
$ sudo su # Switch to root
$ fdisk -l # Get names of root, boot & EFI partition names. you can also use blkid
$ mount /dev/mapper/fedora_localhost--live-root /mnt # mount root partition
$ cat /mnt/etc/fedora-release
Fedora release 31 (Thirty One)
$ mount /dev/nvme0n1p2 /mnt/boot # mount boot partition
$ mount /dev/nvme0n1p1 /mnt/boot/efi # mount EFI partition
# Note: If you are not able to mount EFI partition ('Input/Output error'),
# You may have to repair ESP file system or format ESP.
@ashalkhakov
ashalkhakov / .gitlab-ci.yml
Last active August 16, 2022 17:24
Running .NET 3.5 CF builds under Docker for Windows
# this is the GitLab-CI file for building the image
variables:
CURRENT_IMAGE_TAG: rfid-applied/netcf35_build_environment:dev
stages:
- dockerize
dockerize:
stage: dockerize
script:
@Artistan
Artistan / add gitlab admin labels.md
Last active January 8, 2021 11:41
Add gitlab labels to your repo from admin labels

in addition to @Xunnamius package. you may use the dbconsole if your are feeling brave and want to check and update just the labels that are off in color or case. Also, I deleted only the labels that did not exist in the admin labels, and then ren teh gitlab-fix-labels ... add all to add the missing labels to all our projects.

login to your server

sudo gitlab-rails dbconsole

template (admin) labels.

namespace System.Collections.ObjectModel
{
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
@pieceofsummer
pieceofsummer / DoubleUtil.cs
Last active September 5, 2017 02:23
Assembling double in IEEE 754 representation
using System;
namespace Newtonsoft.Json.TestConsole
{
public static class DoubleUtil
{
/// <summary>
/// Exponents for both powers of 10 and 0.1
/// </summary>
@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@kdzwinel
kdzwinel / main.js
Last active May 2, 2024 05:30
List all undefined CSS classes
/*
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets.
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there).
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ .
Known limitations:
- it won't be able to take into account some external stylesheets (if CORS isn't set up)
- it will produce false negatives for classes that are mentioned in the comments.