Skip to content

Instantly share code, notes, and snippets.

View Davidblkx's full-sized avatar

David Pires Davidblkx

View GitHub Profile
@Davidblkx
Davidblkx / FramesId3v24.cs
Created August 28, 2016 06:00
Struct with all frames presented in ID3v2.4
namespace ID3
{
public struct FramesID3v24
{
/// <summary>
/// This frame's purpose is to be able to identify the audio file in a
/// database, that may provide more information relevant to the content.
/// Since standardization of such a database is beyond this document, all
/// UFID frames begin with an 'owner identifier' field.It is a null-
/// terminated string with a URL [URL] containing an email address, or a
@Davidblkx
Davidblkx / Iso369Extension.cs
Created September 15, 2016 09:50
CultureInfo extension of ThreeLetterISOLanguageName, since is not present in current version
using System.Collections.Generic;
using System.Globalization;
namespace Extensions
{
public static class CultureInfoExtensions
{
public static string ThreeLetterISOLanguageName(this CultureInfo cultureInfo)
{
#region Iso369 Mapping
@Davidblkx
Davidblkx / now-playing.sh
Created September 6, 2019 09:42
grabs and print the current playing song
#!/bin/bash
pacmd list-sink-inputs |\
grep media.name |\
sed -n -e 's/^.*media\.name = //p' |\
sed 's/"//g' |\
sed "s/'//g" |\
sed 's/playback stream//ig' |\
sed 's/playback//ig' |\
sed 's/AudioCallbackDriver//ig' |\
sed 's/AudioStream//ig' |\
@Davidblkx
Davidblkx / traefik.sh
Last active September 14, 2019 20:41
Install traefik for DOCKER + LET'S ENCRYPT
#!/bin/bash
# Install traefik for DOCKER + LET'S ENCRYPT
# RUN (./start.sh [DOMAIN] [EMAIL]) or change domain and email vars
DOMAIN=$1
EMAIL=$2
echo "running config for domain: ${DOMAIN} and email: ${EMAIL}"
read -p "Are you sure? " -n 1 -r
echo
@Davidblkx
Davidblkx / fizz-buzz.ts
Created September 30, 2019 20:50
Simple FizzBuzz in typescript
console.log('A basic FizzBuzz in typescript')
const START_NUMBER = 1;
const LAST_NUMBER = 100;
const FIZZ = 'Fizz';
const BUZZ = 'Buzz';
function calcFizzBuzz(n: number): string | number {
let toPrint = '';
#/bin/bash
# install docker in Fedora 32
# add repo
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
# use 31 version (There are no official support for 32)
sudo sed -i 's/$releasever/31/g' /etc/yum.repos.d/docker-ce.repo
@Davidblkx
Davidblkx / DELETE_ALL_TABLES.sql
Created October 30, 2020 14:18
Delete all tables in a SQL SERVER database
DECLARE @Sql NVARCHAR(500) DECLARE @Cursor CURSOR
SET @Cursor = CURSOR FAST_FORWARD FOR
SELECT DISTINCT sql = 'ALTER TABLE [' + tc2.TABLE_SCHEMA + '].[' + tc2.TABLE_NAME + '] DROP [' + rc1.CONSTRAINT_NAME + '];'
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc1
LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc2 ON tc2.CONSTRAINT_NAME =rc1.CONSTRAINT_NAME
OPEN @Cursor FETCH NEXT FROM @Cursor INTO @Sql
WHILE (@@FETCH_STATUS = 0)
@Davidblkx
Davidblkx / windefender.ps1
Created July 21, 2021 08:03
Enable disable windows defender real time protection
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" +$myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
$status = (-Not (Get-MpPreference).DisableRealtimeMonitoring)
Set-MpPreference -DisableRealtimeMonitoring $status
$status
@Davidblkx
Davidblkx / mmove.py
Created October 14, 2020 22:58
python script to keep pc alive
# /bin/python
import mouse
import time
(X, Y) = mouse.get_position()
mov = False
while True:
X = X + 1 if mov else X - 1
@Davidblkx
Davidblkx / new_work_pc.ps1
Last active March 9, 2022 18:04
script install new pc
# login in windows store
######## install and reload ########
winget install scoop
winget install vscode
####################################
winget install Microsoft.WindowsTerminal
winget install cpu-z
winget install SlackTechnologies.Slack
winget install mozilla.firefox