Skip to content

Instantly share code, notes, and snippets.

View yshurik's full-sized avatar
🎯
Focusing

yshurik yshurik

🎯
Focusing
  • Kyiv
  • 13:33 (UTC +03:00)
View GitHub Profile
@yshurik
yshurik / gist:75efeccf80f1cffc8c84b5aa91d28331
Created May 12, 2024 20:24 — forked from dpgeorge/gist:cf701079aee1c8d201a4
Simple, minimal deflate/inflate code
// simple, minimal deflate/inflate code
// copyright 2010, Damien P. George
import "std.h";
import "iobuf.h";
uint con BSIZE = 1024;
type buf_history = (
byte own# buf,
library LZF {
function decompress(bytes memory compressed, bytes memory decompressed) internal {
uint ip;
uint in_end;
uint op;
assembly {
// OP points to the current output location in memory
op := add(decompressed, 32)
// IP actually points to 31 bytes before the desired location, so
// MLOADs work correctly
@yshurik
yshurik / multiple_ssh_setting.md
Created July 13, 2018 19:48 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@yshurik
yshurik / pg-encoding.txt
Created April 25, 2018 20:01 — forked from anandology/pg-encoding.txt
Fixing PostgreSQL default encoding in Ubuntu
# Option 1 - rebuild the cluster
# This will delete alle existing data
pg_dropcluster --stop 9.2 main
pg_createcluster --start -e UTF-8 9.2 main
# Option 2 - rebuild the template1 database
# All the database created after this will have UTF-8 encoding
function gmailAutoarchive() {
var delayDays = 2; // will only impact emails more than 48h old
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-delayDays); // what was the date at that time?
// Get all the threads labelled 'autoarchive'
var label = GmailApp.getUserLabelByName("autoarchive");
var threads = label.getThreads(0, 400);