Skip to content

Instantly share code, notes, and snippets.

View enderahmetyurt's full-sized avatar
🦄

Ender Ahmet Yurt enderahmetyurt

🦄
View GitHub Profile
@MuhammetDilmac
MuhammetDilmac / error.log
Created April 28, 2022 14:07
Ruby 2.7.x installation openssl error solution
/tmp/ruby-build.20220428153926.58149.kvjym0/ruby-2.7.5/lib/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- openssl (LoadError)
from /tmp/ruby-build.20220428153926.58149.kvjym0/ruby-2.7.5/lib/rubygems/core_ext/kernel_require.rb:83:in `require'
from /tmp/ruby-build.20220428153926.58149.kvjym0/ruby-2.7.5/lib/rubygems/specification.rb:2430:in `to_ruby'
from ./tool/rbinstall.rb:846:in `block (2 levels) in install_default_gem'
from ./tool/rbinstall.rb:279:in `open_for_install'
from ./tool/rbinstall.rb:845:in `block in install_default_gem'
from ./tool/rbinstall.rb:835:in `each'
from ./tool/rbinstall.rb:835:in `install_default_gem'
from ./tool/rbinstall.rb:799:in `block in <main>'
from ./tool/rbinstall.rb:950:in `block in <main>'
import java.util.*;
public class HelloWorld{
// static HashSet<Integer> allLengths(int k, int shorter, int longer){
// HashSet<Integer> lengths = new HashSet<Integer>();
// getAllLengths(k, 0, shorter, longer, lengths);
// return lengths;
// }
// // O(2 ^ K)
@MuhammetDilmac
MuhammetDilmac / result.json
Created November 14, 2019 09:08
Türkiye Şehirler ve İlçeleri
[
{
"name": "Adana",
"districts": [
{
"name": "Aladağ"
},
{
"name": "Ceyhan"
},
@tanaikech
tanaikech / submit.md
Last active January 10, 2024 02:00
Multipart-POST Request Using Google Apps Script

Multipart-POST Request Using Google Apps Script

April 20, 2019: GAS library for this situation was published. Please check it at https://github.com/tanaikech/FetchApp.

These sample scripts are for requesting multipart post using Google Apps Script.

In most cases, the multipart request is used for uploading files. So I prepared 2 sample situations as follows. For each situation, the request parameters are different.

  1. Upload a file from Google Drive to Slack.
  2. Convert an excel file to Spreadsheet on Google Drive using Drive API v3.
@seancdavis
seancdavis / script.rb
Last active January 6, 2023 08:21
Move files up one directory in Ruby
require 'fileutils'
path = File.expand_path('../', __FILE__)
Dir.glob("#{path}/**/*.*").each do |file|
new_path = "#{path}/#{file.split('/')[-1]}"
FileUtils.mv(file, new_path)
end
#!/usr/bin/env node
// Results from MacBook (Retina, 12-inch, Early 2016), 1.3 GHz Intel Core m7, macOS 10.12.3, Node 7.6.0
// let a = { z: 1 }
// human-friendly x 85,821,153 ops/sec ±1.81% (87 runs sampled)
// machine-friendly x 92,613,579 ops/sec ±1.89% (85 runs sampled)
// Fastest is machine-friendly
// let a = undefined
@nobitagit
nobitagit / iterm2.md
Last active August 24, 2023 12:16
iterm2 cheatsheet

This gist has been moved to its own Github repo, so it's easier to contribute with additions and corrections. Please open a PR there if you see any mistake, I don't track comments on here as there's no notification system for gists AFAIK. Thanks.

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
@wycats
wycats / errors.md
Last active October 21, 2018 12:04
How I think about error handling in Rust
  • Option: "None is a totally valid result, usually found in data structures"
    • unwrap(): YOLO use in prototyping
    • expect(...): to indicate the reason you believe None is impossible (or a contract violation for the method)
  • Result: 😱 "Errors are unexpected but not bugs; the decision for how to handle them is up to the caller"
    • unwrap(): YOLO "I'm an app and don't know how to handle this error -- I'm fine if the whole process aborts"
    • try! / ?: "Leave the decision about how to handle this error to the caller; they have more information"
    • match / catch: "I'm going to handle the error right here right now"
  • panic!: ☠ "The error is a bug and can't be recovered from. Game over man. Rust is allowed to abort the process if it wants"
@gregtoth
gregtoth / tmux-cheatsheet.md
Last active January 30, 2022 09:52
Tmux Cheatsheet

Tmux Cheatsheet

Tmux is a "terminal multiplexer" that makes it much easier to run multiple programs over a single ssh session. It lets you create multiple virtual terminals within a single ssh login, allowing you to easily flip between each virtual terminal. Each virtual terminal works like a regular terminal but has the added benefit that if you lose the overall ssh session you can log back in and re-attach to the tmux session and all your virtual terminals are still there where you left off. This also allows you to start one or more programs within virtual terminals, detach the tmux session, logout your ssh session, login via ssh a some point in the future, re-attach to your tmux session, and all your previous virtual terminals are exactly where you left off. Programs you run in virtual terminals continue to run while you're detached and/or while you're logged out all-together.

Shell cmd Action
tmux Start tmux
tmux ls Show existing tmux sessions
tmux attach Re-attach to last active