Skip to content

Instantly share code, notes, and snippets.

@apgapg
apgapg / scrap.dart
Created July 19, 2020 07:25
Scrap data from website
void initChaptersTitleScrap() async {
final rawUrl =
'https://unacademy.com/course/gravitation-for-iit-jee/D5A8YSAJ';
final webScraper = WebScraper('https://unacademy.com');
final endpoint = rawUrl.replaceAll(r'https://unacademy.com', '');
if (await webScraper.loadWebPage(endpoint)) {
final titleElements = webScraper.getElement(
'div.Week__Wrapper-sc-1qeje5a-2 > a.Link__StyledAnchor-sc-1n9f3wx-0 '
'> div.ItemCard__ItemInfo-xrh60s-1 '
'> h6.H6-sc-1gn2suh-0',
@x4fx77x4f
x4fx77x4f / unsubscribe_unavailable.js
Last active May 5, 2024 18:47
Unsubscribe unavailable Teardown mods
/*
# unsubscribe_unavailable.js
This script will go through your Steam Workshop mod subscriptions for
Teardown mods and unsubscribe from any that are unavailable (e.g. private).
## Usage:
1. Open a tab to any page on the steamcommunity.com domain
2. Open developer tools (Ctrl+Shift+I or F12)
3. Go to "Console" tab
4. Copy and paste the contents of this file into it
4.a.: Don't do this unless you trust me. Malicious code in the developer

A metatable can be defined like

local t = setmetatable({}, {
  __tostring = function() return 'custom tostring behavior!' end
})

Here are the metamethods that you can define, and their behavior

Operators

@taskylizard
taskylizard / fmhy.md
Last active May 5, 2024 18:42
/r/freemediaheckyeah, in one single file (view raw)
@anirudhshenoy
anirudhshenoy / utility_functions.py
Last active May 5, 2024 18:41
Utility Functions to evaluate model and select threshold values for prediction
%matplotlib inline
import matplotlib.pyplot as plt
from sklearn.metrics import precision_recall_curve, f1_score, accuracy_score, roc_auc_score, confusion_matrix
import seaborn as sns
sns.set_palette("muted")
def calc_f1(p_and_r):
p, r = p_and_r
return (2*p*r)/(p+r)
@renatocassino
renatocassino / docker-compose-graphite-statsd-grafana-loki.yml
Last active May 5, 2024 18:39
Docker compose to build graphite, statsd, grafana and Loki (logs)
version: '3'
services:
loki:
image: grafana/loki:2.0.0
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
promtail:
image: grafana/promtail:2.0.0
volumes:
@rvrsh3ll
rvrsh3ll / windows-keys.md
Created February 18, 2024 22:44
Windows Product Keys

NOTE

These are NOT product / license keys that are valid for Windows activation.
These keys only select the edition of Windows to install during setup, but they do not activate or license the installation.

Index

@Kranzes
Kranzes / guide.md
Last active May 5, 2024 18:38
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:

@brandon1024
brandon1024 / GITCRASHCOURSE.MD
Last active May 5, 2024 18:37
Git Crash Course for Beginners

Git Crash Course for Beginners

Preface

A good understanding of Git is an incredibly valuable tool for anyone working amongst a group on a single project. At first, learning how to use Git will appear quite complicated and difficult to grasp, but it is actually quite simple and easy to understand.

Git is a version control system that allows multiple developers to contribute to a project simultaneously. It is a command-line application with a set of commands to manipulate commits and branches (explained below). This tutorial will help you get started, and in no time you will be a Git Ninja!

Contents:

@r15ch13
r15ch13 / iommu.sh
Last active May 5, 2024 18:26
List IOMMU Groups and the connected USB Devices
#!/usr/bin/env bash
shopt -s nullglob
lastgroup=""
for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do
for d in $g/devices/*; do
if [ "${g##*/}" != "$lastgroup" ]; then
echo -en "Group ${g##*/}:\t"
else
echo -en "\t\t"