Skip to content

Instantly share code, notes, and snippets.

@yfe404
yfe404 / nox.sh
Created July 10, 2019 20:08
Decrease screen brightness using xrandr
#!/bin/bash
b=$(xrandr --current --verbose | grep -i bright | cut -d':' -f 2)
b=$((b - 0.1))
xrandr --output eDP-1 --brightness $b ## adjust the output with yours, you can get it using the commend xrandr (with no args)
@yfe404
yfe404 / lumos.sh
Created July 10, 2019 20:07
Increase screen brightness using xrandr
#!/bin/bash
b=$(xrandr --current --verbose | grep -i bright | cut -d':' -f 2)
b=$((b + 0.1))
xrandr --output eDP-1 --brightness $b ## adjust the output with yours, you can get it using the commend xrandr (with no args)
@yfe404
yfe404 / auto_reverse_shell.sh
Created July 8, 2019 10:04
Create a persistent reverse shell
IDENTITY="$USER/.ssh/identity.pem"
SRC_PORT=19999
DST_PORT=22
DST_USER=gandalf
DST_HOST=120.88.7.11
autossh -M 0 -N -o ServerAliveInterval 15 -i $IDENTITY -R $SRC_PORT:localhost:$DST_PORT $DST_USER@$DST_HOST
## You can connect back from DST_HOST using ssh -p $SRC_PORT local_user_on_SRC@localhost
@yfe404
yfe404 / bootable.sh
Created June 13, 2019 07:48
Create a bootable usb from ISO image
sudo dd if=inputfile.iso of=/dev/disk<?> bs=4M && sync
@yfe404
yfe404 / website.py
Created June 5, 2019 12:00
Website abstraction in Python for scraping
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import WebDriverException
import os
import time
class Website(webdriver.Firefox):
def connect(self, user=os.environ['USERNAME'], password=os.environ['PASSWORD']):
self.get("https://www.example.com/login")
@yfe404
yfe404 / instagram.sh
Last active June 5, 2019 08:11
Scrap Instagram public information on a user including biography, number of followers, post image urls and captions, number of likes per post ...
curl https://www.instagram.com/USERNAME/ | grep 'window._sharedData = ' | python -c 'print(input()[64:-10])' | jq
@yfe404
yfe404 / gist:01f7fb25e85ffb88b38c50ff23de4b69
Last active April 3, 2019 09:24
Emacs no window as git editor
git config --global core.editor "emacs -nw"
@yfe404
yfe404 / main.py
Created May 25, 2018 16:57
scrap-instagram
"""
Scrap caption and images from instagram using https://deskgram.org
"""
import requests
from bs4 import BeautifulSoup
BASE_URL = 'https://deskgram.org'
USER = 'healthymealsberlin'
start_url = BASE_URL + '/' + USER
@yfe404
yfe404 / main.py
Created April 3, 2018 13:01
Basic flask app factory pattern
def create_app():
"""
Create Flask application using the app factory pattern.
:return: Flask app
"""
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config.settings')
import json
import requests
from bottle import debug, request, route, run
GRAPH_URL = "https://graph.facebook.com/v2.6"
VERIFY_TOKEN = 'YOUR_VERIFY_TOKEN'
PAGE_TOKEN = 'YOUR_PAGE_TOKEN'
def send_to_messenger(ctx):