Skip to content

Instantly share code, notes, and snippets.

View frenchbread's full-sized avatar
🎯
Focusing

Damir Mustafin frenchbread

🎯
Focusing
  • Wunderdog Oy
  • Finland
View GitHub Profile
@gullyn
gullyn / flappy.html
Last active May 4, 2024 15:35
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@arogulin
arogulin / VortexRace3ForMac.md
Last active February 7, 2024 15:42
How to setup Vortex Race 3 keyboard for Mac and move Fn key to Home

How to setup Vortex Race 3 for Mac with latest (on 2020-01-05) firmare V1.02.05.

For better understanding we will use the following naming convention:

  [ L1 ][ L2 ][ L3 ][ Space ][ R1 ][ R2 ][ R3 ]
  1. Reset everything by pressing L3+R1 for 5 seconds. Left LED will blink white color while you're holding the keys. Release them after it stopeed blinking.
  2. Get into one of the programmable layers (R2+RShift) – I like red, the super bright laser LED is the least super annoying in red.
  3. Put the keyboard in Windows Mode (Pn+W), it's the least problematic one.
@FranckFreiburger
FranckFreiburger / getJpegQuality.js
Created October 4, 2018 13:22
pure JavaScript jpeg quality value recover
// javascript jpeg decoder: https://github.com/eugeneware/jpeg-js/blob/79c4c7ea876d2e7b46981a563fcc4ae8f9e19849/lib/decoder.js
// Determine the JPEG compression quality from the quantization tables: https://github.com/ImageMagick/ImageMagick/blob/59f28acff016f6ae5e8b7e6300bcdf97e94affc9/coders/jpeg.c#L879
// JPEG File Layout and Format: http://vip.sugovica.hu/Sardi/kepnezo/JPEG%20File%20Layout%20and%20Format.htm
// jpeg constants: https://github.com/LuaDist/libjpeg/blob/6c0fcb8ddee365e7abc4d332662b06900612e923/jpeglib.h#L45
function getQuantizationTables(data) {
var quantizationTables = []
var dctZigZag = new Int32Array([
@munnellg
munnellg / benchmark.cpp
Created August 22, 2018 18:02
strlen performance comparison by Rick Meyer
// Compile (on OSX/Linux) using:
// clang -o benchmark -std=c++11 -Ofast benchmark.cpp -lstdc++
// gcc -o benchmark -std=c++11 -O3 benchmark.cpp -lstdc++
#include <cstring>
#include <chrono>
#include <iostream>
#include <assert.h>
double currentTimeInSeconds()
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;

от Али-Бабы и разбойников, к лье под водой и к вархаммеру

Давайте я сразу скажу - речь пойдет о биткоинах. При этом не буду вас агитировать за или против - это вообще не мое дело. Я просто расскажу вам о своем отношении к этому феномену и мифам вокруг него.

Для начала стоит сказать, что я не рассматриваю биткоин как валюту. Это не средство, которое заменит кредитные карты или ежедневные расчеты - для этого есть lightning network и другие средства децентрализации. Для меня биткоин - это актив, максимально похожий на золото во всех его проявлениях, кроме физического присутствия. Биткоины добывают, причем, чем больше биткоинов люди уже добыли, тем сложнее добывать дальше. Количество биткоинов, которые вообще можно будет добыть и пустить в оборот, фиксировано. Обмен биткоинами происходит “из рук в руки”. Хранить биткоины не трудно, затратно только получить или передать их. Замените “биткоины” на “золото” - каждое из этих заявлений так же будет действительно.

Поведение “золотых с

Uninstall brew package and dependencies

Remove package's dependencies (does not remove package):

brew deps [FORMULA] | xargs brew remove --ignore-dependencies

Remove package:

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@harpreetkhalsagtbit
harpreetkhalsagtbit / Automate Testing of Meteor application with TheIntern.md
Last active January 25, 2016 14:12
Automate Testing of a Meteor Application using TheIntern.io

Testing Meteor Application with TheIntern.io

Problem

  1. Where to place tests folder and npm packages in Meteor folder structure so that they won't run with meteor command.

  2. How to access Meteor global variable and Meteor Collections.

  3. How to run tests?