Skip to content

Instantly share code, notes, and snippets.

View boussouira's full-sized avatar

Ahmed boussouira

  • Morocco
View GitHub Profile
@olafurjohannsson
olafurjohannsson / requestmanager.cpp
Last active July 26, 2023 13:43
Asynchronous HTTP network requests in C++ with Qt
#include "requestmanager.h"
///
/// RequestManager constructor
///
/// Description: sets up a network access manager that
/// abstract the HTTP/TCP protocol
RequestManager::RequestManager(QObject *parent) : QObject(parent)
{
@ninadpchaudhari
ninadpchaudhari / 98-mylog
Last active March 28, 2024 19:18 — forked from navhaxs/99-keepwanalive
openwrt wan auto reconnect hotplug script
#!/bin/sh
#File for my debugging purposes
echo $ACTION >> /tmp/mylog
echo $INTERFACE >> /tmp/mylog
echo "" >> /tmp/mylog
@KsaRedFx
KsaRedFx / encoder.sh
Last active August 29, 2015 14:16
Gource video generation scripts
echo "Starting to encoding process"
mkdir --parents "video/mp4"
for video in complete; do
for speed in fast slow medium; do
file="${video}_${speed}"
echo "Encoding ${file}"
@olslash
olslash / console
Created June 16, 2014 21:11
Testing the console's representation of data
var externalObj = {key: 'value'};
var items = {
obj: {
'string prop': 'string val',
5: 10,
nested: [[3, [5, 2]]],
'function': function(){return true;},
reference: externalObj
},
@robert-b-clarke
robert-b-clarke / deploy_to_s3.py
Created January 27, 2014 10:51
A simple python script for copying static web resources to an S3 bucket and advance gzipping JS and CSS. Let me know if it's useful (and not already implemented by something else), I may make it into a proper repo
"""
===========
Description
===========
Simple script to copy and gzip static web files to an AWS S3 bucket. S3 is great for cheap hosting of static web content, but by default it does not gzip CSS and JavaScript, which results in much larger data transfer and longer load times for many applications
When using this script CSS and JavaScript files are gzipped in transition, and appropriate headers set as per the technique described here: http://www.jamiebegin.com/serving-compressed-gzipped-static-files-from-amazon-s3-or-cloudfront/
* Files overwrite old versions
@teffalump
teffalump / README.md
Last active January 4, 2023 21:17
OpenWRT adblock implementation

Others have recently developed packages for this same functionality, and done it better than anything I could do. Use the packages instead of this script:

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

@plentz
plentz / nginx.conf
Last active April 18, 2024 12:42
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@JamesMGreene
JamesMGreene / 0 - README.md
Last active February 20, 2018 18:10
A brief example of the latest idea for communicating with PhantomJS from the client-side.

A brief example of the latest idea for communicating with PhantomJS from the client-side.

This is the next revision of ideas discussed in a previous Gist:
    https://gist.github.com/JamesMGreene/3716654

This example demonstrates shimming in the new communication channels under discussion via existing methods (WebPage#onCallback and window.callPhantom).

The example does, however, take advantage of a yet-to-be-implemented EventEmitter API for core modules in the PhantomJS outer context. This API would add the following methods to core modules as appropriate:

  • on / addEventListener
@JamesMGreene
JamesMGreene / 0 - README.md
Created September 13, 2012 18:48
PhantomJS: Conceptual implementation of a short-term shim to establish the window.postMessage API for IPC

Topic

Providing an inter-process communication (IPC) mechanism such that a WebPage can explicitly signal back to PhantomJS as a push, thus eliminating/minimizing the need for users to setup polling functions, etc.

In PhantomJS 1.6, @detro added a WebPage onCallback handler that could be triggered from a webpage client by invoking the specially attached window.callPhantom function. However, @ariya expressed some discontent with this approach and so the three of us began discussing utilizing an existing API for cross-domain messaging instead: window.postMessage. (See Discussion for more info.)

Problems

PhantomJS currently only allows for a single handler per signal (a separate problem I'm working on over here). As such, automatically attaching internal handler may prevent users from attaching their own handlers for onInitialized (tha

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs