Skip to content

Instantly share code, notes, and snippets.

View hamrammi's full-sized avatar
🙈
Let's see what's out there

Alexander hamrammi

🙈
Let's see what's out there
  • Mother Russia
  • 06:20 (UTC +04:00)
View GitHub Profile
@hamrammi
hamrammi / settings.json
Created July 19, 2023 08:14
VSCode Settings
{
"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,
<!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">
@hamrammi
hamrammi / transformBmp.js
Created November 16, 2019 11:01
Transform BMP images: rotate180, mirror vertically, mirror horizontally
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)
})
})
@hamrammi
hamrammi / gnome-shell.css
Last active December 6, 2018 12:37
Changes Gnome's top bar font
/**
* 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;
}
@hamrammi
hamrammi / test-php-basic-auth.php
Created October 31, 2018 16:49 — forked from rchrd2/test-php-basic-auth.php
PHP basic auth example
<?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
@hamrammi
hamrammi / whatsapp-send-in-current-chat.js
Last active March 22, 2020 13:47 — forked from EyMaddis/whatsapp-send-in-current-chat.js
Sending messages programmatically on web.whatsapp.com
// 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
@hamrammi
hamrammi / tohex.py
Created July 4, 2017 08:09
Convert number to hex representation
# 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
@hamrammi
hamrammi / phantomjs_capture_webpage.js
Created January 30, 2017 13:22
PhantomJS capture webpage command
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()
@hamrammi
hamrammi / minimize_non_active_windows.py
Last active August 10, 2016 07:41
Ubuntu: Minimize all windows except active one
#! /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()
@hamrammi
hamrammi / throttle.js
Last active August 29, 2015 14:18
throttle.js
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