Skip to content

Instantly share code, notes, and snippets.

View gingray's full-sized avatar
🎯
Focusing

Ivan gingray

🎯
Focusing
View GitHub Profile
@gingray
gingray / __why-and-how-to-use.md
Created January 3, 2022 18:15 — forked from passcod/__why-and-how-to-use.md
Bootstrap 4 mixins for spacing utilities without classes

Why?

This:

.action {
  @extend .ml-3;
}
@gingray
gingray / patch_apk_for_sniffing.md
Created January 17, 2021 13:43 — forked from unoexperto/patch_apk_for_sniffing.md
How to patch Android app to sniff its HTTPS traffic with self-signed certificate

How to patch Android app to sniff its HTTPS traffic with self-signed certificate

  • Download apktool from https://ibotpeaches.github.io/Apktool/
  • Unpack apk file: java -jar /home/expert/work/tools/apktool.jar d net.flixster.android-9.1.3@APK4Fun.com.apk
  • Modify AndroidManifest.xml by adding android:networkSecurityConfig="@xml/network_security_config" attribute to application element.
  • Create file /res/xml/network_security_config.xml with following content:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config>
@gingray
gingray / gist:ab2e9a6376aa6ccb516354c2bee74ab6
Created June 17, 2020 10:03 — forked from happyrobots/gist:1862963
Copy to Clipboard Using Ruby
# Mac
IO.popen('pbcopy', 'r+') { |clipboard| clipboard.puts html_out }
# Linux
IO.popen(’xsel –clipboard –input’, ‘r+’) { |clipboard| clipboard.puts html_out }
@gingray
gingray / p4merge4git.md
Last active March 9, 2020 16:51 — forked from tony4d/p4merge4git.md
Setup p4merge as a visual diff and merge tool for git
@gingray
gingray / howto.md
Created December 4, 2019 15:17 — forked from rafaelcaricio/howto.md
Using git bisect

Using git bisect

Git provides a simple way to find out where some code was modified or removed from your codebase. You can use git bisect for that and the processes can be completely automated.

As example I will try to find out when the method send_email_notification was removed from the file app/models/person.rb. So you have to create a automated bash file, or other kind of script, that should return 0 when the method is found and 1 otherwise. So git can run this script for each commit until it returns 1, which means that the method was removed in that commit. There's the script we gonna use:

if [[ `cat app/models/person.rb | grep send_email_notification` ]]; then
@gingray
gingray / bench.rb
Created January 18, 2019 15:44 — forked from JoshTGreenwood/bench.rb
Benchmark break vs. catch-throw vs. begin-rescue-end in ruby
require 'benchmark'
Benchmark.bmbm do |x|
x.report('Break') do
1_000_000.times do
break
end
end
@gingray
gingray / actionlist.vim
Created January 15, 2019 09:55 — forked from zchee/actionlist.vim
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@gingray
gingray / intellij.md
Created May 28, 2018 17:23 — forked from uarun/intellij.md
Intellij IDEA - Cheat Sheet (aka useful shortcuts)

Intellij IDEA - Cheat Sheet (aka most useful shortcuts)

Note: Some of these keymapping are specific to IdeaVim plugin. If you don't use IdeaVim (what' wrong with you :)), I've tried to point out where they differ, but I could have missed a few

Coding Session

Parameter documentation for Method Calls

  • Ctrl-P - Popup parameter documentation for method calls
@gingray
gingray / custom.el
Created September 27, 2017 07:18 — forked from kristianhellquist/custom.el
Emacs, copy current file and line number to clipboard
(defun copy-current-line-position-to-clipboard ()
"Copy current line in file to clipboard as '</path/to/file>:<line-number>'"
(interactive)
(let ((path-with-line-number
(concat (buffer-file-name) ":" (number-to-string (line-number-at-pos)))))
(x-select-text path-with-line-number)
(message (concat path-with-line-number " copied to clipboard"))))
(define-key global-map (kbd "M-l") 'copy-current-line-position-to-clipboard)
@gingray
gingray / latency.txt
Created September 15, 2017 08:47 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD