Skip to content

Instantly share code, notes, and snippets.

View alibo's full-sized avatar
💭
🤦‍♂️

Ali Borhani alibo

💭
🤦‍♂️
View GitHub Profile
@alibo
alibo / main.go
Last active May 27, 2020 04:15 — forked from walm/main.go
Simple Golang DNS Server (simplified version)
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@alibo
alibo / apple-ocsp-hosts
Created May 21, 2020 15:51
If you're trying to open an app in OSX, but it takes so long! (and apparently you also live in Iran!)
# Add this record to your `/etc/hosts` file; You can run one of these commands to do so:
#
# $ sudo bash -c 'echo "0.0.0.0 ocsp.apple.com" >> /etc/hosts'
#
# or
#
# $ sudo nano /etc/hosts
#
# More info: https://support.apple.com/en-us/HT210060
@alibo
alibo / main.go
Created May 13, 2020 10:37
Simple http echo headers
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
@alibo
alibo / ilo3_g7.py
Created November 10, 2018 14:28
Getting Health information from FUCKING old ilo3 on g7
# issue: https://github.com/seveas/python-hpilo/issues/189
# thanks to @Shados: https://github.com/seveas/python-hpilo/issues/189#issuecomment-430893230
import re
import ssl
import json
import hpilo
ilo3_context = ssl.create_default_context()
@alibo
alibo / sites.conf
Last active November 5, 2018 08:07
How to send traffic of some endpoints to a different app in Nginx (php + golang)
upstream @api_golang {
server 127.0.0.1:8080; # same node
server 111.222.111.222:8080;
}
upstream @api_php {
server 127.0.0.1:80; # nginx/apache/... - another node
server 111.222.111.222:80; # nginx/apache/... - another node
}
@alibo
alibo / cross-compile_filebeat_arm.sh
Created January 13, 2018 09:25 — forked from anis-campos/cross-compile_filebeat_arm.sh
Cross-compile Elastic Filebeat for ARM with docker. Works Raspberry Pi 2
#----- Create a Docker for cross-compilation -----#
mkdir build && cd $_
docker run -it --rm -v `pwd`:/build golang:1.8.3 /bin/bash
#----- Inside docker -----#
go get github.com/elastic/beats
cd /go/src/github.com/elastic/beats/filebeat/
git checkout v5.6.3
GOARCH=arm go build
cp filebeat /build
exit
@alibo
alibo / s3-slack-notifier-lambda.js
Created February 20, 2017 20:52
Send S3 events to s slack channel via Lambda and Node.js
'use strict';
/*
Thanks to https://gist.github.com/vgeshel/1dba698aed9e8b39a464
*/
console.log('Loading function');
const aws = require('aws-sdk');
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
@alibo
alibo / keybase.md
Created December 1, 2016 17:09
keybase.md

Keybase proof

I hereby claim:

  • I am alibo on github.
  • I am alibo (https://keybase.io/alibo) on keybase.
  • I have a public key whose fingerprint is DFF3 2B75 6222 ACE7 5367 3220 7191 34AD 0F9D 1808

To claim this, I am signing this object:

@alibo
alibo / AppServiceProvider.php
Created November 23, 2016 17:58
Using Redis Cluster with Normal Redis instances in Laravel
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Redis\Database;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
@alibo
alibo / gist:9b50eca2a2609ee461ecc6c6725527f6
Created October 31, 2016 09:46 — forked from alexsegura/gist:9650651
Prestashop 1.6 folder permissions
chmod a+w -R config/
chmod a+w -R cache/
chmod a+w -R log/
chmod a+w -R img/
chmod a+w -R mails/
chmod a+w -R modules/
chmod a+w -R themes/default-bootstrap/lang/
chmod a+w -R themes/default-bootstrap/pdf/lang/
chmod a+w -R themes/default-bootstrap/cache/
chmod a+w -R translations/