Skip to content

Instantly share code, notes, and snippets.

View clvrobj's full-sized avatar

Chi Zhang clvrobj

  • Singapore, Singapore
View GitHub Profile
@vlad-ds
vlad-ds / deploy_telegram_aws.md
Last active June 1, 2024 09:29
How to deploy a Telegram bot on AWS EC2

Remote setup (AWS EC2)

If you run your Telegram bot locally, it will stop working when you close the terminal. The alternative is to host the bot somewhere.

There are many ways to do this. I chose AWS EC2 as it's a cheap and easy option.

Create an AWS account and start an EC2 instance. Install pip, git and github cli. If you use an Amazon Linux image (which is what the free tier offers) you can run the commands in this gist.

Connect to your GitHub account with gh auth login and clone this repo. Create the .env

import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())
@namuol
namuol / INSTALL.md
Last active July 24, 2023 11:53
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@LK64076007A
LK64076007A / Create image of side by side screeshots.py
Created March 5, 2013 14:46
Create image of side by side screeshots
"""
This code takes two screenshots from the camera roll combines them into one image and saves the new image to the camera roll.
This is adapted from Federico Viticci's blog post at:
http://www.macstories.net/stories/automating-ios-how-pythonista-changed-my-workflow/
It removes the option to change which picture is where, automatically assigning the first one chosen as the leftmost image.
It also removes the necessity to copy the images to the clipboard outside of Pythonista using the new photos library in version 1.3. Finally, it removes the clipboard output.
"""
import photos
@clvrobj
clvrobj / douban.com.js
Created December 15, 2012 13:59
for the coming annoying douban's new nav bar
$('.nav').css({'margin-bottom':'30px'});
$('.nav-primary').css({'padding':0});
$('.nav-logo a').attr('href', 'http://www.douban.com/update/');
$('.nav-logo').css({'height':'52px'});
$('#db-nav-sns .nav-items ul').append('<li><a href="http://www.douban.com/group/">小组</a></li>');
@jjgod
jjgod / my-setup.markdown
Last active May 22, 2024 22:52
My setup
@suzaku
suzaku / x.py
Created October 11, 2012 03:56
"""This would outputs
x
True
__main__
False
"""
import x
@omz
omz / FileTransfer.py
Last active June 23, 2024 14:50
File Transfer script for Pythonista (iOS)
# File Transfer for Pythonista
# ============================
# This script allows you to transfer Python files from
# and to Pythonista via local Wifi.
# It starts a basic HTTP server that you can access
# as a web page from your browser.
# When you upload a file that already exists, it is
# renamed automatically.
# From Pythonista's settings, you can add this script
# to the actions menu of the editor for quick access.
@CNBorn
CNBorn / gist:3404994
Created August 20, 2012 15:03
brew:mysql installation completed.
==> Pouring mysql-5.5.25a.snowleopard.bottle.tar.gz
==> Caveats
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db --help
@zythum
zythum / gist:2848881
Created June 1, 2012 04:50
google收录的敏感词