Skip to content

Instantly share code, notes, and snippets.

View haseeb2k9's full-sized avatar
🎯
Focusing

Haseeb Ashfaq haseeb2k9

🎯
Focusing
View GitHub Profile
# create a new user (john for this example)
# just enter a password when asked, confirm it, and the other steps are optionals
sudo adduser john
# give root user the ownership of john's home directory
sudo chown root:root /home/john
# edit the ssh configuration file
sudo vim /etc/ssh/sshd_config
@kaugesaar
kaugesaar / GeoSearch.js
Last active October 17, 2021 12:37
Fake your Google searches location with uule parameter.
var GeoSearch = function() {
this.baseUrl = 'https://www.google.se/search?';
this.pws = true;
this.lang = 'sv';
var key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
var makeHash = function(loc) {
loc = loc.toLowerCase().replace(/[åä]/g,'a').replace(/[ö]/g,'o');
return 'w+CAIQICI' + key[loc.length%key.length] + btoa(loc).replace(/\=/g,'').trim();
@shapeshed
shapeshed / aws-cf-logs
Last active September 12, 2022 09:10
Fetch AWS Cloudfront Logs, decompress, combine into a single file and remove comments
#!/usr/bin/env bash
BUCKET=$1
CWD=$(pwd)
if [[ -n $1 ]]; then
aws s3 sync s3://$BUCKET/cf-logs .
cat *.gz > combined.log.gz
find $CWD ! -name 'combined.log.gz' -name '*.gz' -type f -exec rm -f {} +
gzip -d combined.log.gz
@rose-m
rose-m / video2gif.sh
Created August 24, 2017 17:46
Convert Video files to GIFs using FFMPEG
#!/bin/bash
# Script to convert video files to GIFs using ffmpeg
FFMPEG_PATH=$(which ffmpeg)
if [[ -z FFMPEG_PATH ]]; then
echo "FATAL: ffmpeg was not found in your path - please install beforehand"
exit 1
fi
FPS=10
.clear{
clear:both;
display:block;
height:0;
width:auto;
}
.faq-row-container{
font-family:Arial, Helvetica, sans-serif;
}
@nickrouty
nickrouty / rd-class-text-extraction.php
Created May 9, 2018 04:14
Class for extraction the text from doc, docx, xlsx, pptx and wrapper for 3rd party pdf to text library.
<?php
/**
* Class RD_Text_Extraction
*
* Example usage:
*
* $response = RD_Text_Extraction::convert_to_text($path_to_valid_file);
*
* For PDF text extraction, this class requires the Smalot\PdfParser\Parser class.
@stephenmathieson
stephenmathieson / axe-puppeteer-up-lambda.js
Created July 17, 2018 20:32
An up-powered lambda fn for running axe-core
const chromium = require('chrome-aws-lambda');
const puppeteer = require('puppeteer');
const axeCore = require('axe-core');
const { createServer } = require('http');
const { parse: parseURL } = require('url');
const { PORT = 3000 } = process.env;
const analyze = async url => {
let browser;
@lon-io
lon-io / self-signed-ssl-certificate.md
Created August 8, 2018 15:23 — forked from clemlatz/self-signed-ssl-certificate.md
Setup a self-signed SSL certificate with Nginx (server and browser)

1. Configure server: Nginx

Create the certificate:

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

Create a strong Diffie-Hellman group:

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
@ServerlessBot
ServerlessBot / IAMCredentials.json
Last active February 24, 2025 15:51
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@RatserX
RatserX / debian-ubuntu-apache-fastcgi-php.md
Last active November 28, 2024 16:18
Setup Apache, FastCGI and PHP on Debian/Ubuntu for hosting sites on different ports and PHP versions

Setup Apache, FastCGI and PHP on Debian/Ubuntu for hosting sites on different ports and PHP versions

Prerequisites

Update the installed packages.

apt update

Install the Ondřej PHP repository.

apt install software-properties-commonsudo

add-apt-repository ppa:ondrej/php