Skip to content

Instantly share code, notes, and snippets.

View dcts's full-sized avatar
💭
probably coding

dcts dcts

💭
probably coding
View GitHub Profile
@dcts
dcts / ruby_notes_array.rb
Last active April 21, 2019 11:57
RUBY MAGIC TRICKS
# USEFULL STUFF
# do something n times without index
10.times { puts "hello" }
# n times block with index
-5.upto(5) { |indx| puts indx }
# iterate over array with n elements of array
# will decrease the number of iterations by (n-1)
@dcts
dcts / find_bitcoin_addres.rb
Last active December 15, 2019 17:37
find bitcoin public address that starts with a given pattern
require 'bitcoin'
key = nil
addr = ""
iteration = 0
pattern = "Thomas"
until addr.start_with?("1#{pattern}")
key = Bitcoin::Key.generate
addr = key.addr
@dcts
dcts / workbench.colorCustomizations.json
Created April 14, 2020 16:51 — forked from jacklorusso/workbench.colorCustomizations.json
A list of all Visual Studio Code customizable colors, grouped by UI region. Copy and paste into User Settings (comments are allowed) to tweak an existing theme or work on your own.
"workbench.colorCustomizations": {
// Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast.
"contrastActiveBorder": "",
"contrastBorder": "",
// Base Colors
"focusBorder": "",
"foreground": "",
"widget.shadow": "",
"selection.background": "",
"descriptionForeground": "",
@dcts
dcts / average-geolocation.js
Created July 21, 2020 10:08 — forked from tlhunter/average-geolocation.js
Calculate the center/average of multiple GeoLocation coordinates
/**
* Calculate the center/average of multiple GeoLocation coordinates
* Expects an array of objects with .latitude and .longitude properties
*
* @url http://stackoverflow.com/a/14231286/538646
*/
function averageGeolocation(coords) {
if (coords.length === 1) {
return coords[0];
}
@dcts
dcts / uuid.js
Created July 29, 2020 11:45 — forked from outbreak/uuid.js
UUID v4 JavaScript implementation with window.crypto.getRandomValues()
function uuid () {
function getRandomSymbol (symbol) {
var array;
if (symbol === 'y') {
array = ['8', '9', 'a', 'b'];
return array[Math.floor(Math.random() * array.length)];
}
array = new Uint8Array(1);
@dcts
dcts / sideproject_marketing_checklist.md
Created October 28, 2020 17:24 — forked from hankbao/sideproject_marketing_checklist.md
The Side Project Marketing Checklist
layout title permalink
checklist_page
The Side Project Marketing Checklist
/marketing-checklist/

Pre-Launch

Market Research

@dcts
dcts / README.md
Last active December 9, 2020 14:38 — forked from acamino/README.md
Shortcuts to Improve Your Bash & Zsh Productivity

Shortcut — Action

  • CTRL + A — Move to the beginning of the line
  • CTRL + E — Move to the end of the line
  • CTRL + [left arrow] — Move one word backward (on some systems this is ALT + B)
  • CTRL + [right arrow] — Move one word forward (on some systems this is ALT + F)
  • CTRL + U — (bash) Clear the characters on the line before the current cursor position
  • CTRL + U —(zsh) If you're using the zsh, this will clear the entire line
  • CTRL + K — Clear the characters on the line after the current cursor position
  • ESC + [backspace] — Delete the word in front of the cursor
[Adblock Plus 2.0]
! Checksum: OTa5p+sF/XAuky8K97XxEw
! Title: Easylist Cookie List
! Updated: 9 Jan 2021
! Expires: 4 days (update frequency)
! License: http://creativecommons.org/licenses/by/3.0/
! Please report any unblocked content or problems by email or in our forums
! Email: easylist.subscription@gmail.com
! Homepage: https://easylist.to/
! Forums: https://forums.lanik.us/
@dcts
dcts / gist:76c74cbecdcae3e3aec15e40ad7c101b
Last active March 6, 2021 08:43
gridjs get Grid instance to change data programatically
import { Grid } from 'gridjs-react';
import { useRef } from "react";
const MyComponent = () => {
const gridRef = useRef();
const changeMyGrid = () => {
const gridjsInstance = gridRef.current.getInstance();
// update col names
gridjsInstance.updateConfig({
@dcts
dcts / scrape_opensea_floor_prices.py
Created October 24, 2021 21:10
Scrape opensea floor prices with python cloudscraper package
import cloudscraper
import json
def filter_typename(dict):
return dict["__typename"] == "AssetQuantityType"
def filter_quantityInEth_exists(dict):
if "quantityInEth" in dict:
return True
else: