This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts, | |
that detects and handles AJAXed content. Forked for use without JQuery. | |
Usage example: | |
waitForKeyElements ( | |
"div.comments" | |
, commentCallbackFunction | |
); | |
//--- Page-specific function to do what we want when the node is found. | |
function commentCallbackFunction (element) { | |
element.text ("This comment changed by waitForKeyElements()."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# The script configures simultaneous AP and Managed Mode Wifi on Raspberry Pi Zero W (should also work on Raspberry Pi 3) | |
# Usage: curl https://gist.githubusercontent.com/lukicdarkoo/6b92d182d37d0a10400060d8344f86e4/raw | sh -s WifiSSID WifiPass APSSID APPass | |
# Licence: GPLv3 | |
# Author: Darko Lukic <[email protected]> | |
# Special thanks to: https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/ | |
MAC_ADDRESS="$(cat /sys/class/net/wlan0/address)" | |
CLIENT_SSID="${1}" | |
CLIENT_PASSPHRASE="${2}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_GET["username"] = ""; | |
$_GET["db"] = "database"; | |
function adminer_object() { | |
class AdminerAutoLogin extends Adminer { | |
function credentials() { | |
return array("127.0.0.1", "username", "password"); | |
} | |
function login($login, $password) { | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Compact Messenger | |
// @version 0.1 | |
// @match https://www.messenger.com/* | |
// @grant GM_xmlhttpRequest | |
// @grant GM_addStyle | |
// ==/UserScript== | |
const targetCSS = document.querySelector("link[href*='FD_uqE-4yZN.css']"); | |
GM_xmlhttpRequest({ | |
method: "GET", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const { ApolloServer, gql } = require('apollo-server-express'); | |
const app = express(); | |
app.get('/', async (req, res) => { | |
await new Promise(resolve => setTimeout(resolve, 5000)); | |
res.send('ok'); | |
}); | |
const typeDefs = gql` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { execSync } = require('child_process'); | |
const stdout = execSync(`ffprobe -of json -show_packets -show_streams -show_format -i ${process.argv[2]}`, { maxBuffer: 1024 * 1024 * 32 }); | |
const { packets } = JSON.parse(stdout); | |
for (let i = 0; i < packets.length - 1; i++) { | |
const pts = Number(packets[i].pts); | |
const duration = Number(packets[i].duration); | |
const pts_next = Number(packets[i + 1]?.pts); | |
if (pts + duration !== pts_next) { | |
console.log(`timestamp issue on packet index: ${i + 1}, pts is expected to be ${pts + duration} but it is ${pts_next}`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
if [ -z "$1" ]; then | |
for dir in */; do [ -e "$dir" ] || continue; ./upgrade.sh "$dir"; done | |
exit 0 | |
fi | |
cwd="$(pwd)" | |
cd "$1" | |
if [ -f Dockerfile ]; then | |
image=$(cat Dockerfile | awk 'tolower($1) == "from" { print $2 }') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(asm)] | |
use std::time::Instant; | |
const BUFFER_SIZE: usize = 1024 * 1024 * 128; // 128 MB | |
fn main() { | |
let mut buffer = vec![0u8; BUFFER_SIZE]; | |
let start_time = Instant::now(); | |
unsafe { write_memory_avx(&mut buffer); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <chrono> | |
#include <cstdint> | |
#include <unistd.h> // for sysctl | |
const int64_t ARRAY_SIZE = 1024 * 1024 * 1024; // 1024 MB | |
const int64_t REPETITIONS = 1000; | |
inline void flush_cache() { | |
__builtin_arm_dsb(0b1111); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <chrono> | |
#include <cstdint> | |
#include <unistd.h> | |
#include <sys/sysctl.h> | |
#include <mach/mach_host.h> | |
const int64_t REPETITIONS = 5; | |
inline void flush_cache() { |
OlderNewer