Skip to content

Instantly share code, notes, and snippets.

View CoolOppo's full-sized avatar
🇺🇲

Max Azoury CoolOppo

🇺🇲
View GitHub Profile
@CoolOppo
CoolOppo / Auto-Upgrade.sh
Last active February 3, 2019 03:22
Auto-upgrade for apt-get
sudo apt-get update
sudo apt-get -fqyp dist-upgrade --auto-remove --purge
sudo apt-get autoclean
@CoolOppo
CoolOppo / Pointers.md
Last active December 8, 2020 11:34
An excellent guide on pointers, converted from HTML to Markdown

[Source][1]

Pointers

In earlier chapters, variables have been explained as locations in the computer's memory which can be accessed by their identifier (their name). This way, the program does not need to care about the physical address of the data in memory; it simply uses the identifier whenever it needs to refer to the variable. For a C++ program, the memory of a computer is like a succession of memory cells, each one byte in size, and each with a unique address. These single-byte memory cells are ordered in a way that allows data representations larger than one byte to occupy memory cells that have consecutive addresses. This way, each cell can be easily located in the memory by means of its unique address. For example, the memory cell with the address 1776 always follows immediately after the cell with address 1775 and precedes the one with 1777, and is exactly one thousand cells after 776 and exactly one thousand cells before 2776. When a variable is declared, the memory needed

@CoolOppo
CoolOppo / Background Command in Ubuntu.md
Last active August 29, 2015 14:00
Run a command in the background in Ubuntu

Use (setsid yourcommand &), it detaches from the tty and works equally in interactive and script modes.

( spawns a subshell, which handles job control differently.

Or use nohup yourcommand > /dev/null 2>&1 &

Tags

  • Linux
@mcasperson
mcasperson / gist:11315910
Last active December 3, 2020 07:49
Pandoc Emscripten
Add this to Ghc-Options in pandoc.cabal
-fllvm -keep-llvm-files -fforce-recomp
./emcc <all *.ll files> -o pandoc.js
emcc ./src/Text/Pandoc.ll ./src/Text/Pandoc/Compat/TagSoupEntity.ll ./src/Text/Pandoc/Compat/Monoid.ll ./src/Text/Pandoc/XML.ll ./src/Text/Pandoc/Writers/ICML.ll ./src/Text/Pandoc/Writers/FB2.ll ./src/Text/Pandoc/Writers/Man.ll ./src/Text/Pandoc/Writers/EPUB.ll ./src/Text/Pandoc/Writers/RST.ll ./src/Text/Pandoc/Writers/Docbook.ll ./src/Text/Pandoc/Writers/Org.ll ./src/Text/Pandoc/Writers/Markdown.ll ./src/Text/Pandoc/Writers/HTML.ll ./src/Text/Pandoc/Writers/ConTeXt.ll ./src/Text/Pandoc/Writers/Docx.ll ./src/Text/Pandoc/Writers/Texinfo.ll ./src/Text/Pandoc/Writers/MediaWiki.ll ./src/Text/Pandoc/Writers/Native.ll ./src/Text/Pandoc/Writers/Shared.ll ./src/Text/Pandoc/Writers/OpenDocument.ll ./src/Text/Pandoc/Writers/ODT.ll ./src/Text/Pandoc/Writers/Custom.ll ./src/Text/Pandoc/Writers/OPML.ll ./src/Text/Pandoc/Writers/RTF.ll ./src/Text/Pandoc/Writers/AsciiDoc.ll ./src/Text/Pandoc/Writers/LaTeX.l
@CoolOppo
CoolOppo / Paste in Console.md
Last active August 29, 2015 14:00
Game pause script

Want to paste it straight into the console?

bind v noclip;sv_allow_wait_command 1;sv_cheats 1;mp_warmuptime 5;mp_warmuptime_all_players_connected 0;mp_warmup_end;mp_afterroundmoney 256000;mp_autokick 0;mp_autoteambalance 0;mp_buy_anywhere 1;mp_buytime 999999;mp_free_armor 1;mp_freezetime 0;mp_friendlyfire 0;mp_limitteams 30;mp_maxmoney 256000;mp_respawn_on_death_ct 1;mp_respawn_on_death_t 1;mp_respawnwavetime_ct 1;mp_respawnwavetime_t 1;mp_roundtime 60;mp_roundtime_defuse 60;mp_roundtime_hostage 60;mp_startmoney 256000;sv_infinite_ammo 1;mp_humanteam CT;bot_join_team T;bot_quota 3;bot_quota_mode normal;bot_stop 1;mp_restartgame 1
@CoolOppo
CoolOppo / WriteToMemory.cpp
Created April 28, 2014 08:41
Writes data to a specified location in memory
void WriteToMemory(int address_writing_to, char* value_to_write, int num_of_bytes)
{
unsigned long old_protection; // Create a place to store our old protection
VirtualProtect((LPVOID)address_writing_to, num_of_bytes, PAGE_EXECUTE_READWRITE, &old_protection); // Give me proper access to the memory (and store the old protection in the variable 'old_protection').
memcpy((LPVOID)address_writing_to, value_to_write, old_protection); // Write our value.
VirtualProtect((LPVOID)address_writing_to, num_of_bytes, old_protection, NULL); // Restore the protection back to that of 'old_protection'.
}
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active October 13, 2025 20:38
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@soheilhy
soheilhy / nginxproxy.md
Last active July 5, 2025 15:29
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@CoolOppo
CoolOppo / Random Image From Direct URL.php
Last active August 29, 2015 14:01
Displays a random GIF image at an unchanging direct URL/URI using PHP
<?php
function random_pic($dir = '/var/www/images') {
$files = glob($dir . '/*.gif');
if (!$files) return false;
$file = array_rand($files);
return $files[$file];
}
function outputImage( $filename ) {
@CoolOppo
CoolOppo / PageSpeed Filters.md
Created June 5, 2014 16:53
List of extra PageSpeed Module filters that are not enabled by the "CoreFilters" directive
  • canonicalize_javascript_libraries
  • collapse_whitespace
  • combine_heads
  • convert_jpeg_to_webp
  • convert_to_webp_lossless
  • dedup_inlined_images
  • elide_attributes
  • extend_cache_pdfs
  • inline_google_font_css
  • inline_preview_images