Skip to content

Instantly share code, notes, and snippets.

View fffaraz's full-sized avatar
🚀
Focusing

Faraz Fallahi fffaraz

🚀
Focusing
View GitHub Profile
@glacjay
glacjay / gist:856270
Created March 5, 2011 09:59
A simple tool to find out a particular machine's IP address within a LAN.
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
#include <unistd.h>
#include <arpa/inet.h>
@ziadoz
ziadoz / .htaccess
Created September 5, 2013 17:50
Apache rewrite non-www to www and vice versa.
RewriteEngine On
RewriteBase /
# Rewrite: non-www to www
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}$1 [R=301,L]
# Rewrite: www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}$1 [R=301,L]
@tonygambone
tonygambone / https_forward_proxy.js
Created April 19, 2012 17:02
HTTP/HTTPS forward proxy in node.js
// HTTP forward proxy server that can also proxy HTTPS requests
// using the CONNECT method
// requires https://github.com/nodejitsu/node-http-proxy
var httpProxy = require('http-proxy'),
url = require('url'),
net = require('net'),
http = require('http');
@juliangruber
juliangruber / README.md
Last active March 24, 2021 02:00
lightweight node-websocketd

node-websocketd

A lightweight node port of websocketd, originally written in go.

Usage

node-websocketd --port=8080 ./count.sh
@moaminsharifi
moaminsharifi / spotify_ad_blocker.md
Created October 16, 2020 05:38
#spotify ad blocker /etc/hosts

#spotify ad blocker

edit /etc/hosts on linux

c:\windows\system32\drivers\etc\hosts

127.0.0.1 media-match.com
127.0.0.1 adclick.g.doublecklick.net
127.0.0.1 www.googleadservices.com
127.0.0.1 open.spotify.com
127.0.0.1 pagead2.googlesyndication.com
@dominicsayers
dominicsayers / virtualbox.md
Last active October 10, 2022 19:18
Installing Virtualbox 4.3 on Ubuntu Server 13.10 64-bit

First install Virtualbox

  1. sudo pico /etc/apt/sources.list.d/virtualbox.list
  2. Add deb http://download.virtualbox.org/virtualbox/debian saucy contrib non-free
  3. wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
  4. sudo apt-get update
  5. sudo apt-get install dkms unzip
  6. sudo apt-get install virtualbox-4.3 --no-install-recommends
  7. wget http://download.virtualbox.org/virtualbox/4.3.6/Oracle_VM_VirtualBox_Extension_Pack-4.3.6.vbox-extpack
  8. sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.6.vbox-extpack
@justecorruptio
justecorruptio / 2048.c
Created April 4, 2014 03:49
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
lst = [
{"current_time":1618861512,"success":True,"data":[{"id":590,"company":{"name":"افسران جنگ نرم","name_en":"Afsaran","company_slug":"afsaran","logo":"/company/afsaran/9f7d4c70-403a-11e9-ae0e-273fe94d6d59.png"},"job":{"job_slug":"full-stack","name":"Full Stack"},"title":"شرکت افسران جنگ نرم درخواست رسمی خود را مبنی بر عدم به اشتراک گذاری این اطلاعات بر روی پلتفرم جابگای ابلاغ کرده و به این منظور جابگای مجبور به حذف این اطلاعات میباشد.","description":"شرکت افسران جنگ نرم درخواست رسمی خود را مبنی بر عدم به اشتراک گذاری این اطلاعات بر روی پلتفرم جابگای ابلاغ کرده و به این منظور جابگای مجبور به حذف این اطلاعات میباشد.","vote_count":0,"down_vote_count":2,"vote_state":"NONE","view_count":61,"over_all_rate":0,"created":"2020-06-10 18:37","my_review":False,"state":"FULL","approved":True,"has_legal_issue":True}],"message":None,"total":1,"show_type":"TOAST","index":0},
{"current_time":1618861554,"success":True,"data":[{"id":60,"company":{"name":"آپاسای داده سیستم","name_en":"Apasai Dade System","company_sl
@dsanders11
dsanders11 / StringConstant.h
Last active February 15, 2023 21:53
An implementation of compile time string constants in C++14. The StringConstant class provides an intuitive interface for concatenating and comparing equality of the string constants. Heavily commented since example template code never seems to be.
#ifndef STRING_CONSTANT_H
#define STRING_CONSTANT_H
#include <cstddef>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>