Skip to content

Instantly share code, notes, and snippets.

@danielroe
danielroe / settings.json
Last active May 17, 2024 09:37
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",
@Envek
Envek / rescue-from-git-push-force.md
Last active May 17, 2024 09:34
Откат ошибочной команды git push --force

Откат ошибочной команды git push --force

Иногда при работе с несколькими удалёнными репозиториями в git, может произойти страшное: git push --force в не тот remote и/или не в ту ветку.

Такое может случиться, например, если вы используете [Deis], в котором деплой запускается при git push нужного коммита в сборщик, когда при отладке деплоя после очередного git commit --amend по запарке вместо git push deis master --force делается просто git push --force. Упс.

Как результат, последние коммиты коллег безвозвратно потеряны, и вы чувствуете неотвратимость их ярости…

Но это git, а значит всё можно починить!

@klutchell
klutchell / s3fs.service
Created October 6, 2019 18:14
systemd unit file for s3fs fuse auto-mount
Description=S3FS FUSE mount
Documentation=https://github.com/s3fs-fuse/s3fs-fuse
Wants=network-online.target
After=network-online.target
AssertPathIsDirectory=/mnt/s3fs
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/s3fs mybucket:/bucketdir /mnt/s3fs -o url=https://nyc3.digitaloceanspaces.com -o use_cache=/tmp -o allow_other -o use_path_request_style -o uid=1000 -o gid=1000
// DHT
#include <dht.h>
// Wifi
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
// MQTT
#include <PubSubClient.h>
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 17, 2024 09:31
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@quyenlv
quyenlv / tacacs-plus-launch.rst
Last active May 17, 2024 09:30
Very basic steps to try TACACS+.

Installation

Install tacacs+ server:

sudo apt-get install tacacs+

Install tacacs+ client:

@imankulov
imankulov / sqlalchemy_with_pydantic.py
Last active May 17, 2024 09:29
Using pydantic models as SQLAlchemy JSON fields (convert beween JSON and pydantic.BaseModel subclasses)
#!/usr/bin/env ipython -i
import datetime
import json
from typing import Optional
import sqlalchemy as sa
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy.dialects.postgresql import JSONB
from pydantic import BaseModel, Field, parse_obj_as
@dcchambers
dcchambers / md2pdf.md
Last active May 17, 2024 09:26
Generate a PDF from Markdown files with Pandoc

Generate a PDF from a Markdown file with Pandoc

Easy Steps For Mac OS

  1. Have Homebrew installed and a markdown file you want to render to PDF.
  2. Install Pandoc brew install pandoc
  3. Install basictex brew cask install basictex - needed for the pdflatex tool.
  4. Symlink the pdflatex to your /usr/local/bin so pandoc can easily find it. ln -s /Library/TeX/Root/bin/x86_64-darwin/pdflatex /usr/local/bin/pdflatex
  5. Use Pandoc to generate a PDF from a Markdown file. pandoc input.md -o output.pdf
  • By default the margins are pretty large. To optionally change the margins: pandoc input.md -o output.pdf -V geometry:margin=1in
@rain1024
rain1024 / tut.md
Last active May 17, 2024 09:26
Install pdflatex ubuntu

PdfLatex is a tool that converts Latex sources into PDF. This is specifically very important for researchers, as they use it to publish their findings. It could be installed very easily using Linux terminal, though this seems an annoying task on Windows. Installation commands are given below.

  • Install the TexLive base
sudo apt-get install texlive-latex-base
  • Also install the recommended and extra fonts to avoid running into the error [1], when trying to use pdflatex on latex files with more fonts.
@dwhitney
dwhitney / README.md
Last active May 17, 2024 09:25
Quick React Native with PureScript
  1. create-react-native-app purescript-app; cd purescript-app

  2. pulp init --force

  3. pulp build

  4. src/Main.js

var React = require("react");
var RN = require("react-native");

exports.text = function(props){