Skip to content

Instantly share code, notes, and snippets.

View KingCprey's full-sized avatar
👌
yote

KingCprey KingCprey

👌
yote
  • England
View GitHub Profile
@Ohcanep
Ohcanep / spotify-ctrl
Last active September 23, 2016 21:03
#!/usr/bin/env bash
# For a vastly more feature-rich tool, have a look at
# https://gist.github.com/Ohcanep/48dac84c5916821d150c545a6eb12547
# https://gist.github.com/wandernauta/6800547 (original)
DEST="org.mpris.MediaPlayer2.spotify"
OBJECT_PATH="/org/mpris/MediaPlayer2"
INTERFACE="org.mpris.MediaPlayer2.Player"
<?php
// https://github.com/tazotodua/useful-php-scripts
//optional: 5th parameter - backup specific tables only: array("mytable1","mytable2",...)
//optional: 6th parameter - backup filename
// NOTE! to adequatelly replace strings in DB, MUST READ: goo.gl/2fZDQL
function EXPORT_TABLES($host,$user,$pass,$name, $tables=false, $backup_name=false){
set_time_limit(3000); $mysqli = new mysqli($host,$user,$pass,$name); $mysqli->select_db($name); $mysqli->query("SET NAMES 'utf8'");
$queryTables = $mysqli->query('SHOW TABLES'); while($row = $queryTables->fetch_row()) { $target_tables[] = $row[0]; } if($tables !== false) { $target_tables = array_intersect( $target_tables, $tables); }
$content = "SET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";\r\nSET time_zone = \"+00:00\";\r\n\r\n\r\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\r\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\r\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\r\n/*!401
@nerdalertdk
nerdalertdk / beguidcalc.md
Created September 7, 2016 06:21 — forked from Fank/beguidcalc.md
ArmA 3 / DayZ-Standalone - BattlEye GUID calculation

md5("BE" (2 bytes) + 64-bit SteamID (8 bytes))

@Fank
Fank / beguidcalc.md
Last active December 23, 2023 12:26
ArmA 3 / DayZ-Standalone - BattlEye GUID calculation

md5("BE" (2 bytes) + 64-bit SteamID (8 bytes))

@liftoff
liftoff / xcb_screenshot.py
Last active January 21, 2021 10:51
An example of how to capture a screenshot using xpyb (xcb bindings for Python). UPDATED 2013-02-13: Now using PIL's Image.frombuffer() method on the raw image data object given by xcb. It is an order of magnitude faster than converting the xcb object to a Python string and using PIL's Image.fromstring().
#!/usr/bin/env python
"""
An example demonstrating how to use xpyb (xcb bindings for Python) to take a
full-screen screenshot.
"""
# Meta
__version__ = '1.0'
__version_info__ = (1, 0)
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"