Skip to content

Instantly share code, notes, and snippets.

View aizotov's full-sized avatar
🎯
Focusing

Andrey Izotov aizotov

🎯
Focusing
View GitHub Profile
require 'cgi'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base = Rails.application.secret_key_base)
config = Rails.application.config
cookie = CGI::unescape(cookie)
salt = config.action_dispatch.authenticated_encrypted_cookie_salt
encrypted_cookie_cipher = config.action_dispatch.encrypted_cookie_cipher || 'aes-256-gcm'
# serializer = ActiveSupport::MessageEncryptor::NullSerializer # use this line if you don't know your serializer
serializer = ActionDispatch::Cookies::JsonSerializer
@granmoe
granmoe / React Join Children
Last active December 7, 2022 14:50
Ever wanted to join react children like you join an array?
This file is only here to provide the title of the gist
@aectann
aectann / simpleHttpServer.py
Created September 16, 2015 10:50 — forked from azakordonets/simpleHttpServer.py
Python simple HTTP Server that get's two variables for launch - port and time delay( time after which server will return response) . If we do not specify this two values, then server starts on 8000 port with delay = 0
#!/usr/bin/env python
import SimpleHTTPServer, BaseHTTPServer, SocketServer, socket, time, sys
class ThreadedHTTPServer(SocketServer.ThreadingMixIn,
BaseHTTPServer.HTTPServer) :
"""
New features w/r to BaseHTTPServer.HTTPServer:
- serves multiple requests simultaneously
- catches socket.timeout and socket.error exceptions (raised from
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active April 30, 2024 06:01
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@4np
4np / unzip.sh
Last active January 16, 2023 15:10
Unzip multipart zip file on Mac OS X / Linux / Unix oneliner
cat *.zip > combined.zip;zip -FF combined.zip --out combined-fixed.zip;rm combined.zip;yes A|unzip -qq combined-fixed.zip;rm combined-fixed.zip