Skip to content

Instantly share code, notes, and snippets.

@Plnda
Plnda / controller.js
Last active Oct 4, 2022
Get native gamepad working with SteamDeck
View controller.js
var HID = require('node-hid');
const express = require('express');
// Steam Neptune Controller
var device = new HID.HID("/dev/hidraw3");
var port = 8000
var controller = {
id: "Steam Controller (Neptune)",
index: 0,
@john-clark
john-clark / i.pxe
Last active Oct 4, 2022
ipxe php boot system
View i.pxe
#!ipxe
#
# This file gets compiled into undionly.kpxe
################################################################
:vars
set next-server 192.168.2.121
cpuid --ext 29 && set arch amd64 || set arch x86
:netconfig
dhcp net0 || goto ipxeshell
:prompt
@mid-kid
mid-kid / minecraft-chat-client.py
Last active Oct 4, 2022
Basic minecraft chat client written in Python.
View minecraft-chat-client.py
#!/usr/bin/env python3
"""
Simple script that implements the minecraft protocol
to create a basic chat client for said game.
No encryption, no online mode, no parsing of chat messages.
I tried to make it as extendable as possible, so hack away.
PEP8 Note: Ignored E302 (2 newlines between functions)
"""
@bvertullo
bvertullo / external_ip_websites.txt
Created Jan 17, 2022
Domains you can "curl" to get your external IP address based on using the name of the common network utilities ipconfig and ifconfig as the domain.
View external_ip_websites.txt
Use by running "curl $domain"
IP with no line terminator such as Carriage Return (\x0D) or Line Feed (\x0A):
ifconfig.be
ifconfig.ca
ifconfig.cc
ifconfig.in
ifconfig.me
ifconfig.rest
ifconfig.so
@MichaelCurrin
MichaelCurrin / README.md
Last active Oct 4, 2022
GitHub GraphQL - Get files in a repository
View README.md

Get GitHub Files

Get the metadata and content of all files in a given GitHub repo using the GraphQL API

You might want to get a tree summary of files in a repo without downloading the repo, or maybe you want to lookup the contents of a file again without download the whole repo.

The approach here is to query data from GitHub using the Github V4 GraphQL API.

About the query

View custom-progress-bar-with-text.swift
//
// PlainHorizontalProgressBar.swift
//
// Created by Julia Nikitina on 23.05.2020.
// Copyright © 2020 Julia Nikitina. All rights reserved.
//
import UIKit
@IBDesignable
final class PlainHorizontalProgressBar: UIView {
View django-speed-run-part-1.md

Django Speed run

In video gaming culture a speed run is where someone tries to play a video game all the way through as fast as they can. Turns out this is a great way to practice! So we are going to be setting up a basic django app from scratch as fast as we can.

We want to get to the point where we do the following as fast as possible.

  1. Create a project folder
@sts10
sts10 / rust-command-line-utilities.markdown
Last active Oct 4, 2022
A curated list of command-line utilities written in Rust
View rust-command-line-utilities.markdown

A curated list of command-line utilities written in Rust

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, exa, fd, hyperfine, miniserve, ripgrep, just, zoxide and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
  • bat: A replacement for cat that provides syntax highlighting and other features.
  • bottom: Yet another cross-platform graphical process/system monitor.
View coolest_pattern_matching.rb
# Ruby 3.1+
users = [
{ name: "Yukihiro Matsumoto", age: 57 },
{ name: "Kabosu the Shiba Inu", age: 16 },
{ name: "Thiago Massa", age: 33 }
]
def fetch_age_from_person(person, hash)
hash => [*, {name: ^person, age: age}, *]
@svpino
svpino / mnist.py
Created Feb 24, 2021
CNN to solve MNIST dataset
View mnist.py
import numpy as np
import pandas as pd
import random
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Flatten, Conv2D, Dense, MaxPooling2D
from tensorflow.keras.optimizers import SGD
from tensorflow.keras.utils import to_categorical