Skip to content

Instantly share code, notes, and snippets.

View unmade's full-sized avatar
🛰️

Aleksei Maslakov unmade

🛰️
View GitHub Profile
@unmade
unmade / index.html
Created November 15, 2018 12:19
Obtain Google OAuth2 Code
<html>
<head></head>
<body>
<script>
var YOUR_CLIENT_ID = 'YOUR_CLIENT_ID';
var YOUR_REDIRECT_URI = 'YOUR_REDIRECT_URI';
var fragmentString = location.hash.substring(1);
// Parse query string to see if page request is coming from OAuth 2.0 server.
var params = {};
@unmade
unmade / gitstats.py
Last active February 4, 2019 09:10
This script can help you find out median and average number of insertions/deletions for your repo
import re
import statistics
import subprocess
import typing
SHOW_LOG = 'git rev-list --all --pretty=oneline'
SHOW_COMMIT = 'git log -1 --stat {commit_id}'
FILES_REG = re.compile(r'(\d+) files? changed')
INSERTIONS_REG = re.compile(r'(\d+) insertions?\(\+\)')
@unmade
unmade / install_gcc_4_7_3.sh
Created March 25, 2020 08:58
Build gcc 4.7.3 on CentOS 6
#!/usr/bin/env sh
yum install gcc gcc-c++
yum -y install svn texinfo-tex flex zip libgcc.i686 glibc-devel.i686
mkdir ~/sourceInstallations
cd ~/sourceInstallations
svn co svn://gcc.gnu.org/svn/gcc/tags/gcc_4_7_3_release/
cd gcc_4_7_3_release/
./contrib/download_prerequisites
cd ..
@unmade
unmade / dictdb.py
Created March 26, 2020 21:20
A small dict-based DB class I made as an assignment in 2016
#!/usr/bin/env python3
# I wrote this for assignment in 2016.
# It provided AS IS without any changes.
class CommandUsageError(Exception):
"""Исключение, обозначающее неверное использование команды"""
pass
@unmade
unmade / instasave.js
Created March 27, 2020 11:53
Downloads Instagram photo
/*
Usage:
1. Paste script in the borwser console
2. Open instagram photo
3. Call `save()`
*/
function _download(src, filename) {
/* kudos to https://stackoverflow.com/a/9970672/11717191 */
@unmade
unmade / ws.html
Created March 27, 2020 12:32
A simple example on WebSocket
<!DOCTYPE HTML>
<html>
<head>
<script type = "text/javascript">
function WebSocketTest() {
if !("WebSocket" in window) {
alert("WebSocket NOT supported by your Browser!");
return;
}
@unmade
unmade / manifest.json
Last active March 27, 2020 13:25
Chrome extension to disable age verification popup
{
"manifest_version": 2,
"name": "No Age Verification",
"description": "Hides age verification block",
"version": "1.0",
"content_scripts": [{
"matches": ["https://servername/*"],
"js": ["no-age-verification.js"]
}],
"permissions": ["activeTab", "https://servername/*"]
@unmade
unmade / default.esdl
Created September 1, 2021 17:14
edgedb
module default {
type File {
required property path -> str;
single link parent -> File {
on target delete DELETE SOURCE;
};
constraint exclusive on (.path);
}