Discover gists
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
var express = require('express'), | |
directory = require('serve-index'), | |
app = new express(); | |
var hourMs = 1000*60*60; | |
app.use(express.static(__dirname + '/public', { maxAge: hourMs })); | |
app.use(directory(__dirname + '/public', { 'view' : 'details'})); | |
app.listen(4433); |
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
async function createAccount(){ | |
var USER_PREFIX = 'USERNAME'; // change here. | |
var USER_PASS = 'PASSWORD'; // change-here | |
var TIMER_DELAY = 400; | |
// username | |
await delay(TIMER_DELAY); | |
var randomGuid = guid(); |
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 fastify = require('fastify')({ logger: true }); | |
const axios = require('axios'); | |
const path = require('path'); | |
const routes = require('./routes/route'); | |
//console.log(route); | |
routes.forEach((route, index) => { | |
fastify.route(route) | |
}); |
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
function deepFlatten(arr){ | |
return [].concat.apply([], arr.map(x => Array.isArray(x) ? deepFlatten(x) : x)); | |
} |
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
/** | |
* Sets a delay for 'wait' milliseconds | |
* @param {Number} wait - wait time in milliseconds | |
*/ | |
let delay = async (wait) => { | |
console.log(`Waiting for ${wait} milliseconds`); | |
return new Promise(p => setTimeout(p, wait)); | |
} |
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
export class AppComponent { | |
title = 'ui'; | |
keys = { | |
space : false, | |
ctrl : false | |
} | |
@HostListener('window:keydown', ['$event']) | |
keyEventDown(event: KeyboardEvent) { | |
if(event.keyCode === 17){ |
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 <stdio.h> | |
void hexdump(const void* data, size_t size) { | |
char ascii[17]; | |
size_t i, j; | |
ascii[16] = '\0'; | |
for (i = 0; i < size; ++i) { | |
printf("%02X ", ((unsigned char*)data)[i]); | |
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') { | |
ascii[i % 16] = ((unsigned char*)data)[i]; |
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
all: | |
clang machoman.c -dynamiclib -o libmachoman.dylib | |
clean: | |
rm -rf libmachoman.dylib |
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
# Based on this answer: https://stackoverflow.com/a/61859561/1956278 | |
# Backup old data | |
Rename-Item -Path "./data" -NewName "./data_old" | |
# Create new data directory | |
Copy-Item -Path "./backup" -Destination "./data" -Recurse | |
Remove-Item "./data/test" -Recurse | |
$dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory | |
Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse |
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
javascript:/* Adblock Simple */ | |
(function(){ | |
const exceptOrigins = [ | |
'https://disqus.com', | |
document.origin | |
]; | |
function remIF(e){ | |
try{ | |
var orgn = new URL(e.src || 'http://unknown-src').origin; |
NewerOlder