Skip to content

Instantly share code, notes, and snippets.

View DrewWeth's full-sized avatar

Drew Wetherington DrewWeth

View GitHub Profile
import React, {useState} from 'react';
import { Input, Icon } from 'semantic-ui-react'
export const FocusEditableInput = (props) => {
const [state, setState] = useState ({
hovering: false,
focused: false,
value: props.value || ""
})
@DrewWeth
DrewWeth / minecraft-server-standard-1gb.sh
Last active January 18, 2020 01:26
Starting a Minecraft Server
#!/bin/sh
# Based on: https://gist.github.com/niksudan/a3f90651f35203815f245d5d09ac6646
# This script uses tmux instead of screen because of prefer it.
# Update package manager and download java development kit.
apt-get update && apt-get install default-jdk
# Downloads Minecraft server 1.15.1
wget -O minecraft_server.jar https://launcher.mojang.com/v1/objects/4d1826eebac84847c71a77f9349cc22afd0cf0a1/server.jar
; Arrow slot
XButton1::
CoordMode, Mouse, Screen
MouseGetPos, px, py
Click 1853, 328 right ; Click the right mouse button.
Mousemove, px,py, 1
Return
; Potions
XButton2::
XButton1::
CoordMode, Mouse, Screen
MouseGetPos, px, py
Click 1850, 292 right ; Click the right mouse button.
Mousemove, px,py, 1
Return
#p::Pause ; Pressing Win+P once will pause the script. Pressing it again will unpause.
Drews-MacBook-Pro-4:sqlite3 zizimaza$ node-gyp rebuild --target=0.36.7 --arch=x64 --target_platform=darwin --dist-url=https://atom.io/download/atom-shell --module_name=node_sqlite3 --module_path=../lib/binding/node-v47-darwin-x64
gyp info it worked if it ends with ok
gyp info using node-gyp@3.2.1
gyp info using node@0.10.28 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
fname = "numbers.txt"
with open(fname, "r") as f:
array = []
for line in f:
array.append(int(line.strip("\n")))
# print array
min = array[0]
require 'open-uri'
require 'nokogiri'
starting_url = ARGV[0]
channel_ids=[]
video_urls=[]
temp=[]
url_string = ""
page_source = Nokogiri::HTML(open(starting_url))
page_source.css("a").each do |url|
# bin/phantomjs --webdriver=9999
require 'selenium-webdriver'
require 'nokogiri'
require 'uri'
require 'json'
# supply video ID or full YouTube URL from command line
arg = ARGV[0]
if arg =~ /^#{URI::regexp}$/
@DrewWeth
DrewWeth / gist:b6a5ec907465b649d3cd
Last active August 29, 2015 14:22
HackerRank Stock Optimization
import java.lang.reflect.Array;
import java.util.ArrayList;
public class Main {
public Main(){
}
public static void main (String[]args){
@DrewWeth
DrewWeth / Sorry.js
Last active August 29, 2015 14:14
Hackathon Hackers Scraper (sorry)
// STEP 1: First import jQuery
// Here's a link to raw jQuery that can be copy/pasted into the console
// http://code.jquery.com/jquery-1.7.1.min.js
// NOTE: You have to have all the comments expanded first.
// STEP 2: copy/paste this. I'm not sure if #u_0_21 will work for everyone.
a = $('div > p:contains("Comment with your e-mail if you want $100")').parent().parent(); $('li div.UFICommentContent span.UFICommentBody', a).each(function(elem){ arr.push($(this).text()); });copy.log(arr);