Skip to content

Instantly share code, notes, and snippets.

@ndarville
ndarville / diff.mdown
Created July 23, 2012 20:33
Paul Heckel's Diff Algorithm

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

>The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.

@tabjy
tabjy / ws.js
Created March 11, 2021 00:31
WebSocket from scratch. In Node.js
const http = require('http')
const crypto = require('crypto')
const server = http.createServer((req, res) => {
console.log('got request', req.url)
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('okay')
})
server.on('upgrade', function (req, socket) {

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
@Vincent-Stragier
Vincent-Stragier / tutorial.md
Last active May 5, 2024 11:10 — forked from crundberg/gist:a77b22de856e92a7e14c81f40e7a74bd
Setup USB (COM port) pass-through on unprivileged Proxmox container

Setup USB (COM port) pass-through on unprivileged Proxmox container

Preparation on host

First find your USB device with lsusb and note the ID. Here, the USB device is the Arduino SA Uno R3 (CDC ACM). The vendor is 2341 and the product is 0041.

root@home:~# lsusb
Bus 003 Device 003: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Bus 003 Device 002: ID 0438:7900 Advanced Micro Devices, Inc. Root Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
@edilsoncichon
edilsoncichon / Laravel Setup Script for Ubuntu 22.sh
Last active May 5, 2024 11:09 — forked from rolandstarke/laravel setup.sh
Ubuntu 22.04 setup bash script for Laravel 10 (PHP and Nginx)
# Ubuntu 20 LTS Server Setup for Laravel
# Login as root user
sudo su -
# Update list of available packages
apt update
@MrNegativeTW
MrNegativeTW / ImgurApiService.kt
Last active May 5, 2024 11:09
Retrofit 2 Kotlin Example, Imgur upload image example.
package com.your.packagename
import com.txwstudio.app.roadreport.json.imgurupload.ImgurUploadJson
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Header
import retrofit2.http.Multipart

Transparent Restaurant Backend

In this task, you're going to implement a REST API for a interacting with a menu of a restaurant. The menu is given to you as a JSON file which you will parse and perform operations on. The required features will be listed below.

Description

In this restaurant, honesty is extremely promoted. So extreme, that the restaurant declares that differing quality of ingredients are used in their meals. Like that's not enough, it also allows the customers to choose the ingredients of each meal in different qualities. Each ingredient has the following quality levels:

  • low: the cheapest
  • medium: moderate
@arreche
arreche / bitbucket-pipelines.yml
Last active May 5, 2024 11:00
Run Angular tests in Bitbucket Pipelines
pipelines:
default:
- step:
name: Install, Lint, Test and Build
caches:
- node
script:
- npm install
- npm run lint
- >
@fisadev
fisadev / work
Created December 3, 2015 14:57
A python script to launch my tmux things at once
#!/usr/bin/env python
# coding: utf-8
from os import system
PROJECT_PATH = 'path_to_your_project'
ACTIVATE_VENV = '. path_to_your_virtualenv/bin/activate'
def tmux(command):
@wojteklu
wojteklu / clean_code.md
Last active May 5, 2024 10:53
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules