Skip to content

Instantly share code, notes, and snippets.

View mkg20001's full-sized avatar
🌟
rinse and repeat, rise and shine

Maciej Krüger mkg20001

🌟
rinse and repeat, rise and shine
View GitHub Profile
  • git checkout master
  • git pull
  • git checkout branch
  • git merge master
@komasaru
komasaru / test_bash_cursor_2.sh
Last active May 2, 2017 12:25
Bash script to control cursor position.(Ex.2)
#!/bin/bash
# Clear the screen
tput clear
# Write a frame
echo
echo " +---------------------+"
echo " | |"
echo " +---------------------+"
@fritx
fritx / app-drag.js
Last active May 25, 2017 11:00
nwjs/electron window dragging implementation (replacement of -webkit-app-region: drag/no-drag)
var remote = require('remote')
var $ = require('./lib/jquery')
var win = remote.getCurrentWindow()
var isDragging = false
var winPos
var dX, dY // screen - win
$(document).on('mousedown', '.app-drag', function(e) {
e = e.originalEvent || e
@shesek
shesek / bitcoinjs-lib-nodejs.sh
Last active July 2, 2017 16:53
Package bitcoinjs-lib as a nodejs module (VERY hacky, but good enough for now)
#!/bin/bash
# Package bitcoinjs-lib as a nodejs module
# Install bitcoinjs first (`npm install bitcoinjs-lib`),
# than run this in your app's directory.
TARGET=lib/bitcoinjs-lib.js
# Wrap all of bitcoinjs-lib and its dependencies in an IIFE
# and export the Bitcoin, Crypto and BigInteger objects.
@mkg20001
mkg20001 / steam-appmanifest-parser.js
Last active August 24, 2017 13:21
Steam Appmanifest Parser
const fs = require("fs")
module.exports = AppManifestParser
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function recInt(obj) { //replace numeric strings with integers
for (var p in obj)
if (typeof obj[p] == "object") obj[p] = recInt(obj[p]);
@deanhume
deanhume / client-hints-service-worker.js
Last active September 10, 2017 11:03
Service Worker & HTTP Client Hints
"use strict";
// Listen to fetch events
self.addEventListener('fetch', function(event) {
// Check if the image is a jpeg
if (/\.jpg$|.png$/.test(event.request.url)) {
// Inspect the accept header for WebP support
var supportsWebp = false;
@mkg20001
mkg20001 / cert-cleanup.sh
Last active July 8, 2018 10:14
A script useful for cleaning up an old certificate archive. Removes orphan keys, ca certs and expired certs.
#!/bin/bash
# A script useful for cleaning up an old certificate archive. Removes orphan keys, ca certs and expired certs.
dir="$(readlink -f $1)"
CLEANUP=false # Enable this AFTER YOU CHECKED IT WORKS! (make backups)
[ -z "$dir" ] && exit 2
cd "$dir"
@TylerLeonhardt
TylerLeonhardt / TweetScript.psm1
Last active July 17, 2018 19:37
Importing Scripts from Tweets! #280characters
# Importing Scripts directly from Tweets! #280characters
#
# NOTE: This should not be used for any production environment. Or any environment for that matter. Use https://PowerShellGallery.com
#
#
####################################
# Example #
####################################
#
#
import urllib2, re, json, os, time, sys, HTMLParser
html_parser = HTMLParser.HTMLParser()
auth_address = "1KbV1e1u6P6AsY8XNBydgtbtN8iSB5WMyG"
auth_privatekey = "xxxx"
site = "1TaLkFrMwvbNsooF4ioKAY9EuxTBTjipT"
zeronet_dir = ".."
os.chdir(zeronet_dir)
@passatgt
passatgt / stormpath-express-failed-login-attempt.js
Last active April 15, 2019 20:00
Log failed login attempts
preLoginHandler: function(formData, req, res, next) {
var authRequest = {
username: formData.login,
password: formData.password
};
//Try to authenticate the user
req.app.get('stormpathApplication').authenticateAccount(authRequest, function(err, result) {
//if (err) return helpers.handleError(err,res);
if (err && err.code == 7100) {