Skip to content

Instantly share code, notes, and snippets.

View okyanusoz's full-sized avatar
🤠
Always learning

okyanusoz

🤠
Always learning
View GitHub Profile
@okyanusoz
okyanusoz / main.c
Last active July 10, 2023 17:59
Basic vectors/arrays in C
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
struct Vector {
int size;
uint8_t* offset;
};
void vector_resize(struct Vector* vec, int newsize) {
@okyanusoz
okyanusoz / colors.css
Created September 23, 2022 16:31
Color shades
/*
* Color shades
* Shades shamelessly stolen from Tailwind CSS (https://github.com/tailwindlabs/tailwindcss/blob/master/src/public/colors.js)
* Auto generated using a JS script
* Usage:
background-color: var(--sky-50);
*/
:root {
--black: #000;
--white: #fff;
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
@okyanusoz
okyanusoz / size.c
Created July 24, 2022 16:29
C code to print the size of file(s) in a human friendly format
#include <stdio.h>
#include <ftw.h>
#include <sys/stat.h>
#include <sys/dir.h>
#include <dirent.h>
void printbytes(char *filename, long l)
{
printf("%s: ", filename);
@okyanusoz
okyanusoz / README.md
Created December 5, 2020 18:40
A script to quickly setup Docker

This is a script that installs Docker
NOTE: This script does not add your user to the docker group, it simply installs Docker
This will not install Docker Compose, but there is a script that does that here.
You need to run the script as root.