Skip to content

Instantly share code, notes, and snippets.

@beastycoding
beastycoding / install.sh
Created August 16, 2023 10:58 — forked from ikr4-m/install.sh
Hyper-V Enhanced Session for Debian
#!/bin/sh
# This script based on linux-vm-tools for Ubuntu 22.02.
# Thanks to https://github.com/Hinara/linux-vm-tools/ to script
# This script is for Ubuntu 22.04 Jammy Jellyfish to download and install XRDP+XORGXRDP via
# source.
#
# Major thanks to: http://c-nergy.be/blog/?p=11336 for the tips.
#
@devblack
devblack / scraper.py
Last active April 28, 2024 03:18
Telegram CC Scraper for educational purposes
from environs import Env
from asyncio import get_event_loop
from telethon import TelegramClient, events
from telethon.network import ConnectionTcpAbridged
from telethon.errors import SessionPasswordNeededError
from logging import basicConfig, INFO, getLogger
from datetime import date
from re import sub, findall
# Load environment vars from .env file
@cmendible
cmendible / kubectl_ubuntu_wsl.sh
Created November 16, 2019 22:02
Install kubectl on ubuntu (WSL) and use kubectl config from Windows
#!/bin/bash
# Receives your Windows username as only parameter.
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.16.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
windowsUser=$1
@greenstick
greenstick / performance.py
Last active April 28, 2024 03:14
Python Class for Performance Assessment of Classification Tasks
#! /usr/bin/env python3
"""
Development Version: Python 3.5.1
Author: Benjamin Cordier
Description: Module For Performance
Assessment of Classification Task
License: BSD 3 Clause
--
@appel
appel / search-engines-import-export-chrome-edge-brave.md
Last active April 28, 2024 03:08
Export and import search engines from Chrome/Edge to Brave (bonus: Firefox to Firefox)

Export and import search engines from Chrome/Edge/Brave to Chrome/Edge/Brave

Bonus: Firefox to Firefox, see instructions at the bottom

As discussed here: brave/brave-browser#695

Thanks to the excellent answer by @Redsandro I was able to do this on Windows, which I'll document below because my future self will inevitably find this via Google a few years from now. Since it's using SQLite it should not be too hard to adapt for Macos and Linux.

Edit: this method still worked as of 9/3/2023. :)

@mbinna
mbinna / effective_modern_cmake.md
Last active April 28, 2024 03:08
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@siracusa
siracusa / Pro Display XDR at 120Hz bandwidth calculation.md
Last active April 28, 2024 03:07
Pro Display XDR at 120Hz bandwidth calculations

From Jonathan Dietz, Jr.:

Almost all new displays employ VESA Coordinated Video Timings using Reduced Blanking Timing Version 2 (CVT-RBv2) which adds a small amount of overhead to the video signal. This overhead includes 80 additional horizontal pixels and enough additional lines to meet the 460 µs minimum vertical blanking interval requirement. You can download an Excel spreadsheet from VESA that will do all the calculations for you, but the math is pretty simple:

460 / ((1000000 / [refresh rate in Hz] - 460) / [vertical resolution])

To get an integer number of lines, you round this result down and add 1. So for Pro Display XDR resolution at 120 Hz that would work out to:

460 / (1000000 / 120 - 460) / 3384) = 197.710 = 198 additional lines

@ritog
ritog / alacritty.toml
Created October 6, 2023 10:58
Example configuration file for Alacritty and simple guide
# $HOME/.config/alacritty/alacritty.toml
# by Rito Ghosh 2023-10-06
# Alacritty now uses TOML formatting for its config files.
# This is a simple example.
# There are the specification here: https://github.com/alacritty/alacritty/blob/master/extra/man/alacritty.5.scd
# It is not obvious how it translates to TOML. But it is extremely straightforward.
# example: WINDOW, COLORS, etc. are tables, and should be represented as [window], [colors], respectively.
@andrezrv
andrezrv / get-admin-path.php
Created October 30, 2014 21:18
Obtain path to wp-admin directory in WordPress.
<?php
/**
* Obtain the path to the admin directory.
*
* @return string
*/
function my_plugin_get_admin_path() {
// Replace the site base URL with the absolute path to its installation directory.
$admin_path = str_replace( get_bloginfo( 'url' ) . '/', ABSPATH, get_admin_url() );
@azk-mochi
azk-mochi / llvm-clang6.0.0-build.sh
Last active April 28, 2024 03:05
Script to build LLVM+Clang for jailbroken iOS (ARM64)
#LICENSE: retain the following license
#BSD 3-Clause "New" or "Revised" License
#and this: https://github.com/leetal/ios-cmake/blob/master/LICENSE.md
#Tested on LLVM 6.0.0 and Clang 6.0.0
#using XCode 9.1, iOS11.1 SDK
#make build directory
mkdir llvm-clang-ios