Skip to content

Instantly share code, notes, and snippets.

View neomafo88's full-sized avatar
🏠
Remote

Neoma Fong neomafo88

🏠
Remote
View GitHub Profile
@ljos
ljos / frontmost_window.py
Last active October 24, 2024 08:21
Find the frontmost/active window in OS X
# Copyright @ Bjarte Johansen 2012
# License: http://ljos.mit-license.org/
from AppKit import NSApplication, NSApp, NSWorkspace
from Foundation import NSObject, NSLog
from PyObjCTools import AppHelper
from Quartz import kCGWindowListOptionOnScreenOnly, kCGNullWindowID, CGWindowListCopyWindowInfo
class AppDelegate(NSObject):
def applicationDidFinishLaunching_(self, notification):
@nicklaslof
nicklaslof / gist:3206907
Created July 30, 2012 13:29
adb logcat -b radio
E/RILC ( 128): RIL_register: RIL version 6
D/RILB ( 501): /proc/cmdline=console=ttyMSM2,115200n8 androidboot.hardware=semc totalmem=0x200 startup=0x00000030 serialno=CB5A1HBN21 bt0.ieee_addr=84:00:d2:90:dc:ab wifi0.eth_addr=84:00:d2:d1:1b:c8
D/RILB ( 501): getLteOnCdmaMode=0 curVal=-1 product_type='' lteOnCdmaProductType=''
D/RILB ( 501): getLteOnCdmaMode=0 curVal=-1 product_type='' lteOnCdmaProductType=''
I/PHONE ( 501): Network Mode set to 0
D/RILB ( 501): getLteOnCdmaMode=0 curVal=-1 product_type='' lteOnCdmaProductType=''
I/PHONE ( 501): lteOnCdma is 0 use SUBSCRIPTION_FROM_NV
I/PHONE ( 501): Cdma Subscription set to 1
I/PHONE ( 501): RILClassname is SemcRIL
@gin1314
gin1314 / test.c
Created August 23, 2012 08:54
C++ : Win32 API InternetOpen example
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winsock.h>
#include <wininet.h>
#include <shellapi.h>
#include <mmsystem.h>
typedef struct vs {
char host[128];
@bxt
bxt / webmsg.py
Created August 27, 2012 19:11
Really simple python web server to serve a maintenance message to the web
import string,cgi,time, datetime
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
try:
self.send_response(503) # let bots know whats up
self.send_header('Content-type','text/html')
self.end_headers()
self.wfile.write('<!DOCTYPE html>\n<meta charset=utf-8 />\n<title>Notification page</title>\n')
@abhisek
abhisek / asunpack_229.rb
Created September 6, 2012 19:55
ASPack-2.29 Unpacker
#
# ASPack 2.29 unpacker via. Dynamic Analysis
#
$:.unshift("C:\\Lib\\metasm")
require 'metasm'
AS229_OEP_PUSH_OFFSET = 0x420
def _msg(m, error = false)
@jgornick
jgornick / gist:3786127
Created September 26, 2012 04:47
JavaScript: Parse multiple JSON documents from string
/**
* Parses a string containing one or multiple JSON encoded objects in the string.
* The result is always an array of objects.
*
* @param {String} data
* @return {Array}
*/
function parseJson(data) {
data = data.replace('\n', '', 'g');
@nateware
nateware / gist:3915757
Created October 19, 2012 01:27
Start Mac VNC server from command line
# Step 1: Set priveleges
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all
Starting...
Setting allow all users to YES.
Setting all users privileges to 1073742079.
Done.
# Step 2: Allow VNC clients
#!/bin/bash
#Close stdin - avoid accidental keypresses causing problems
exec 0>&-
# Find MKV files
for file in "$@";
do
find "$file" -type f -not -name ".*" | grep .mkv$ | while read file
do
@fqrouter
fqrouter / tcpdump_wrapper.py
Created February 9, 2013 02:31
make tcpdump output to stdout and use dpkt to parse the pcap file captured
@contextlib.contextmanager
def capture(ifname, src, dst):
events = []
filter = '(host %s and host %s) or icmp[0] = 11' % (src, dst)
p = subprocess.Popen(
['tcpdump', '-i', ifname, '-w', '-', filter],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
try:
yield events
finally:
@datagrok
datagrok / git-serve.md
Last active April 21, 2023 07:33
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.