Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 17, 2024 18:42
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

@diego3g
diego3g / settings.json
Last active May 17, 2024 18:36
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 14,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [80, 120],
"extensions.ignoreRecommendations": true,
"typescript.tsserver.log": "off",
"files.associations": {
@Klerith
Klerith / random-hex.md
Created September 22, 2023 17:47
Secure Random Hex

Comando con Ruby instalado

ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'

Ejemplo: No usar en producción

4510c8cf2fe423f8be5afccbdd30c678677e172b

@minhphuc429
minhphuc429 / hash.mqh
Created March 28, 2020 22:24
Libraries: JSON Parser MQL4
// $Id: hash.mqh 125 2014-03-03 08:38:32Z ydrol $
#ifndef YDROL_HASH_MQH
#define YDROL_HASH_MQH
//#property strict
/*
This is losely ported from a C version I have which was in turn modified from hashtable.c by Christopher Clark.
Copyright (C) 2014, Andrew Lord (NICKNAME=lordy) <forex@NICKNAME.org.uk>
Copyright (C) 2002, 2004 Christopher Clark <firstname.lastname@cl.cam.ac.uk>
@simonw
simonw / recover_source_code.md
Last active May 17, 2024 18:28
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@0xdevalias
0xdevalias / converting-json-to-openapi-swagger-spec.md
Created June 2, 2023 01:09
Exploring tools that allow converting a JSON response automagically into an OpenAPI / Swagger spec.

Converting JSON to OpenAPI / Swagger spec

Exploring tools that allow converting a JSON response automagically into an OpenAPI / Swagger spec.

Test JSON Response

{
    "accounts": {
        "default": {
@leommoore
leommoore / file_magic_numbers.md
Last active May 17, 2024 18:26
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@bkanhu
bkanhu / beginners_ubuntu.md
Last active May 17, 2024 18:26
A Beginners Guide on Things To Do After Installing Ubuntu.

Beginners Ubuntu

A Beginners Guide To Things To Do After Installing Ubuntu.

1. Check For Updates

sudo apt update && sudo apt upgrade

2. Enable additional repositories for more software

Ubuntu has several repositories from where it provides software for your system. Enabling all these repositories will give you access to more software and proprietary drivers.