Skip to content

Instantly share code, notes, and snippets.

@Neocky
Neocky / Linux-colored-shell.md
Last active February 10, 2023 00:04
Linux Colored Shell

Linux Colored Shell

Color scheme based of One Dark Pro

image

How to

  1. Open file: nano ~/.bashrc
  2. Add to end of file:
PS1="\[$(tput bold)\]\[\033[38;5;9m\]\u\[$(tput sgr0)\]\[\033[38;5;7m\]@\[$(tput bold)\]\[\033[38;5;171m\]\H\[$(tput sgr0)\]\[\033[38;5;7m\]:\[$(tput sgr0)\]\[$(tput bold)\]\[\033[38;5;41m\]\w\[$(tput sgr0)\]\\$ \[$(tput sgr0)\]"
@ucjonathan
ucjonathan / xhr-capture.js
Created April 29, 2021 13:01
XHR Logging
(function(options) {
// Init options if not specified
options = options || {
"capturePayload": false
};
// Store a reference to the native method
let oldOpen = XMLHttpRequest.prototype.open;
var xhrlogcounter = 1;
@n-ramdi
n-ramdi / worker.js
Created April 29, 2021 08:27
Cloudflare worker to bypass Instagram new cross-origin policy on images (fixes net :: ERR_BLOCKED_BY_RESPONSE )
// Instagram started setting cross-origin-resource-policy: same-origin when it sees bad referer headers.
// this change leads to ERR_BLOCKED_BY_RESPONSE error and broken images if instagram image is embedded to external website.
// to mitigate this, simple image proxy can be used.
// Steps to install this worker:
// 1. Create CNAME cdn.<yourdomain.com> in your CloudFlare panel
// 2. Create new worker and put the code below into the worker code
// 3. Setup worker route so the worker launches on your cdn. subdomain.
// 4. Modify your image urls from
// https://scontent-arn2-1.cdninstagram.com/v/t51.2885-15/sh0xxx.jpg
// to:
@soygul
soygul / youtube-upload.js
Last active April 14, 2024 19:52
YouTube video uploader using JavaScript and Node.js
// YouTube API video uploader using JavaScript/Node.js
// You can find the full visual guide at: https://www.youtube.com/watch?v=gncPwSEzq1s
// You can find the brief written guide at: https://quanticdev.com/articles/automating-my-youtube-uploads-using-nodejs
//
// Upload code is adapted from: https://developers.google.com/youtube/v3/quickstart/nodejs
const fs = require('fs');
const readline = require('readline');
const assert = require('assert')
const {google} = require('googleapis');
@mdPlusPlus
mdPlusPlus / badblocks.txt
Last active February 22, 2023 21:27
How to check new hard drives with badblocks
badblocks -b 4096 -p 0 -s -t 0 -v -w DEVICE
-b block_size
-p num_passes
-s Show the progress of the scan
-t test_pattern
-v Verbose mode
-w Use write-mode test
@ShannonScott
ShannonScott / Video Screen Capture with GStreamer.md
Created October 30, 2019 16:28
[Video Screen Capture with GStreamer] Capture a Linux desktop window video with gsteramer. #tags: gstreamer, linux, xwindows, video

Capture a video of a given X Window with gstreamer.

X Window ID

Get the target window ID with the following:

xwininfo
@huozhi
huozhi / simulate_mouse_action.js
Created March 31, 2019 14:14
simulate click and hover mouse action on web with js
const mouseEventOf = (eventType) => (element, x, y) => {
const rect = element.getBoundingClientRect()
const event = new MouseEvent(eventType, {
view: window,
bubbles: true,
cancelable: true,
clientX: rect.left + x,
clientY: rect.top + y,
})
@Bartvelp
Bartvelp / stream.php
Created May 10, 2018 17:13
PHP seekable stream external video with url and range header support
<?php
/*
Hi!
So this gist is not a very good implementation, it works great in chrome but the seeking is sort of glitched in firefox.
But it does the job and I hope it can help out!
(Please let me know how to improve this)
*/
ini_set('max_execution_time', 0);
$url = "http://mirrors.standaloneinstaller.com/video-sample/jellyfish-25-mbps-hd-hevc.m4v"; //just some sample url, please dont overload their servers
@kkm
kkm / index.html
Created April 15, 2018 22:14
Chrome MediaRecorder in H264
<!DOCTYPE html>
<head>
<script>
var recordedChunks = [];
var constraints = {
audio: true,
video: true
};
var mediaRecorder = null;
@tegansnyder
tegansnyder / Preventing-Puppeteer-Detection.md
Created February 23, 2018 02:41
Preventing Puppeteer Detection

I’m looking for any tips or tricks for making chrome headless mode less detectable. Here is what I’ve done so far:

Set my args as follows:

const run = (async () => {

    const args = [
        '--no-sandbox',
        '--disable-setuid-sandbox',
        '--disable-infobars',