Skip to content

Instantly share code, notes, and snippets.

View pwittchen's full-sized avatar
🎯
Focusing

Piotr Wittchen pwittchen

🎯
Focusing
View GitHub Profile
@pwittchen
pwittchen / android_broadcast_intent_actions
Created January 29, 2015 17:45
List of all Android Broadcast Intent actions. Since API 17.
android.app.action.ACTION_PASSWORD_CHANGED
android.app.action.ACTION_PASSWORD_EXPIRING
android.app.action.ACTION_PASSWORD_FAILED
android.app.action.ACTION_PASSWORD_SUCCEEDED
android.app.action.DEVICE_ADMIN_DISABLED
android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED
android.app.action.DEVICE_ADMIN_ENABLED
android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED
android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED
android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED
@pwittchen
pwittchen / sweet-captcha.php
Created July 15, 2012 18:19
Sweet Captcha Breaker
<?php
set_time_limit(0);
$answer_not_found = TRUE;
$counter = 1;
echo("breaking sweet captcha in progress.");
while($answer_not_found)
{
$source = file_get_contents('http://sweetcaptcha.com');
preg_match('/question_[0-9]{1,}\\.png/', $source, $matches_question);
$question_number = explode('_',$matches_question[0]);
@pwittchen
pwittchen / start-stop-server-in-background.sh
Created September 23, 2015 10:42
Starting and stopping simple HTTP server in background on Linux. After starting server and closing terminal, server should keep running
# starting simple HTTP server with Python in background
screen -d -m python -m SimpleHTTPServer 7777
# killing process running with screen in background
kill -9 `top -n 1 | pgrep screen`
@pwittchen
pwittchen / create-fat-framework.sh
Created March 15, 2022 22:59 — forked from sundeepgupta/create-fat-framework.sh
Script to create a universal or "fat" binary for an iOS framework.
#!/bin/bash
# Adapted from http://stackoverflow.com/questions/24039470/xcode-6-ios-creating-a-cocoa-touch-framework-architectures-issues/26691080#26691080
# and https://gist.github.com/cromandini/1a9c4aeab27ca84f5d79
# Create a new aggregate target.
# For the automatically generated scheme, change its build config to "release".
# Ensure this target's "product name" build setting matches the framework's.
# Add a run script with `source "${PROJECT_DIR}/path_to_this_script`
@pwittchen
pwittchen / switch_fn_keys_keychron_k3.sh
Created October 3, 2021 16:14
by setting this param in the file /etc/modprobe.d/hid_apple.conf it's possible to toggle F keys with FN key
echo "options hid_apple fnmode=0" | sudo tee -a /etc/modprobe.d/hid_apple.conf
@pwittchen
pwittchen / ifconfig.js
Created January 17, 2017 16:23
executing shell command via JS - on Linux nodejs ifconfig.js; on macOS node ifconfig.js
var process = require('child_process');
process.exec('ifconfig',function (err,stdout,stderr) {
if (err) {
console.log("\n"+stderr);
} else {
console.log(stdout);
}
});
@pwittchen
pwittchen / server.py
Created July 24, 2020 13:27
dummy python server
from http.server import BaseHTTPRequestHandler, HTTPServer
host="localhost" ; port=8080
class HTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200) ; self.end_headers() ; self.wfile.write(b'ok')
print("http server is running at " + host + ":" + str(port))
HTTPServer((host, port), HTTPRequestHandler).serve_forever()
# to remote host
cat localfile.conf | ssh user@hostname 'cat -> /tmp/remotefile.conf'
# from remote host
ssh user@hostname 'cat /tmp/remotefile.conf' > /tmp/localfile.conf
@pwittchen
pwittchen / loadJson.js
Created April 19, 2014 18:25
Loading JSON file with JavaScript. Please note: it won't run as a "local" script. JavaScript does not allow to load local files due to security reasons. You should deploy it on the server in order to load JSON file.
function loadJson(callback) {
var XmlHttpRequest = new XMLHttpRequest();
XmlHttpRequest.overrideMimeType("application/json");
XmlHttpRequest.open('GET', 'file.json', true);
XmlHttpRequest.onreadystatechange = function () {
if (XmlHttpRequest.readyState == 4 && XmlHttpRequest.status == "200") {
// .open will NOT return a value
// but simply returns undefined in async mode so use a callback
callback(XmlHttpRequest.responseText);
}
@pwittchen
pwittchen / t470s.md
Created April 24, 2018 16:27 — forked from okapies/t470s.md
Ubuntu 16.04 on ThinkPad T470s

This is a document describing how to install Ubuntu 16.04 LTS on ThinkPad T470s.

My Hardware

  • CPU: Intel Core i7-7600U (2.80GHz, 4MB cache)
  • Graphics: Intel HD Graphics 620
  • Display: 14” WQHD (2560 X 1440) IPS Non-Touch Anti-Glare
  • Memory: 24GB DDR4 2133 MHz (8GB Onboard + 16GB)
  • SSD: PCIe-NVMe 256G OPAL 2.0
  • Wireless: Intel Dual Band Wireless AC (2x2) 8265 Bluetooth 4.1
  • Fingerprint Reader