Skip to content

Instantly share code, notes, and snippets.

View milosb793's full-sized avatar

milosb793

  • At the Cloud
View GitHub Profile
@jaywilliams
jaywilliams / dumprequest.php
Last active November 8, 2023 12:28 — forked from magnetikonline/dumprequest.php
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/jaywilliams/bee2512f0f12d6791315d6939119e135
// Forked: https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
// Usage: php -S localhost:8080 dumprequest.php
// Path to store all incoming requests
define('LOG_OUTPUT', __DIR__ . '/requests.log');
$data = sprintf(
"[%s]\n%s %s %s\n\nHTTP HEADERS:\n",
@shahnhogan
shahnhogan / download-redisinsight-mac.sh
Last active November 14, 2023 10:39
Download latest RedisInsight for macOS
curl -O https://download.redisinsight.redis.com/latest/RedisInsight-v2-mac-x64.dmg
@gullyn
gullyn / flappy.html
Last active May 4, 2024 15:35
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@garethrees
garethrees / format.sh
Created April 28, 2020 15:32
Format USB drive from the command line macOS
diskutil list
diskutil unmountDisk /dev/disk2
diskutil eraseDisk FAT32 SANDISK /dev/disk2
@huynhsamha
huynhsamha / typescript-recursive-sort.ts
Created March 18, 2020 14:52
Recursive sort in typescript
// Playground: https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=39&pc=1#code/MYGwhgzhAEB2D2ATAptA3gWAFDV9C8ATgC4DyhKhAXHAK4C2ARsoQNzZ7QDCAFgJYhEhZLBoIUAbQC67LBzzB4sCMUK1gxIgAoCJcpTENmhAJTp5nXMX4QAdLrIUW0ALz4ijyrMt5rfO7wCQiKu0NIW0AC+2NFyWIrKxNCK9AAOYIRgmoShWmBiSMgANNCMBShmLgB85jh4fABm0Hm2gYLCsNAAZF3QYK387SK2ICIA5tbQNQCMZph1Pv1twbD2Hlop6ZnZJhGxnI3NjANBHd29x8sdI+OTM3MRnJeDK2skG-BpGVlEuwtREWExFohE6-Qc+mcAFpSm9PCxZLFsNgEipki8IOVkNJQtJZA0iM1Rkk+KEAKysaCkmoABkpfChUIe-2AGNsqVoEB4WlgyAA7nBClo+CYTIjkfElGjxMhMYLJFJcTJsASclpiVTQtM6ZrafTGczOKikp03LyBTLhWKIodhdAAKTQABMrjcNMNPjgJyGpvRQQg3jw+zwMrsHK5POtWCRWFDcI+X22vwlqPgoxG8DGPMKED+QA
class node {
sortOrder: number;
Children: node[];
constructor(sortOrder: number) {
this.sortOrder = sortOrder;
this.Children = []
}
@tangjeff0
tangjeff0 / random_notion.py
Last active June 4, 2024 19:02
get random notion notes to resurface your old ideas!
'''
author:
@tangjeff0
https://www.notion.so/tangjeff0/Public-Home-0e2636bd409b454ea64079ad8213491f
inspired by: https://praxis.fortelabs.co/p-a-r-a-iii-building-an-idea-generator-400347ef3bb6/
with help from: https://medium.com/@jamiealexandre/introducing-notion-py-an-unofficial-python-api-wrapper-for-notion-so-603700f92369
credits:
@jamiealexandre
function work() {
console.log('Working');
setTimeout(work, 0);
}
work();
// This won't halt the MAIN JS THREAD!
// Because we keep adding to the JOB queue
@lon-io
lon-io / db_backup.sh
Created July 15, 2019 07:41 — forked from NARKOZ/db_backup.sh
MySQL backup shell script
#!/bin/bash
# Shell script to backup MySQL database
# Set these variables
MyUSER="" # DB_USERNAME
MyPASS="" # DB_PASSWORD
MyHOST="" # DB_HOSTNAME
# Backup Dest directory
DEST="" # /home/username/backups/DB

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@rolandstarke
rolandstarke / laravel setup.sh
Last active July 8, 2024 07:49
Server setup bash script for Laravel
# Ubuntu 20 LTS Server Setup for Laravel
# Login as root user
sudo su -
# Update list of available packages
apt update