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/.*\://'`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
class Aria2c: | |
''' | |
Example : | |
client = Aria2c('localhost', '6800') | |
# print server version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--------------------------------------------------------------------- | |
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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): |