Skip to content

Instantly share code, notes, and snippets.

View fkztw's full-sized avatar
📺
Hello World!

Frank Zheng fkztw

📺
Hello World!
  • Taiwan
  • 19:17 (UTC +08:00)
View GitHub Profile
@ozen
ozen / Selenium PhantomJS Python Header.py
Last active November 14, 2024 05:29
How to set request headers when using Selenium Python with PhantomJS driver
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
desired_capabilities = DesiredCapabilities.PHANTOMJS.copy()
desired_capabilities['phantomjs.page.customHeaders.User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) ' \
'AppleWebKit/537.36 (KHTML, like Gecko) ' \
'Chrome/39.0.2171.95 Safari/537.36'
driver = webdriver.PhantomJS(desired_capabilities=desired_capabilities)
@tafkey
tafkey / git_overview
Last active October 19, 2023 15:15
Print git status of all repositories under the current folder
find . -type d -name '.git' | while read dir ; do sh -c "cd $dir/../ && echo -e \"\nGIT STATUS IN ${dir//\.git/}\" && git status -s" ; done
@nicolargo
nicolargo / tips.py
Last active May 5, 2020 08:37
Python tips for optimization
#############################################################################
# Apply a function to a list
#############################################################################
# Instead of...
newlist = []
for word in oldlist:
newlist.append(word.upper())
# ... use map
#!/usr/bin/sudo sh
## ruby_revealer.sh -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+.
## From `strings ruby_concealer.so`:
##
## > This obfuscation is intended to discourage GitHub Enterprise customers
## > from making modifications to the VM.
##
## Well, good, as long as its not intended to discourage *me* from doing this!
@garycrawford
garycrawford / docker-compose.yml
Created July 9, 2015 13:00
MongoDB Replica Set docker-compose.yml
primary:
image: mongo:3.0
volumes:
- ./p:/data
ports:
- "27017:27017"
# Our current version of docker-compose doesn't allow extra_hosts which would be the best way
# to add curcular dependency container links in this case. We cant upgrade docker-compose
# without upgrading docker to 1.7, and we can't do that without upgrading the kernel on our
# CentOS VM's. As such we are using the hostname hask below to allow primary and secondary
@tevino
tevino / fix_virtualenv
Last active December 28, 2024 15:11
Fix python virtualenv after python update
#!/usr/bin/env bash
ENV_PATH="$(dirname "$(dirname "$(which pip)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"
BAD_ENV_PATHS="/usr/local"
echo "Ensure the root of the broken virtualenv:"
echo " $ENV_PATH"
@ShikChen
ShikChen / reg_ex.py
Created April 20, 2015 08:46
PlaidCTF 2015 REG EX
import itertools
import re
import z3
base = 'plaidctf'
r = open('regex_57f2cf49f6a354b4e8896c57a4e3c973.txt').read().strip()
s = re.search(r'\((.*)\)', r).group(1)
s = s.split('|')[3:]
s = [re.findall(r'(.*?)\[(.*?)\]', it) for it in s]
@goncalossilva
goncalossilva / gifenc.sh
Last active December 12, 2023 22:31
Encode mp4, webm and gif using ffmpeg (2.6 or above). Audio is discarded on all of these!
#!/bin/sh
# sh gifenc.sh input.mp4 output.gif
# Optionally accepts width / height (one or both).
palette="/tmp/palette.png"
filters="fps=15"
if [ -n "$3" ]; then
if [ -n "$4" ]; then
filters="$filters,scale=$3:$4"
@phrawzty
phrawzty / 2serv.py
Last active January 16, 2025 08:46
simple python http server to dump request headers
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
<meta name="gby" content="
|~~~~~~~|
| |
| |
| |
| |
| |
|~.\\\_\~~~~~~~~~~~~~~xx~~~ ~~~~~~~~~~~~~~~~~~~~~/_//;~|
| \ o \_ ,XXXXX), _..-~ o / |
| ~~\ ~-. XXXXX`)))), _.--~~ .-~~~ |