Skip to content

Instantly share code, notes, and snippets.

@Katamori
Katamori / telegramRestore.md
Created March 15, 2021 21:22 — forked from avivace/telegramRestore.md
Restore deleted Telegram messages from groups

Restore deleted Telegram messages, medias and files from groups

There's not telegram API method for this, we need to call MTProto methods to retrieve messages from the "Recent Actions" (Admin Log) since deleted messages (and medias) gets moved there for 48 hours before the permanent deletion.

from telethon import TelegramClient, events, sync
from telethon.tl.types import InputChannel, PeerChannel
from telethon.tl.types import Channel
import time
@Katamori
Katamori / bootstrap.js
Created February 16, 2020 10:33 — forked from cloakedninjas/bootstrap.js
Bootstrapping a Phaser game to begin unit testing
var game;
function createGame() {
game = new MyGame.Game();
game.state.onStateChange.add(function (state) {
if (state === 'menu') {
runTests(); // wait for boot + preload to complete before running tests
}
}, this);
game.play(); // init's game and sets the initial Phaser.State
@Katamori
Katamori / domain-to-aws-ec2-instance.md
Created February 4, 2020 10:27 — forked from keithweaver/domain-to-aws-ec2-instance.md
Point Domain to Amazon Web Services (AWS) EC2 Instance

Point Domain to Amazon Web Services (AWS) EC2 Instance

  1. Open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.
  2. If you are new to Amazon Route 53, you see a welcome page; choose Get Started Now for DNS Management. Otherwise, choose Hosted Zones in the navigation pane.
  3. Choose Create Hosted Zone.
  4. For Domain Name, type your domain name.
  5. Choose Create.
  6. Click the Hosted Zone, edit record set.
  7. In the value, add ec2-54-152-134-146.compute-1.amazonaws.com.
  8. Change your DNS file to point to the IPv4 address (This would be in something like GoDaddy).
@Katamori
Katamori / bcrypt-promise.js
Created October 9, 2019 17:32 — forked from dmh2000/bcrypt-promise.js
Using bcrypt with promises to hash a password and then verify it
let bcrypt = require('bcrypt-nodejs');
let password = "hello";
let stored_hash = "";
// first generate a random salt
function genSalt(password) {
return new Promise((resolve,reject) => {
bcrypt.genSalt(10,function(err,salt) {
if (err) {
@Katamori
Katamori / nodejs-tcp-example.js
Created April 23, 2019 12:26 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@Katamori
Katamori / yt.sh
Created September 20, 2017 10:26 — forked from Silur/yt.sh
youtube viewer in bash
# usage ./yt.sh <https://youtube.com/watch?v=....>
urldecode() {
local url_encoded="${1//+/ }"
printf '%b' "${url_encoded//%/\\x}"
}
video_url="$1"
raw_url=$(curl \
-H 'Upgrade-insecure-requests: 1' \
-H 'Cache-control: max-age=0' \
-H 'Accept-language: en-US,en;q=0.8,bn;q=0.6' \
@Katamori
Katamori / ScreenTreeNode.js
Created June 12, 2017 10:09 — forked from DavidBruant/ScreenTreeNode.js
2D BSP in JavaScript
(function(global){
"use strict";
function constEnumPropValueDesc(v){
return {
value: v,
enumerable: true,
configurable: false,
writable: false
};