Skip to content

Instantly share code, notes, and snippets.

@i-sync
i-sync / README.md
Last active August 25, 2023 08:44
nicept

After python-telegram-bot > 20.4 bot.send_message as async method

@i-sync
i-sync / Dockerfile
Last active June 5, 2019 15:25
Costom Ubuntu docker file - sshd python3 nginx etc
FROM ubuntu
RUN apt update \
&& apt install -y wget curl git net-tools python3 python3-distutils nginx vim htop openssh-server \
&& mkdir -p /root/download && cd /root/download \
&& wget https://bootstrap.pypa.io/get-pip.py \
&& python3 get-pip.py \
&& pip install virtualenv \
&& mkdir -p /var/run/sshd \
&& echo 'root:123' |chpasswd \
@i-sync
i-sync / docker mount denied.md
Last active May 28, 2019 08:32
Mount volume doesn't work on Windows 10 using git-bash

Issue Link : docker-archive/toolbox#673 (comment)
I use the workaround described by dsebastien in the issue linked in my previous reply with a small modification to avoid changing the calling shell environment. This is what I use as workaround now, in my ~/.bash_profile on Windows 10, Git Bash:

# Workaround for Docker for Windows in Git Bash.
docker()
{
        (export MSYS_NO_PATHCONV=1; "docker.exe" "$@")
}
#!/bin/bash
# Database credentials
user="xxx"
password="xxx"
host="xxx"
db_name="xxxx"
# Other options
backup_path="/data/backup/mysql"
#!/bin/bash
ADBShell () { adb ${2+-s }$2 shell "$1" | tr -d '\r'
}
GetAndroidVersion () {
local ALL_TAGS=$(wget -qO - "$GOOGLE_SOURCE/$REPO/+refs/tags/?format=text" | \
tr -d '^{}' | cut -d/ -f3 | sort -u | grep -vE -- '-(cts|sdk)-' | grep -v "_r0")
TAG=${1:-$(ADBShell 'getprop ro.build.version.release')}
echo -e "ANDROID_SERIAL=$ANDROID_SERIAL\nro.build.version.release=$TAG" 1>&2
#!/bin/bash
ADBShell () { adb ${2+-s} $2 shell "$1" | tr -d '\r'
}
GetAndroidVersion () {
GOOGLE_SOURCE="https://android.googlesource.com"
REPO="platform/frameworks/base"
ALL_TAGS=$(wget -qO - "$GOOGLE_SOURCE/$REPO/+refs/tags/?format=text" | \
tr -d '^{}' | cut -d/ -f3 | sort -u | grep -vE -- '-(cts|sdk)-' | grep -v "_r0")
@i-sync
i-sync / hostloc.py
Last active January 14, 2022 09:16
Hostloc Auto Sign Script
import requests
import random
import time
def post_loc(users):
def get_loc(datas):
session = requests.session()
session.post("https://www.hostloc.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1",data=datas)
for x in range(0,10):
session.get(f'https://www.hostloc.com/space-uid-{random.randint(20000,30000)}.html')
time.sleep(random.randint(2,5))
@i-sync
i-sync / svg field render.cs
Created January 29, 2018 02:04
Sitecore Svg Render
public static string SvgImage(Item item, string fieldName, string parameters = "")
{
if (item == null || string.IsNullOrEmpty(fieldName))
return string.Empty;
ImageField field = item.Fields[fieldName];
if (field?.MediaItem == null)
return $"<!--This field name :{fieldName} is not image field.-->";
var mediaItem = new MediaItem(field.MediaItem);
if (mediaItem.MimeType != "image/svg+xml" || Sitecore.Context.PageMode.IsExperienceEditor)
return Sitecore.Web.UI.WebControls.FieldRenderer.Render(item, fieldName, parameters);
@i-sync
i-sync / services-start
Created December 29, 2017 04:04
merlin route add crontab task script
#!/bin/sh
#file path
#/jffs/scripts/services-start
cru a frpc "10 * * * * /bin/sh /jffs/frp/auto.sh"
@i-sync
i-sync / google.voice.sh
Created November 15, 2017 13:14
google voice script
contains() {
string="$1"
substring="$2"
if test "${string#*$substring}" != "$string"
then
echo "# $substring is in $string"
return 0 # $substring is in $string
else
echo "# $substring is not in $string"
return 1 # $substring is not in $string