Skip to content

Instantly share code, notes, and snippets.

View angeloped's full-sized avatar

Angeloped angeloped

  • Philippines
View GitHub Profile
@jordanduncan221
jordanduncan221 / Facebook Like Script
Created December 5, 2010 11:18
Very clean and simple Facebook like script
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
@sivachandran
sivachandran / SimpleTcpRedirector.py
Created March 4, 2012 01:42
A simple TCP redirector in python
#!/usr/bin/env python
import socket
import threading
import select
import sys
terminateAll = False
class ClientThread(threading.Thread):
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active June 11, 2024 08:36
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@gdamjan
gdamjan / dns-check.py
Created May 6, 2012 19:15
using custom dns servers with dnspython
from dns.resolver import Resolver
# make a system resolver using /etc/resolv.conf
sys_r = Resolver()
dns = ['ns1.dreamhost.com', 'ns2.dreamhost.com', 'ns3.dreamhost.com']
dreamhost_dns = [ item.address for server in dns for item in sys_r.query(server) ]
# a resolver using dreamhost dns server
dreamhost_r = Resolver()
@laurenarcher
laurenarcher / bitconvert.py
Last active June 14, 2022 07:28
Simple python bitcoin currency converter using the Bitcoin Charts API. Documentation here: http://bitcoincharts.com/about/markets-api/
import urllib2
import json
data = urllib2.urlopen("http://api.bitcoincharts.com/v1/weighted_prices.json")
def convert_to_bitcoin(amount, currency):
bitcoins = json.loads(data.read())
converted = float(bitcoins[currency]["24h"]) * amount
print converted
@tiye
tiye / keydown.coffee
Created July 3, 2013 02:31
keyCode of keydown event in JSON format
# keydown data from the web
# http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
map =
backspace: 8
tab: 9
enter: 13
shift: 16
ctrl: 17
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active July 2, 2024 14:42
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <rthijssen@gmail.com>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
eval "$(ssh-agent -s)"
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@six519
six519 / FS6519.dll.vbs
Last active December 14, 2018 02:44
The story behind "TAGA LIPA ARE" virus and its source code.
'Few years ago, I remember fucking around with this so called "Hacked By Godzilla" virus.
'It was a Visual Basic Script with a filename MS32DLL.dll.vbs that fucks up Internet
'Explorer title bar.
'I have been into writing simple Windows OS viruses before the time I learned about
'this fucking VBS virus.
'We all know that the famous "I LOVE YOU" virus was a Visual Basic Script (VBS) too
'and it gave me an idea to test
'if that scripting language can still be reliable to fuck up peoples computer that time.
'What I did was, I only replaced "MS32DLL" with "FS6519", pressing Ctrl + H
@markhamilton1
markhamilton1 / pi.py
Created March 23, 2014 00:48
pi is a Python script that computes each digit of the value of pi. As long as this script runs it continues to generate digits. As a matter of full disclosure, I did not write this. I am posting it here as a means of preserving the algorithm and making it available to others.
import sys
def calcPi():
q, r, t, k, n, l = 1, 0, 1, 1, 3, 3
while True:
if 4*q+r-t < n*t:
yield n
nr = 10*(r-n*t)
n = ((10*(3*q+r))//t)-10*n
q *= 10