Skip to content

Instantly share code, notes, and snippets.

@slok
slok / pprof.md
Last active May 17, 2024 16:52
Go pprof cheat sheet

Enable profiling

Default http server

import (
    _ "net/http/pprof"
    "net/http"
)
#!/bin/bash
# Update and upgrade Homebrew
echo "Updating Homebrew..."
brew update
brew upgrade
# Install nvm (Node Version Manager)
echo "Installing nvm..."
@jiafulow
jiafulow / unix.md
Created June 18, 2019 16:05
Basics of the Unix Philosophy from 'The Art of Unix Programming" by Eric Steven Raymond

Basics of the Unix Philosophy

source: https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch01s06.html

  1. Rule of Modularity: Write simple parts connected by clean interfaces.
  2. Rule of Clarity: Clarity is better than cleverness.
  3. Rule of Composition: Design programs to be connected to other programs.
  4. Rule of Separation: Separate policy from mechanism; separate interfaces from engines.
  5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
  6. Rule of Parsimony: Write a big program only when it is clear by demonstration that nothing else will do.
@itsjulieann
itsjulieann / 241857100
Last active May 17, 2024 16:48
241857100
export default function Component() {
return (
<main className="flex h-screen w-full items-center justify-center">
<h1 className="text-4xl font-bold">Hello, World! - 241857100</h1>
</main>
)
}
@adog1314
adog1314 / PortForwardOverWireGuard.md
Last active May 17, 2024 16:48
Port forward over wireguard to VPS with static IP

Port forward over wireguard to VPS with static IP

This is write up is on how to port forward over wireguard. I am going to be port forwarding a mail server running MailCow on my local server, but really any service can be port forwared with some modifications to the IPTables commands in the wireguard file.

I am using a cheap Vultr VPS as my proxy server, if your intrested heres a referral link https://www.vultr.com/?ref=9019507 where I get $10 or if you plan to spend more then $35 on your account you will get $100 and I will get $35 https://www.vultr.com/?ref=9019508-8H

My Setup

  • Debain 10 Buster
  • Tunnel subnet: 10.1.1.0
  • Proxy-VPS Tunnel IP: 10.1.1.1
<?php
// A blogroll for WordPress
// To be used with the link manager plugin https://wordpress.org/plugins/link-manager/
namespace Blogroll;
function custom_rewrite_rule() {
add_rewrite_rule('^.well-known/recommendations.opml/?$', 'index.php?well_known_recommendations=1', 'top');
}
@allenk
allenk / deepclean.cmd
Last active May 17, 2024 16:46
ASUS Software Clean Up Tool
@echo off
:: ------------------------------------------------------------------------------------------------------------
:: Clean Up ASUS All
:: ------------------------------------------------------------------------------------------------------------
:: The tool helps to clean up all ASUS software from system
:: ------------------------------------------------------------------------------------------------------------
:: Before running the tools,
:: 1. Complete backup your system.
:: 2. Disable ASUS Apps from BIOS (MyASUS and Armoury)
:: 3. Run ASUS remove tools (Armoury Crate Uninstall Tool.exe, or geek_uninstall.exe).
@Aiyualive
Aiyualive / game-7-window5-scores.txt
Created May 17, 2024 16:28
Scoring for Game 7 Window 5. 17/05 Fri 16:00 UTC - 16:10 UTC
Official Window 5
17/05 Fri 16:00 UTC - 16:10 UTC
Start Time: 16:00:04 UTC
Start Tx: 632L1xg86kdsZXfB6e42bLmudDFMZErh31ML3EwCruu6GDUcESA6EB53d5CHmLbFx7KEQVs2ZGYgJKdLdF1U2aA1
End time: 16:06:32 UTC
End Tx: 2qHd9nqgTsbyh4MSFwgZaffxFAGL2rr4pTA3jgTMNmhkc5yM5gXzJ1gjQAnj4w8DNZd8jmANvf2mFCMgsUBHVU4u
BAO scorings:
@mehmetalikaya-hub
mehmetalikaya-hub / rank.sql
Created June 22, 2021 09:25
RANK() functions in SQL
SELECT CustomerID,ShipVia,ShipAddress, ShippedDate,
RANK() OVER(ORDER BY ShippedDate DESC) AS SIRA
FROM Orders
@simonw
simonw / recover_source_code.md
Last active May 17, 2024 16:45
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb