Tech C**P
Photo
The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands. Many other Docker applications use the underlying API and CLI.
#docker #docker_cli #docker_rest #architecture
#docker #docker_cli #docker_rest #architecture
To change a password on behalf of a user in
It will prompt for the password and then prompt to retype the password. The password will be change as soon as you enter
#linux #passwd #change_password
Linux
, first sign on or "su" to the "root" account. Then type:passwd user
It will prompt for the password and then prompt to retype the password. The password will be change as soon as you enter
retype password
.#linux #passwd #change_password
Forwarded from جادی، کیبورد آزاد - Jadi
ویندوز بالاخره صاحب ssh میشه
https://jadi.net/2017/12/windows-ssh/
یکی از چیزهای بسیار عجیب ویندوز، نداشتن ابزارهای گنو است. این ابزارها که احتمالا روی هم ۱۰۰ مگ هم نیستن بخش بزرگی از قدرت کامند لاین لینوکس رو میسازن. یکی از مهمترین این ابزارها ssh برای وصل شدن به سرورهای راه دور بود که نبودنش توی لینوکس و اجبار به استفاده از کلاینت های دهه ۹۰ی مثل پاتی (مشهور به پوتی) یکی از شکنجه هایی است که می شه به هر مدیر سیستم لینوکسی داد.
حالا خوشبختانه ویندوز داره قدم به قدم خودش رو اصلاح می کنه و ظاهرا در ویندوز ۱۰ قراره نه فقط کلاینت که سرور اس اس اچ رو هم داشته باشیم. دقیقا بودن این ابزارها در مک یکی از دلایلی است که مدیر سیستم ها حتی اگر دوست نداشته باشن می تونن با مک کار کنن ولی با ویندوز نه.
اگر این گزینه بتا روی سیستم شما فعال شده، می تونین به Manage Optional Features برین و با زدن Add a feature فهرست رو ببینین و اوپن اس اس اچ کلاینت و سرور و فعال کنین. البته ایده اجرا کردن یک سرویس شبکه ای بتا روی ویندوز شاید خیلی عالی نباشه اما به هرحال شروع خوبیه.
کانال @jadinet
https://jadi.net/2017/12/windows-ssh/
یکی از چیزهای بسیار عجیب ویندوز، نداشتن ابزارهای گنو است. این ابزارها که احتمالا روی هم ۱۰۰ مگ هم نیستن بخش بزرگی از قدرت کامند لاین لینوکس رو میسازن. یکی از مهمترین این ابزارها ssh برای وصل شدن به سرورهای راه دور بود که نبودنش توی لینوکس و اجبار به استفاده از کلاینت های دهه ۹۰ی مثل پاتی (مشهور به پوتی) یکی از شکنجه هایی است که می شه به هر مدیر سیستم لینوکسی داد.
حالا خوشبختانه ویندوز داره قدم به قدم خودش رو اصلاح می کنه و ظاهرا در ویندوز ۱۰ قراره نه فقط کلاینت که سرور اس اس اچ رو هم داشته باشیم. دقیقا بودن این ابزارها در مک یکی از دلایلی است که مدیر سیستم ها حتی اگر دوست نداشته باشن می تونن با مک کار کنن ولی با ویندوز نه.
اگر این گزینه بتا روی سیستم شما فعال شده، می تونین به Manage Optional Features برین و با زدن Add a feature فهرست رو ببینین و اوپن اس اس اچ کلاینت و سرور و فعال کنین. البته ایده اجرا کردن یک سرویس شبکه ای بتا روی ویندوز شاید خیلی عالی نباشه اما به هرحال شروع خوبیه.
کانال @jadinet
جادی دات نت | کیبرد آزاد
ویندوز بالاخره صاحب ssh میشه
یکی از چیزهای بسیار عجیب ویندوز، نداشتن ابزارهای گنو است. این ابزارها که احتمالا روی هم ۱۰۰ مگ هم نیستن بخش بزرگی از قدرت کامند لاین لینوکس رو میسازن. یکی از مهمترین این ابزارها ssh برای وصل شدن به سرورهای راه دور بود که نبودنش توی لینوکس و اجبار به استفاده…
Publish
& Subscribe
for dummies:Open 2 different windows (pane) in terminal and go to redis console:
redis-cli
Now to subscribe into a specific channel:
127.0.0.1:6379> SUBSCRIBE first second
Reading messages... (press Ctrl-C to quit)
1) "subscribe"
2) "first"
3) (integer) 1
1) "subscribe"
2) "second"
3) (integer) 2
As you can see we have subscribed to 2 channels called
first
and second
. In another window open redis console again by redis-cli
command and try to publish to those channels:PUBLISH second Hello
Now you should see the output below in the first window where you have subscribed to channels:
1) "message"
2) "second"
3) "Hello"
If you want to know more about
pub-sub
scenario:https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern
#redis #pub_sub #publish #subscribe #redis_cli
Wikipedia
Publish–subscribe pattern
messaging pattern in software design where publishers send messages in categories that subscribers listen to
Send free fax via faxplus chrome addon:
https://chrome.google.com/webstore/detail/faxplus-receive-send-fax/dhbnflghagkonoikejjbjinpbdcjjlbo
#fax #faxplus #chrome #addon
https://chrome.google.com/webstore/detail/faxplus-receive-send-fax/dhbnflghagkonoikejjbjinpbdcjjlbo
#fax #faxplus #chrome #addon
Google
FAX.PLUS - Receive & Send Fax (Free Trial)
FAX.PLUS is a secure HIPAA compliant fax solution, recognized as the best online fax service for its reliability and ease of use.
Hanlde basic authentication (username, password in header) via
As you can see above you just need to provide
#python #requests #authentication #basic #basic_authentication
requests
in python:>>> from requests.auth import HTTPBasicAuth
>>> requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass'))
<Response [200]>
As you can see above you just need to provide
username
& password
in auth
parameter in order to have basic authentication.#python #requests #authentication #basic #basic_authentication
What is
Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.
It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the head of the list, from the leftmost element to the rightmost element. So for instance the command LPUSH mylist a b c will result into a list containing c as first element, b as second element and a as third element.
Integer reply: the length of the list after the push operations.
For instance:
#redis #list #lpush #push
LPUSH
in REDIS
:Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.
It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the head of the list, from the leftmost element to the rightmost element. So for instance the command LPUSH mylist a b c will result into a list containing c as first element, b as second element and a as third element.
Return value:
Integer reply: the length of the list after the push operations.
For instance:
redis> LPUSH mylist "world"
(integer) 1
redis> LPUSH mylist "hello"
(integer) 2
redis> LRANGE mylist 0 -1
1) "hello"
2) "world"
NOTE1:
time complexity of LPUSH
command is O(1)
. So it is the best from performance point of view.NOTE2: `LRANGE
is used to get list members, if you use 0
to -1
it will return all list elements.#redis #list #lpush #push
Tech C**P
What is LPUSH in REDIS: Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.…
O(1) or O(n) access time?
O(1) means that it takes a constant time, like 14 nanoseconds, or three minutes no matter the amount of data in the set.
O(n) means it takes an amount of time linear with the size of the set, so a set twice the size will take twice the time. You probably don't want to put a million objects into one of these.
#time #complexity #time_complexity
Tech C**P
The simplest way to generate hour, minute, seconds from seconds in python is divmod: m, s = divmod(seconds, 60) h, m = divmod(m, 60) print "{}:{}:{}".format(h, m, s) #python #divmod #format
Another way:
The output is:
#python #timedelta #datetime
import datetime
"{:0>8}".format(datetime.timedelta(seconds=66))
The output is:
00:01:06
#python #timedelta #datetime
Removing docker network in swarm mode gives error below:
In order to remove the network you need to remove dangling containers that are bound to the network, to see those containers:
In
#docker #network #disconnect #swarm
Error response from daemon: network demo_net has active endpoints
In order to remove the network you need to remove dangling containers that are bound to the network, to see those containers:
docker network inspect demo_net
In
Containers
section you would see name of those containers. Grab the name of the container and use disconnect
as below to remove it from the network:docker network disconnect -f demo_net NAME_OF_YOUR_CONTAINER
#docker #network #disconnect #swarm
An in depth overview of flask framework. In this tutorial you would be able to create a fully functional website using
https://medium.freecodecamp.org/how-to-use-python-and-flask-to-build-a-web-app-an-in-depth-tutorial-437dbfe9f1c6
#python #flask #fullstacka #tutorial
flask
. This tutorial aims on creating a club application that users can login, create questions, club, etc:https://medium.freecodecamp.org/how-to-use-python-and-flask-to-build-a-web-app-an-in-depth-tutorial-437dbfe9f1c6
#python #flask #fullstacka #tutorial
freeCodeCamp.org
How to use Python and Flask to build a web app — an in-depth tutorial
By Abhinav Suri Python is an incredibly versatile language. It’s considered to be a staple of modern development. It’s used for the simplest of scripts to complex machine learning and neural network training algorithms. But perhaps the less-known usa...
flask
base project that contains registration
, login
, email
, redis
for email queue management, etc:https://github.com/hack4impact/flask-base
#python #flask #flask_base #github
GitHub
GitHub - hack4impact/flask-base: A simple Flask boilerplate app with SQLAlchemy, Redis, User Authentication, and more.
A simple Flask boilerplate app with SQLAlchemy, Redis, User Authentication, and more. - hack4impact/flask-base
How to replace multiple characters in a string using python?
As you may already know there is a method for string called
But what if you want to replace both
Here output would be
#python #string #replace #multiple_replacement
As you may already know there is a method for string called
replace
that replaces 1 character with a new given character:'+98 21 445 54 12'.replace('+', '')
# output is 98 21 445 54 12
But what if you want to replace both
+
and [SPACE]
inside of the string? The answer is simple just chain the methods:'+98 21 445 54 12'.replace('+', '').replace(' ', '')
Here output would be
98214455412
.#python #string #replace #multiple_replacement
Tech C**P
How to replace multiple characters in a string using python? As you may already know there is a method for string called replace that replaces 1 character with a new given character: '+98 21 445 54 12'.replace('+', '') # output is 98 21 445 54 12 But…
Fraud Detection
on credit card using Apache Kafka KSQL
:CREATE TABLE possible_fraud AS
SELECT card_number, count(*)
FROM authorization_attempts
WINDOW TUMBLING (SIZE 5 SECONDS)
GROUP BY card_number
HAVING count(*) > 3;
The above query creates a moving window in 5 seconds timeframe and check whether there are more than 3 authorization attempt on a
specific credit card, real time!
KSQL is a good fit for identifying patterns or anomalies on real-time data. By processing the stream as data arrives you can identify and properly surface out of the ordinary events with millisecond latency.
#apache #kafka #ksql #fraud_detection