Skip to content

Instantly share code, notes, and snippets.

View dmitmel's full-sized avatar

Dmytro Meleshko dmitmel

View GitHub Profile
@rqu1
rqu1 / aes.bf
Last active January 11, 2023 23:52
AES-128 in Brainfuck
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@0xabad1dea
0xabad1dea / copilot-risk-assessment.md
Last active September 11, 2023 10:21
Risk Assessment of GitHub Copilot

Risk Assessment of GitHub Copilot

0xabad1dea, July 2021

this is a rough draft and may be updated with more examples

GitHub was kind enough to grant me swift access to the Copilot test phase despite me @'ing them several hundred times about ICE. I would like to examine it not in terms of productivity, but security. How risky is it to allow an AI to write some or all of your code?

Ultimately, a human being must take responsibility for every line of code that is committed. AI should not be used for "responsibility washing." However, Copilot is a tool, and workers need their tools to be reliable. A carpenter doesn't have to

@Kestrer
Kestrer / how-to-write-hygienic-macros.md
Created October 17, 2020 05:35
A guide on how to write hygienic Rust macros

How to Write Hygienic Rust Macros

Macro hygiene is the concept of macros that work in all contexts; they don't affect and aren't affected by anything around them. Ideally all macros would be fully hygienic, but there are lots of pitfalls and traps that make it all too easy to accidentally write unhygienic macros. This guide attempts to provide a comprehensive resource for writing the most hygienic macros.

Understanding the Module System

First, a little aside on the details of Rust's module system, and specifically paths; it is

@leonard84
leonard84 / prepare-mods.ps1
Last active November 1, 2023 12:16
Prepare mods for factorio.zone
# What is this?
#
# This is a script I wrote to automate the process of removing images and soundfiles from mods,
# so that they can be uploaded to factorio.zone without taking forever or even exceed the max-upload size.
# It also creates a mod-settings.zip so that your mod-settings.dat (Startup Settings) are available on the server.
#
# How to use
#
# Download the script and put it somewhere on you harddrive, e.g., C:\temp\factorio
# Open a powershell prompt "Win+x, i" or just type powershell in the startmenu.
@NullArray
NullArray / extended-example.pac
Last active January 29, 2024 01:21
pac script example
// Simple PAC script example
function FindProxyForURL(url, host) {
if ( /*condition to pass the request through a local proxy server */ ) {
return 'PROXY 127.0.0.1:8080';
/* If you have Tor installed you can route this connection over Tor like so;*/
/* return 'PROXY 127.0.0.1:9050'; */
}
if ( /*condition to pass the request through a network proxy server */ ) {

Time Travel Debugging

Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:

  • pause and step forwards or backwards
  • pause and rewind to a prior state
  • rewind to the time a console message was logged
  • rewind to the time an element had a certain style or layout
  • rewind to the time a network asset loaded
@DasWolke
DasWolke / microservice bots.md
Last active June 11, 2024 18:16
Microservice bots

Microservice Bots

What they are and why you should use them

Introduction

Recently more and more chatbots appear, the overall chatbot market grows and the platform for it grows as well. Today we are taking a close look at what benefits creating a microservice chatbot on Discord - (a communication platform mainly targeted at gamers) would provide.

The concepts and ideas explained in this whitepaper are geared towards bots with a bigger userbase where the limits of a usual bot style appear with a greater effect

Information about Discord itself

(If you are already proficient with the Discord API and the way a normal bot works, you may skip ahead to The Concept)

@Rich-Harris
Rich-Harris / README.md
Last active January 25, 2023 19:03
Unifying Rollup options

Rollup 0.48 introduces a few changes to the options object, because the current options are confusingly different between the CLI and the options exported by your config file.

Changes to the config file

  • entry is now input
  • sourceMap and sourceMapFile are now sourcemap and sourcemapFile (note casing)
  • moduleName is now name
  • useStrict is now strict

The dest and format options are now grouped together as a single output: { file, format, ... } object. output can also be an array of { file, format, ... } objects, in which case it behaves similarly to the current targets. Other output options — exports, paths and so on — can be added to the output object (though they will fall back to their top-level namesakes, if unspecified).

@gunar
gunar / cycleSort.js
Created May 4, 2017 02:37
Cycle sort implemented in JavaScript
'use strict'
// ref https://en.wikipedia.org/wiki/Cycle_sort
const cycleSort = array => {
// last item will already be in place
for (let cycleStart = 0; cycleStart < array.length-1; cycleStart++) {
let item = array[cycleStart]
// find where to put the item
let pos = cycleStart
@knadh
knadh / zsh-elapsed-time.md
Last active May 30, 2024 12:32
Elapsed and execution time for commands in ZSH

Elapsed and execution time display for commands in ZSH

Append this to your ~/.zshrc file.

function preexec() {
 timer=$(($(date +%s%0N)/1000000))