Skip to content

Instantly share code, notes, and snippets.

View antimech's full-sized avatar

Artur Gauzer antimech

View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active May 17, 2024 14:07
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@stancl
stancl / ci.yml
Created May 17, 2020 07:39
Minimal GitHub Action example for running phpunit
name: CI
on: [ push, pull_request ]
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@p3nj
p3nj / mullvad-wg-ks.sh
Last active February 18, 2021 16:59
Mullvad VPN Wireguard script with killswitch implant.
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2016-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
# Killswitch : https://github.com/vpn-kill-switch/homebrew-killswitch
die() {
echo "[-] Error: $1" >&2
exit 1
}
javascript: (function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
}
function h() {
@xahare
xahare / vagrant-qubes.md
Last active July 11, 2023 15:43
Vagrant on Qubes-OS

Vagrant on Qubes-OS

(Vagrant)[https://www.vagrantup.com] "Development Environments Made Easy"

(Qubes-OS)[https://www.qubes-os.org] "A Reasonably Secure Operating System."

This is a guide on to using vagrant on qubes-os with qemu using the libvirt provider. Because qubes-os does not support nested virtualization, you'r stuck with emulation. If you want performance, use a system with a proper vagrant setup.

Template Setup

import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
@gilbitron
gilbitron / after.sh
Last active March 1, 2023 22:06
Laravel Homestead daily database backup cron provision (after.sh)
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
if [ ! -f /etc/cron.daily/database-backup ]; then
sudo bash -c "cat > /etc/cron.daily/database-backup" <<EOL
#!/bin/bash
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active May 7, 2024 22:00
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@asvae
asvae / Ngrok на среде homestead
Last active April 20, 2017 09:42
Ngrok на среде homestead своими руками
Что такое [Ngrok](https://ngrok.com/)? Не спешите лететь по ссылке. Я сейчас расскажу.
Это своеобразный туннель к локалхосту. Допустим, у вас есть локальный проект, к которому вы обращаетесь следующим образом `http://my-project.local`. Ngrok позволяет другим человекам из интернета открыть ту же страницу, забив адрес `http://my-project.ngrok.com`.
Первый и главный вопрос:
Нафига оно нужно?
===========
1) Очень легко и просто показать заказчику полуфабрикат/прототип, и даже поправить что-нибудь на ходу.
2) Полезно для совместной разработки.
3) Можно хостить что-нибудь мелкое (извращение).
@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/