Skip to content

Instantly share code, notes, and snippets.

View quesurifn's full-sized avatar
🎯
Focusing

Kyle Fahey quesurifn

🎯
Focusing
View GitHub Profile
@quesurifn
quesurifn / export-vscode-search-to-csv.js
Created April 1, 2024 14:54 — forked from jakebellacera/export-vscode-search-to-csv.js
Export VSCode search results to CSV
// How to use:
// 1. In VS Code, perform a search.
// 2. Click "Open in editor" to open the search results in a `.code-search` file
// 3. Save the file
// 4. In terminal, run `node export-vscode-search-to-csv.js path/to/results.code-search path/to/exported.csv`
const fs = require("fs");
const path = require("path");
const readline = require("readline");
@quesurifn
quesurifn / enum.go
Created April 11, 2022 22:32 — forked from lummie/enum.go
Golang Enum pattern that can be serialized to json
package enum_example
import (
"bytes"
"encoding/json"
)
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred
type TaskState int
@quesurifn
quesurifn / flopsy.py
Created August 2, 2020 14:27 — forked from nathanborror/flopsy.py
A very simple way to interact with python amqplib
"""
Copyright (c) 2008-2009, Nathan Borror
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
@quesurifn
quesurifn / elasticsearch.repo
Last active April 23, 2019 23:00 — forked from nl5887/elasticsearch.repo
install elasticsearch on centos / amazon linux
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
@quesurifn
quesurifn / convert_number_strings.py
Created August 19, 2018 21:26 — forked from Keiku/convert_number_strings_to_numbers.py
Convert number strings with commas in pandas DataFrame to float.
import pandas as pd
import locale
from locale import atof
df = pd.DataFrame([['1,200', '4,200'], ['7,000', '-0.03'], ['5', '0']])
# 0 1
# 0 1,200 4,200
# 1 7,000 -0.03
# 2 5 0
locale.setlocale(locale.LC_NUMERIC, '')
@quesurifn
quesurifn / install_elasticsearch_osx.md
Created March 9, 2018 17:51 — forked from djonsson/install_elasticsearch_osx.md
OS X installation instructions for Elasticsearch + Kibana + Marvel

What is this?

Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask

Prerequisites

If you already have Java installed on your system, skip steps Install Cask and Install Java

If you already have Java and Homebrew installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update

Install Homebrew

  • $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@quesurifn
quesurifn / MongoDB update all matching.js
Created March 1, 2018 16:06 — forked from sym3tri/MongoDB update all matching.js
How to update a single field in a MongoDB collection for all documents matching a specific criteria
// FROM: http://www.mongodb.org/display/DOCS/Updating#Updating-update%28%29
//
// db.collection.update( criteria, objNew, upsert, multi )
// criteria - query which selects the record to update;
// objNew - updated object or $ operators (e.g., $inc) which manipulate the object
// upsert - if this should be an "upsert"; that is, if the record does not exist, insert it
// multi - if all documents matching criteria should be updated
//
// SQL VERSION:
// UPDATE myTable SET dateField = '2011-01-01' WHERE condField = 'condValue'
try {
// get transaction
const transaction = await sequelize.transaction();
// step 1
await Model.destroy({where: {id}}, {transaction});
// step 2
await Model.create({}, {transaction});
@quesurifn
quesurifn / nginx.conf
Created October 2, 2017 21:30 — forked from turtlesoupy/nginx.conf
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
@quesurifn
quesurifn / nginx.conf
Created October 2, 2017 21:30 — forked from turtlesoupy/nginx.conf
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;