Skip to content

Instantly share code, notes, and snippets.

View Leask's full-sized avatar
🏠
Working from home

Sixia "Leask" Huang Leask

🏠
Working from home
View GitHub Profile
@Leask
Leask / Mac OS X Sudo Password Bypass
Created August 30, 2013 17:14
This Metasploit module gains a session with root permissions on versions of OS X with sudo binary vulnerable to CVE-2013-1775. Tested working on Mac OS 10.7-10.8.4, and possibly lower versions. If your session belongs to a user with Administrative Privileges (the user is in the sudoers file and is in the "admin group"), and the user has ever run…
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
#
# http://metasploit.com/
##
require 'shellwords'
class Metasploit3 < Msf::Exploit::Local
@Leask
Leask / rts.sh
Created September 3, 2013 07:42
Removing the tailing spaces in codes
sed -i -r 's/ +$//' `find . -path ./sdk -prune -o -regextype posix-extended -regex '.* (css|html|js|php|sql|svg)' -exec grep -rl ' $' {} ;`
@Leask
Leask / yturl.sh
Created September 5, 2013 14:02
Parse YouTube url (get youtube video id)
sh -c 'url="http://youtu.be/MejbOFk7H6c"; vid="`for i in ".*youtu\.be/\([^\/&?#]\+\)" ".*youtu.\+v[=/]\([^\/&?#]\+\)" ".*youtu.\+embed/\([^\/&?#]\+\)"; do expr "${url}" : "${i}"; done`"; if [ -n "${vid}" ]; then echo ${vid}; else echo "${url}"; fi'
@Leask
Leask / iterm-unicode-icons.jpg
Last active December 22, 2015 11:48
curl http://www.climagic.org/txt/unicodeicons.txt # I'm almost afraid to show this because it only works in color on Mac terminals Mac users just can't do things without trying to pretty it up can they? The following are the colorful parts of Unicode Codepoints U+1F000 - U+1F999
iterm-unicode-icons.jpg

Mario in pure CSS

Just a Mario done in pure CSS with box-shadow. It is done pixel by pixel, with a declaration of box-shadow for each pixeL; It has to be improved by doing areas of pixels with the spread parameter of box-shadow

A Pen by KingSavate on CodePen.

License.

@Leask
Leask / abcd.js
Created October 8, 2013 06:30
Exhaustive all cases of filling A, B, C, D in to a ten elements array.
function output(intIn) {
strIn = intIn.toString(4);
var aL = ['A', 'B', 'C', 'D'];
var msk = '0000000000';
var len = msk.length;
var str = msk + strIn;
var rtn = '';
str = str.substr(str.length - len, len);
arr = str.split('');
for (var i in arr) {
@Leask
Leask / tp.sh
Created October 8, 2013 06:34
Displays (somewhat accurate) hardware sensor readouts on some current macs(works on Powerbooks).
#!/bin/bash
#
# TP Probe v.0.3 alpha
# by 31d1 2005 djbidi@gmail.com
#
# displays (somewhat accurate) hardware sensor readouts on some current macs.
# works on Powerbooks
# help
@Leask
Leask / ip2long.py
Created October 20, 2013 21:19
Access your website just like dialing a phone number. TIPS: $ curl http://[SCRIPT RETURNS] EXAMPLE: $ curl http://3237077094
#!/usr/bin/env python
import socket
import struct
def ip2long(ip):
packedIP = socket.inet_aton(ip)
return struct.unpack("!L", packedIP)[0]
print ip2long('192.241.224.102') # your website ip address
@Leask
Leask / git-pull-all.sh
Created December 18, 2013 19:42
How do I clone all remote branches with Git?
#!/bin/bash
# http://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches-with-git?rq=1
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
git branch --track ${branch##*/} $branch
done
#!/bin/sh
#dropbox service
DROPBOX_USERS="user1 user2"
DAEMON=.dropbox-dist/dropbox
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`