This file contains hidden or 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
{ | |
"editor.tabSize": 2, | |
"editor.lineHeight": 28, | |
"files.associations": { "*.module": "php" }, | |
"diffEditor.renderSideBySide": true, | |
"editor.fontSize": 15, | |
"editor.fontFamily": "'JetBrains Mono', Menlo, Monaco, 'Courier New', monospace", | |
"workbench.colorTheme": "Default High Contrast", | |
"editor.renderWhitespace": "all", | |
"editor.minimap.enabled": false, |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Paginator Vue component</title> | |
<script src="https://unpkg.com/vue@next"></script> | |
</head> | |
<body> | |
<div id="vueApp"> |
This file contains hidden or 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 fs = require('fs') | |
const fileName = 'RAY.BMP' | |
const readBmp = fileName => new Promise((resolve, reject) => { | |
fs.readFile(fileName, (err, data) => { | |
if (err) reject(err) | |
resolve(data) | |
}) | |
}) |
This file contains hidden or 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
/** | |
* Original post: https://www.modmy.com/how-change-font-gnomes-top-bar | |
*/ | |
@import url("resource:///org/gnome/theme/gnome-shell.css"); | |
stage { | |
font-family: Roboto Condensed; | |
font-size: 15px; | |
} |
This file contains hidden or 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 | |
function require_auth() { | |
$AUTH_USER = 'admin'; | |
$AUTH_PASS = 'admin'; | |
header('Cache-Control: no-cache, must-revalidate, max-age=0'); | |
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW'])); | |
$is_not_authenticated = ( | |
!$has_supplied_credentials || | |
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER || | |
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS |
This file contains hidden or 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
// this allows to send arbitrary messages. The chat conversation you want to send messages to has to be open. | |
// just run this in the JS console | |
// http://stackoverflow.com/a/39165137/1249001 | |
function findChatComponent(dom) { | |
var result = null | |
for (var key in dom) { | |
if (key.startsWith("__reactInternalInstance$")) { | |
try { | |
result = dom[key].child.child.memoizedProps.children._owner.stateNode.props.chat |
This file contains hidden or 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
# coding: utf-8 | |
def tohex(val, nbits=64): | |
return hex((val + (1 << nbits)) % (1 << nbits)) | |
packet3 = (0x55, 0x01, 0xfe, 0x00, 0x00, 0x00) | |
print tohex(~sum(packet3)) # 0xfffffffffffffeabL |
This file contains hidden or 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
var page = require('webpage').create(); | |
var system = require('system'); | |
page.viewportSize = { width: 1024, height: 768 }; | |
page.clipRect = { top: 0, left: 0, width: 1024, height: 768 }; | |
var url = system.args[1]; | |
var time = Date.now() |
This file contains hidden or 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
#! /usr/bin/python | |
import gi | |
gi.require_version('Gtk', '3.0') | |
gi.require_version('Wnck', '3.0') | |
from gi.repository import Gtk, Wnck | |
screen = Wnck.Screen.get_default() |
This file contains hidden or 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
function throttle (fn, threshold) { | |
var last, now, context, deferTimer, args | |
function exec() { | |
last = now | |
fn.apply(context, args) | |
} | |
return function () { | |
context = this | |
now = +new Date | |
args = arguments |