Skip to content

Instantly share code, notes, and snippets.

View m2sh's full-sized avatar
🤔
hmm!

Mohammad Shahgolzadeh m2sh

🤔
hmm!
View GitHub Profile
@jsphpl
jsphpl / NPerGroup.php
Last active May 26, 2020 06:09 — forked from tureki/BaseModel.php
laravel-pgsql-n-related-models-per-parent-with-scopes
<?php
namespace App\Models\Traits;
use DB;
/**
* This trait is to work around a problem where a limit on an Eloquent
* relation by default applies to all queried models in total.
*
@PieterScheffers
PieterScheffers / docker-raspberry-pi.sh
Created May 30, 2017 12:49
Build ARM docker images for Raspberry Pi with QEMU
# https://blog.hypriot.com/post/setup-simple-ci-pipeline-for-arm-images/
### Choose a base image with QEMU binary
# FROM hypriot/rpi-alpine
# FROM resin/rpi-raspbian
# FROM resin/raspberry-pi-alpine-node:slim
### Register QEMU in the build agent
docker run --rm --privileged multiarch/qemu-user-static:register --reset
@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active August 21, 2024 11:40
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2024 SanderTheDragon <sanderthedragon@zoho.com>
#
# SPDX-License-Identifier: MIT
arch=$(dpkg --print-architecture)
echo "Detected architecture: $arch"
case "$arch" in
@lpimem
lpimem / aria2c.py
Last active December 25, 2023 21:12
Aria2 Python Client
import json
import requests
class Aria2c:
'''
Example :
client = Aria2c('localhost', '6800')
# print server version
@SilverBut
SilverBut / haproxy.cfg
Last active July 7, 2024 19:14
[Haproxy cfg checking Socks5] Haproxy cfg to check the Socks5 connection #tags: GFW, network, haproxy, config
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------
global
log 127.0.0.1 local2
@amgorb
amgorb / redis-client-ouput-buffer-limit
Created February 20, 2017 16:19
redis replication scheduled to be closed ASAP for overcoming of output buffer limits.
If you redis initial replication fails with error like
"5101:M 20 Feb 18:14:29.130 # Client id=4500196 addr=71.459.815.760:43872 fd=533 name= age=127 idle=127 flags=S db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=13997 oll=1227 omem=192281275 events=rw cmd=psync scheduled to be closed ASAP for overcoming of output buffer limits.
means that slave buffer is not enough and you should increase it (at master!) with command like
redis-cli config set client-output-buffer-limit "slave 836870912 836870912 0"
more info: https://redis.io/topics/clients
@aminone
aminone / adbUsefulCommands.sh
Last active September 14, 2024 13:57
A collection of Android Debug Bridge (ADB) commands
# To get file
adb pull <PATH/TO/FILE/ON/DEVICE>
# To push file
adb push <PATH/TO/FILE> <PATH/TO/DESTINATION>
# To get wifi MAC address
adb shell cat /sys/class/net/wlan0/address
# To get IP Address
@icambridge
icambridge / Dockerfile
Created February 4, 2017 12:33
Go dep in docker
FROM golang:1.7
# Set go bin which doesn't appear to be set already.
ENV GOBIN /go/bin
# build directories
RUN mkdir /app
RUN mkdir /go/src/app
ADD . /go/src/app
WORKDIR /go/src/app
@ShalbafZadeh
ShalbafZadeh / oreilly_downloader.py
Created October 10, 2016 16:58
Download Oreilly Free books by url
#license WTFPL
#example of usage : python oreilly_downloader.py < url_list
#url_list should contain list of urls , a url per line
import sys
import urllib2
from urllib2 import URLError
#making url ready fo download
def reformat_url(url):
@zenorocha
zenorocha / etc-hosts-on-win.md
Last active April 11, 2024 23:07
/etc/hosts on Windows

1. Get your IP Address

echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`

2. Modify your hosts file

notepad