Skip to content

Instantly share code, notes, and snippets.

@nir9
nir9 / chat-client.c
Created January 14, 2024 00:17
Minimalist Chat Server and Client in C - just for fun, not suitable for production
#include <sys/socket.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <poll.h>
#include <unistd.h>
int main() {
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in address = {
@Delivator
Delivator / google_search_maps_addon.user.js
Last active April 24, 2024 19:51 — forked from Daan-Grashoff/google_search_maps_addon.js
Bring back the google maps button and make map image clickable when searching on google
// ==UserScript==
// @name Google Search Maps Fix
// @namespace http://tampermonkey.net/
// @version 2024-03-07
// @description Bring Google maps button back
// @author Daan Grashoff / Delivator
// @match https://www.google.com/search*
// @include https://www.google.tld/search*
// @icon https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png
// @grant none
@Jekins
Jekins / Markdown-docs.md
Last active April 24, 2024 19:50
Руководство по оформлению Markdown файлов

Руководство по оформлению Markdown файлов

Markdown - это облегчённый язык разметки, который преобразует текст в структурированный HTML. Следующее руководство поможет вам разобраться, как использовать Markdown.

Заголовки

# Заголовок первого уровня
## Заголовок второго уровня
### Заголовок третьего уровня
#### Заголовок четвёртого уровня
##### Заголовок пятого уровня
@staltz
staltz / introrx.md
Last active April 24, 2024 19:47
The introduction to Reactive Programming you've been missing
@baiwfg2
baiwfg2 / it-ebooks.md
Last active April 24, 2024 19:44
Download ebooks as you want
@wangruohui
wangruohui / intel-nvidia.md
Last active April 24, 2024 19:43
Intel for display, Nvidia for computing

Intel for display, NVIDIA for computing

This guide will show you how to use Intel graphics for rendering display and NVIDIA graphics for CUDA computing on Ubuntu 18.04 / 20.04 desktop.

I made this work on an ordinary gaming PC with two graphics devices, an Intel UHD Graphics 630 plus an NVIDIA GeForce GTX 1080 Ti. Both of them can be shown via lspci | grep VGA.

00:02.0 VGA compatible controller: Intel Corporation Device 3e92
01:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)
@tinkerer-red
tinkerer-red / Promise.gml
Last active April 24, 2024 19:43
Javescript Promises in GameMaker's GML
#macro PROMISE_MAX_TIME (1/60 * 1_000 * 1_000) * (1/16) //the max time in milli seconds to spend on the promises, default is 1/16 of frame time of a 60 fps game
enum PROMISE_STATE {
PENDING,
RESOLVED,
REJECTED,
PAUSED,
};
function __PromiseNamespace__() {
@mblondel
mblondel / letor_metrics.py
Last active April 24, 2024 19:43
Learning to rank metrics.
# (C) Mathieu Blondel, November 2013
# License: BSD 3 clause
import numpy as np
def ranking_precision_score(y_true, y_score, k=10):
"""Precision at rank k
Parameters

Boolean() or !! (double bang, double negation)?

What's the best way to answer the question "true or false?" in JavaScript

JavaScript does not bother you too much with types (at first), which is both a blessing and a cure. But we all know the Boolean type. Boolean variables can either be true or false. Yes or no.

Every value in JavaScript can be translated into a boolean, true or false. Values that translate to true are truthy, values that translate to false are falsy. Simple.

This is about two ways to make that translation.

@RaschidJFR
RaschidJFR / mp3_to_wav.js
Last active April 24, 2024 19:42
Convert mp3 files to wav recursively using ffmpeg in node.js
// Convert mp3 files recursively to wav using [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg) for [node.js](https://nodejs.org)
//
// 1. Install fluent-ffmpeg: `npm install fluent-ffmpeg`
// 2. Run this script: `node mp3ToWav.js [path/to/file/or/folder]`
convertMp3ToWav = function (input) {
let segments = input.split('/');
let filename = segments[segments.length - 1];
let extension = filename.split('.')[1];