Skip to content

Instantly share code, notes, and snippets.

@janzell
janzell / facebook-webhook.php
Created March 2, 2020 09:11
Facebook Webhook - Verification
<?php
class Hooks {
/**
* Facebook App Secret Key
*/
protected $secretKey;
/**
* Webhook token which needed for Verification
@martynchamberlin
martynchamberlin / scrollbars.md
Last active March 28, 2024 09:40
On the Width of Scroll Bars on Mac and Windows

How It Works on Mac

By default, scroll bars do not appear on Mac except when the user is scrolling and when there is hidden content. You can double check this by going to System Preferences -> General -> Show scroll bars: Automatically based on mouse or trackpad.

When you do scroll, the width of viewport and the available width of the inner content does not change from what it was. If the width was 300 pixels, it still is 300 pixels.

If you change the "Show scroll bars" setting to "Always" then the scrollbar takes up a decided amount of width - 16 pixels to be precise.[^1] Let's say your browser height is 300 pixels and your broswer width is also 300 pixels. With this setting, if you toggle the height of the body from 300 to 600, causing scrollableness, then a scrollbar will appear only have you have done the toggle. The width of your body will have gone from 300 to 284 pixels, because the scrollbar takes up space in a way that it did not in the other setting. Interestingly, if you're talking about

@azlux
azlux / Warning_IPTABLES.md
Last active March 7, 2022 11:08
Sécurité avec iptables et l'option RELATED

Problème d'ouvertue de port non désirée sur une configuration IPTABLES

Un problème de contournement des règles iptables fixées par utilisateur peut survenir avec l’utilisation de règles iptables RELATED,ESTABLISH trop générique et le chargement de helper de service non présent ou non utilisé sur la machine (exemple FTP actif, SIP, IRC …).

True fact: Mon server MariaDB s'est fait attaqué comme ça alors que le port dans l'iptable n'était pas ouvert.


Menu

  1. Rappel
@alexeygrigorev
alexeygrigorev / vimeo-download.py
Created September 17, 2016 09:09
Downloading segmented video from vimeo
import requests
import base64
from tqdm import tqdm
master_json_url = 'https://178skyfiregce-a.akamaihd.net/exp=1474107106~acl=%2F142089577%2F%2A~hmac=0d9becc441fc5385462d53bf59cf019c0184690862f49b414e9a2f1c5bafbe0d/142089577/video/426274424,426274425,426274423,426274422/master.json?base64_init=1'
base_url = master_json_url[:master_json_url.rfind('/', 0, -26) + 1]
resp = requests.get(master_json_url)
content = resp.json()
@petitchevalroux
petitchevalroux / bash.sh
Last active August 17, 2016 15:13
List all open TCP connections by a process
lsof -i TCP -a -p <PID>
@preshing
preshing / build_cross_gcc
Last active April 11, 2024 02:14
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
@flusher
flusher / ab_gzip.sh
Created May 2, 2014 16:15
Apache Benchmark test load with gzip compression
ab -c 10 -n 1000 -H "Accept-Encoding: gzip,deflate" http://www.example.com/
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream