Skip to content

Instantly share code, notes, and snippets.

View nngogol's full-sized avatar

nngogol

View GitHub Profile
@sagax
sagax / screen_record.sh
Last active October 10, 2018 10:03
record screen with ffmpeg
#!/bin/bash
# how to use
#
# |----------------------- $1 - filename; can be _
# | |------------------ $2 - window coordinate x
# | | |---------------- $3 - window coordinate y
# | | | |------------ $4 - width
# | | | | |------- $5 - height
# | | | | | |--- $6 - display number
@GreggSetzer
GreggSetzer / spiral-matrix.js
Last active July 7, 2018 18:10
Javascript Interview Question: Spiral Matrix
/*
Draw a spiral matrix.
[ 1, 2, 3, 4]
[12, 13, 14, 5]
[11, 16, 15, 6]
[10, 9, 8, 7]
1. Initialize the multidimensional array.
2. Create counter variables to track positions.
@jonasraoni
jonasraoni / print-spiral-array.js
Created October 27, 2017 12:00
Given a square matrix of at least 3x3, print its elements following a spiral path
function print(o){
var
m = o.length >> 1,
r = m,
c = m + 1;
p = function(){
console.log(o[r][c]);
},
left = function(i){
for(; c > i; p(--c));
<!DOCTYPE html>
<html>
<head><title>SOUND</title></head>
<body>
<div>Frequence: <span id="frequency"></span></div>
<script type="text/javascript">
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var oscillatorNode = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
@shpaker
shpaker / wifi_starter.cmd
Last active January 19, 2018 15:25
Batch file for managing virtual Wi-Fi hotspot in Windows 7+
rem author https://github.com/shpaker
@echo off
:main
echo [1] Start Wi-Fi network
echo [2] Stop Wi-Fi network
echo [3] Restart Wi-Fi network
echo [4] Config Wi-Fi network (require administrator privileges)
echo [0] Exit
/*
you.js - "You Are an Idiot" script
The Commentary
*/
// bookmark - adds IE favorite, reminding you that you're an idiot
function bookmark(){
if ( (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4) ){
var url="http://offiz.bei.t-online.de/idiot.html";
var title="Idiot!";
/*
Функция, выводящая числовые спирали.
Например:
1 2 3 4 5
18 19 20 21 6
17 28 29 22 7
16 27 30 23 8
15 26 25 24 9
14 13 12 11 10
Входные данные: ширина и высота спирали.
var spiralize = function(size) {
let spiral = [];
for(let i=0;i<size;i++) {
spiral[i] = Array(size).fill(0);
}
let min = 0;
let max = size;
while (min < max ) {
for(let i=min;i<max;i++) {
@eevee
eevee / perlin.py
Last active June 20, 2024 01:58
Perlin noise in Python
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
@zhanglongqi
zhanglongqi / pyqt_model_view.py
Last active September 22, 2023 00:19
Example of how to use `QDataWidgetMapper` and `QAbstractTableModel` to customize your own widget and your own model.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt5.QtWidgets import (QWidget, QDataWidgetMapper,
QLineEdit, QApplication, QGridLayout, QListView)
from PyQt5.QtCore import Qt, QAbstractTableModel, QModelIndex
class Window(QWidget):
def __init__(self, parent=None):