Skip to content

Instantly share code, notes, and snippets.

View vrymel's full-sized avatar
🎯
Focusing

Vrymel Omandam vrymel

🎯
Focusing
View GitHub Profile
@vrymel
vrymel / split-by-multiple-separators.js
Last active March 31, 2021 00:48
Split inputs with multiple separators
const input = "a.com,b.com c.com\nwow.com";
const outputSet = splitByMultipleSeparators(input);
const outputArray = Array.from(outputSet); // ['a.com', 'b.com', 'c.com', 'wow.com']
function splitByMultipleSeparators(rawValue, separators = [",", " ", "\n"], uniqueTokens = new Set()) {
const separator = separators.pop();
if (!separator)
return uniqueTokens;
@vrymel
vrymel / fetch-pse-lookup.js
Created March 4, 2021 02:20
Fetch PSE Lookup API from a Node backend
const fetch = require('node-fetch');
fetch('https://pselookup.vrymel.com/api/stocks')
.then(response => response.json())
.then(data => console.log(data));
import os
import boto3
from botocore.exceptions import ClientError
import requests
import arrow
import csv
from time import sleep
from decimal import *
BASE_URL = os.environ['PSE_BASE_URL']
@vrymel
vrymel / pre-sharedkey-aes.py
Created August 3, 2019 07:34 — forked from gustavohenrique/pre-sharedkey-aes.py
An example using Python3 and AES criptography
import sys
import base64
from Crypto.Cipher import AES
class AESCipher(object):
def __init__(self, key):
self.bs = 16
self.cipher = AES.new(key, AES.MODE_ECB)
; The official HD AI
; An Artificial Intelligence Script written by Archon and Promiskuitiv
; Get in contact with Promiskuitiv by sending a mail to neuernamae@web.de
; List of taunts it reacts to:
; Standard taunts.
; 33 - Stop slinging resources. If slinging is requested early and is immediately canceled it may mess up the strategy.
; 38 - Sling Resources. Human player only, stops any unit production except for civilian units.

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@vrymel
vrymel / custom_ecto_query.exs
Created December 25, 2017 13:20
Elixir: using custom where statement with database build function calls
query = from i in Intersection,
where: i.lat >= 100.0 or i.lat <= 200.0,
where: i.lng >= 200.0 or i.lng <= 400.0,
where: fragment("acos(sin(?) * sin(lat) + cos(?) * cos(lat) * cos(lng - (?))) <= ?", 1, 2, 3, 4)
@vrymel
vrymel / scroll_direction_toggle.scpt
Last active November 30, 2021 18:41
Applescript for scroll direction toggle
tell application "System Preferences"
activate
reveal pane "Mouse"
end tell
delay 0.5
tell application "System Events" to tell process "System Preferences"
click checkbox "Scroll direction: Natural" of window "Mouse"
end tell
@vrymel
vrymel / Preferences.sublime-settings
Created September 18, 2017 11:08
Sublime Text 3 Preferences
{
"color_scheme": "Packages/ayu/ayu-mirage.tmTheme",
"ignored_packages":
[
"Vintage"
],
"theme": "ayu-mirage.sublime-theme",
"line_padding_top": 5,
"line_padding_bottom": 5,
"draw_indent_guides": false,
@vrymel
vrymel / rename_phoenix_project.sh
Created September 9, 2017 09:14
Command steps to rename a Phoenix project
# tested on macOS 10.12.4
# based on https://elixirforum.com/t/how-to-change-a-phoenix-project-name-smoothly/1217/6
# replace values as necessary
current_otp="hello_phoenix"
current_name="HelloPhoenix"
new_otp=""
new_name=""
git grep -l $current_otp | xargs sed -i '' -e 's/'$current_otp'/'$new_otp'/g'