Skip to content

Instantly share code, notes, and snippets.

View inancgumus's full-sized avatar

İnanç Gümüş inancgumus

View GitHub Profile
@inancgumus
inancgumus / xmlToJson.xslt
Created May 16, 2017 10:20
XML to JSON using XSLT
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8"/>
<xsl:template match="/*[node()]">
<xsl:text>{</xsl:text>
<xsl:apply-templates select="." mode="detect" />
<xsl:text>}</xsl:text>
</xsl:template>
@inancgumus
inancgumus / exercise_18_slices_pic_show.go
Last active August 23, 2023 10:58
go tour exercise solutions
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
p := make([][]uint8, dy)
for y := range p {
p[y] = make([]uint8, dx)
for x := 0; x < dx; x++ {
p[y][x] = uint8(x^y)
@inancgumus
inancgumus / list-repositories-by-stars.md
Last active July 20, 2022 18:42
List repositories by stars (paginated)

Run using the explorer, here.

First Page:

query { 
  topic(name: "go") {
    repositories(first: 100, orderBy: {field: STARGAZERS, direction:DESC}) {
      edges {
 node {
@inancgumus
inancgumus / gist:71a72f472343f38b27b4e53ea4d00acb
Last active October 20, 2020 22:15
Restore github commit

If you've made a wrong forceful push or just want to recover from old commits in github, then you can use this command flow:

# find the commit, just like git reflog
curl -u <username> https://api.github.com/repos/:owner/:repo/events

# create a new branch from the commit sha found in previous step
curl -u <github-username> 
  -X POST -d ‘{“ref”:”refs/heads/<new-branch-name>”, “sha”:”<sha-from-step-1>"}’ 
 https://api.github.com/repos/:owner/:repo/git/refs
@inancgumus
inancgumus / mongoDao
Created June 16, 2017 11:32 — forked from jameBoy/mongoDao
封装一个mgo的简单使用
package dao
import (
"gopkg.in/mgo.v2/bson"
"time"
"gopkg.in/mgo.v2"
"strings"
"log"
)
@inancgumus
inancgumus / gist:1dd9080059770a917aae81a58fac529e
Created December 12, 2017 22:39 — forked from scottburton11/gist:3222152
Audio Compression for Voiceover

About compression

Audio compression is used to reduce the dynamic range of a recording. Dynamic range is the difference between the loudest and softest parts of an audio signal. It was originally used to guard against defects when cutting wax and vinyl phonograph records, but generally became useful as a way of increasing the loudness of an audio recording without achieving distortion.

The goal of most compression applications is to increase the amplitude of the softest parts of a recording, without increasing the amplitude of the loudest parts.

Compressor anatomy

Compressors generally all have the same conceptual parts. However, not all compressors present variable controls for all parts to the user. If you don't see all of your compressor's controls here, there's a chance it either has a fixed value (and no control), or is named something else:

// https://blog.learngoprogramming.com/golang-const-type-enums-iota-bc4befd096d3
package main
import (
"fmt"
)
const (
Mercury = 3.303e+23
Venus = 4.869e+24
// declare constants for the days in a week, and assign to them
// different numeric values.
//
// so, they won't clash. if both values of Sunday and Monday were 0,
// then, how could we know that which one is Sunday or Monday?
//
// this code is for this article: https://blog.learngoprogramming.com/golang-const-type-enums-iota-bc4befd096d3
const (
Sunday = 0
Monday = 1
@inancgumus
inancgumus / main.go
Last active December 2, 2017 13:39
Interface scanner for Go
/*
non-refactored, hacky tool to extract interfaces.
adopted from https://github.com/campoy/justforfunc/tree/master/24-ast
*/
package main
import (
"fmt"
"go/scanner"
"go/token"
@inancgumus
inancgumus / godev.bash
Created October 29, 2017 22:18
Makes your environment ready for Go contributions
#!/bin/bash
# -----------------------------------------------------------------------------
# HOW TO RUN?
# -----------------------------------------------------------------------------
# . ./godev.bash
# WARNING:
#