Skip to content

Instantly share code, notes, and snippets.

View vladborovtsov's full-sized avatar
🎯
Focusing

Vlad Borovtsov vladborovtsov

🎯
Focusing
View GitHub Profile
@zarkone
zarkone / steam_yearinreview_2023.js
Created December 20, 2023 10:35
Steam, year in review 2023: get total play time
// 1. open browser dev console e.g. with Ctrl+Shift+i
// 2. paste in console at Steam year in review page of your account:
// e.g. https://store.steampowered.com/yearinreview/...somethinghere../2023
(function getSteamStats() {
const appConfigAttrs = document.querySelector("html.responsive body.v6.reactroot.responsive_page.movescrolltocontent div.responsive_page_frame.with_header div.responsive_page_content div#responsive_page_template_content.responsive_page_template_content div#application_config").attributes
const accId = JSON.parse(appConfigAttrs["data-userinfo"].value).accountid
const yearInReview = JSON.parse(appConfigAttrs[`data-yearinreview_${accId}_2023`].value)
const totalPlaytimeSeconds = yearInReview.playtime_stats.total_stats.total_playtime_seconds
console.log("Total play time in steam (hours):", totalPlaytimeSeconds / 3600)
@SavageCore
SavageCore / 1-readme.md
Last active November 2, 2024 17:38 — forked from cdleveille/Install⁄Update Xone
Install or update xone driver for Steam Deck (desktop shortcut and bash script)

Enjoying this script? Consider buying me a beer/coffee!

ko-fi

First time setting up your Deck? You may enjoy my setup guide. It'll get you started on Emulation.

Improvements

Main changes at initial release versus cdleveille's original script:

  • Added zenity for a basic "GUI"
@joshatxantie
joshatxantie / gist:4bcf5d0243fba63845fce7cc40365a3a
Created September 2, 2021 04:18
Dockerize Pyodbc/SQL Server
# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
WORKDIR /app
ENV ACCEPT_EULA=Y
RUN apt-get update -y && apt-get update \
&& apt-get install -y --no-install-recommends curl gcc g++ gnupg unixodbc-dev
@waydabber
waydabber / ddcavcontrol.init.lua
Last active October 28, 2024 18:10
Hammerspoon script to control a Display via DDC (brighness, volume) and a Yamaha AV (network) using standard Mac keyboard with MacOS OSD
-- ddcavcontrol
-- v1.2.1
-- This Hammerspoon script is intended to do the following:
-- 1) Control External Display Brightness via DDC (utilizing a proper brightness+contrast curve)
-- 2) Control External Display Volume via DDC
-- 3) Control Digital AV Volume via Network (currently works with Yamaha AVs)
-- 4) Use the standard brightness and volume keys of an Apple keyboards
-- 5) Display the standard MacOS OSD as expected
@kishikawakatsumi
kishikawakatsumi / TableHeaderView-AutoLayout.swift
Created April 29, 2020 11:19
Auto sizing UITableView header
...
headerView.translatesAutoresizingMaskIntoConstraints = false
tableView.tableHeaderView = headerView
NSLayoutConstraint.activate([
headerView.topAnchor.constraint(equalTo: tableView.topAnchor),
headerView.widthAnchor.constraint(equalTo: tableView.widthAnchor),
headerView.centerXAnchor.constraint(equalTo: tableView.centerXAnchor)])
tableView.tableHeaderView?.layoutIfNeeded()
@agentsim
agentsim / highsierra_bootable.sh
Created June 10, 2017 02:23
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13 Install Packages
hdiutil attach /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg
@aunyks
aunyks / large-file-hash.py
Last active August 23, 2023 06:59
Hash a large file in Python
import hashlib as hash
# Specify how many bytes of the file you want to open at a time
BLOCKSIZE = 65536
sha = hash.sha256()
with open('kali.iso', 'rb') as kali_file:
file_buffer = kali_file.read(BLOCKSIZE)
while len(file_buffer) > 0:
sha.update(file_buffer)
@vladborovtsov
vladborovtsov / s3.sh
Created July 17, 2016 11:30 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@shvechikov
shvechikov / signed_s3_upload.py
Created April 28, 2016 13:10
Upload files to S3 using generated signed URLs
import requests
from boto.s3.connection import S3Connection
c = S3Connection(AWS_ACCESS_KEY, AWS_SECRET_KET)
data = 'file content'
filename = 'dir/name.txt'
bucket_name = 'your-bucket-name'
headers = {'Content-Type': 'text/plain'}
@leommoore
leommoore / mongodb_3.2.x_replica_sets_on_aws_ec2.md
Last active March 15, 2022 22:28
MongoDB 3.2.x Replica Sets on AWS EC2

#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.

To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.

##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application