Skip to content

Instantly share code, notes, and snippets.

Generating this file is now built into rustlings:

rustlings lsp

For more information on how this file works checkout the Rust Analyzer Manual

@ttilberg
ttilberg / debug_runner.py
Last active September 9, 2020 20:51
Scrapy debugging in VSCode made easy.
from scrapy.cmdline import execute
try:
execute(
[
'scrapy',
'crawl',
'spidername',
# '-a',
# 'some_attr=some_value
@jsynowiec
jsynowiec / sync_theme.py
Last active March 5, 2024 06:06
Sync iTerm2 color preset with macOS dark or light theme on start and when theme changes.
#!/usr/bin/env python3
"""Set iTerm2 color preset according to macOS theme.
Requires iTerm2 version 3.3 or newer.
Save as ~/Library/ApplicationSupport/iTerm2/Scripts/AutoLaunch/sync_theme.py and
enable under scripts menu in iTerm2.
"""

Introduction

I was recently asked to explain why I felt disappointed by Haskell, as a language. And, well. Crucified for crucified, I might as well criticise Haskell publicly.

First though, I need to make it explicit that I claim no particular skill with the language - I will in fact vehemently (and convincingly!) argue that I'm a terrible Haskell programmer. And what I'm about to explain is not meant as The Truth, but my current understanding, potentially flawed, incomplete, or flat out incorrect. I welcome any attempt at proving me wrong, because when I dislike something that so many clever people worship, it's usually because I missed an important detail.

Another important point is that this is not meant to convey the idea that Haskell is a bad language. I do feel, however, that the vocal, and sometimes aggressive, reverence in which it's held might lead people to have unreasonable expectations. It certainly was my case, and the reason I'm writing this.

Type classes

I love the concept of type class

# Copyright 2018 Stanko K.R. <me@stanko.io>
#
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute,
# sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject
# to the following conditions:
@chrismccord
chrismccord / phx-1.4-upgrade.md
Last active June 16, 2023 06:22
Phoenix 1.3.x to 1.4.0 Upgrade Guides

Phoenix 1.4 ships with exciting new features, most notably with HTTP2 support, improved development experience with faster compile times, new error pages, and local SSL certificate generation. Additionally, our channel layer internals receiveced an overhaul, provided better structure and extensibility. We also shipped a new and improved Presence javascript API, as well as Elixir formatter integration for our routing and test DSLs.

This release requires few user-facing changes and should be a fast upgrade for those on Phoenix 1.3.x.

Install the new phx.new project generator

The mix phx.new archive can now be installed via hex, for a simpler, versioned installation experience.

To grab the new archive, simply run:

// Clearly the best hello world out there.
#define _ATL_ATTRIBUTES 1
#define _WINDLL 1
#include <atlbase.h>
#include <atlcom.h>
#include <string.h>
#include <comdef.h>
#include <string>
#include <fstream>
#include <iostream>
@rfikki
rfikki / ropsten-peers-latest.txt
Last active September 24, 2022 03:23
Updated July 15, 2020: Ropsten Latest Peers with Istanbul - IMPORTANT RUN THE LATEST RELEASE OF THE CLIENT - https://geth.ethereum.org/downloads/
admin.addPeer("enode://8c5131f577ee602ccaad5e5f600011c024d43d33e6af6f8a89ed26cbfadd7efe903a8e426dde4071b857e0838a2efa29ae3b268f8b55acd59e72d4a919673cbc@13.251.47.174:30303");
admin.addPeer("enode://798b8eba7b65cdd71bb061a6b18a1f7d16612d54e1aa542d8dc5c3573322b5dd7496c1eea100dbb84f8495d89f3d5ddb4142b0006a73cd32daa2f643bd5d1c76@175.24.29.183:30311");
admin.addPeer("enode://9a4be35fec78cf91e7e959029ae3f5d3d3e86446186eb14f181c8f3b9917f57839ef98d4ba53cf06eb4fea696ecc14796b34d96db4f4294864edfcab27dd9956@31.220.51.107:30303");
admin.addPeer("enode://2763ab6d19d6e7ce7a953ba95c9a87fe6ae5eac3434bf216282f53142d89cb5451faa701311d7de1d79cc8ecbd57f1781156e26f5722aee835547aeab870e385@52.237.88.221:30303");
admin.addPeer("enode://81488a6c0b62aa14a1172d607893b6317e4f2565ca2bd73c7c0b8bfd55842af6b7972218728d1f352b3fddc61d0dccbf92e81d2bbfdc375db44ae44ee332d4db@88.198.59.75:30303");
admin.addPeer("enode://3d55f613d74e90f5b8a4154d20d8a7260a973751c1402bf52adde2b08b72a9e0327a522bf187765f2d6e2a3b893dfe7aa41b204bce5f793bd9470f24fa3aafc
import Data.Semigroup
import Data.Functor
import Control.Applicative
data Validation err a = Failure err | Success a
deriving Show
instance Functor (Validation err) where
fmap f (Success a) = Success (f a)
fmap _ (Failure e) = Failure e
@dublado
dublado / gist:ad57bdc6008d7744e82308091927d1ca
Created February 5, 2017 22:48
docker-compose ERROR: Failed to Setup IP tables: Unable to enable SKIP DNAT
ip link delete docker0
systemctl restart docker