Skip to content

Instantly share code, notes, and snippets.

View ixqbar's full-sized avatar
💭
I may be slow to respond.

Well ixqbar

💭
I may be slow to respond.
View GitHub Profile
@ixqbar
ixqbar / AES.c
Last active August 29, 2015 14:24 — forked from bricef/AES.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
local client_ip = ngx.req.get_headers()["X-Forwarded-For"]
client_ip = string.match((client_ip or ngx.var.remote_addr), '[%d%.]+')
local passed = false
for allowed_ip in string.gmatch(ngx.var.allowed_ips, '([%d%.]+)') do
if client_ip == allowed_ip then
passed = true
end
end
@ixqbar
ixqbar / curltest.c
Created May 27, 2016 03:44 — forked from aaronhurt/curltest.c
example code using libcurl and json-c to post and parse a return from http://jsonplaceholder.typicode.com
/**
* example C code using libcurl and json-c
* to post and return a payload using
* http://jsonplaceholder.typicode.com
*
* Requirements:
*
* json-c - https://github.com/json-c/json-c
* libcurl - http://curl.haxx.se/libcurl/c
*
@ixqbar
ixqbar / Makefile
Created December 24, 2016 03:16 — forked from jettero/Makefile
C blowfish demo
SHELL=/bin/bash
key=my key
go: clean
@ make --no-print-directory `git ls-files | sed 's/$$/.ubf/'`
@ for i in *.ubf; do x=`basename $$i .ubf`; ./my_diff.pl $$x $$i; done
words.bf: enc
./enc "$(key)" $(words) $@
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@ixqbar
ixqbar / ip_blacklist.lua
Created May 9, 2017 02:00 — forked from chrisboulton/ip_blacklist.lua
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@ixqbar
ixqbar / backup.go
Created July 11, 2017 10:33 — forked from barthr/backup.go
Backup all your github repositories
package main
import (
"context"
"flag"
"fmt"
"io"
"log"
"net/http"
"os"
@ixqbar
ixqbar / img_resize.js
Created August 18, 2018 09:13 — forked from makevoid/img_resize.js
Resize Images with Canvas on the clientside
var settings = {
max_width: 600,
max_height: 200
}
resize_image = function(img){
var ctx = canvas.getContext("2d")
var canvasCopy = document.createElement("canvas")
var copyContext = canvasCopy.getContext("2d")
@ixqbar
ixqbar / class.blade.php
Created June 12, 2019 08:26 — forked from webarthur/class.blade.php
PHP Blade template engine class
<?php
#namespace Laravel;
# Use: Blade::compile_all( $from_dir, $to_dir );
# visit: http://araujo.cc
# original class from http://cutlasswp.com
class Blade {
@ixqbar
ixqbar / index.html
Created July 3, 2019 10:31 — forked from umidjons/index.html
Upload File using jQuery.ajax() with progress support
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload File using jQuery.ajax() with progress support</title>
</head>
<body>
<input type="file" name="file" id="sel-file"/>